Change default OTLP protocol to http/protobuf (#9993)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
parent
325477e6f6
commit
f6176919e4
|
@ -82,6 +82,9 @@ abstract class SmokeTest {
|
|||
.withEnv("JAVA_TOOL_OPTIONS", "-javaagent:/opentelemetry-javaagent.jar")
|
||||
.withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
|
||||
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
|
||||
// TODO (heya) update smoke tests to run using http/protobuf
|
||||
// in the meantime, force smoke tests to use grpc protocol for all exporters
|
||||
.withEnv("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc")
|
||||
.withEnv("OTEL_PROPAGATORS", "tracecontext,baggage,demo")
|
||||
.withEnv(getExtraEnv())
|
||||
.waitingFor(getTargetWaitStrategy());
|
||||
|
|
|
@ -101,6 +101,9 @@ abstract class IntegrationTest {
|
|||
.withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
|
||||
.withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
|
||||
.withEnv("OTEL_PROPAGATORS", "tracecontext,baggage,demo")
|
||||
// TODO (heya) update smoke tests to run using http/protobuf
|
||||
// in the meantime, force smoke tests to use grpc protocol for all exporters
|
||||
.withEnv("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc")
|
||||
.withEnv(getExtraEnv())
|
||||
.waitingFor(getTargetWaitStrategy());
|
||||
// If external extensions are requested
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.tooling.config;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizer;
|
||||
import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider;
|
||||
import java.util.Collections;
|
||||
|
||||
@AutoService(AutoConfigurationCustomizerProvider.class)
|
||||
public class OtlpProtocolPropertiesSupplier implements AutoConfigurationCustomizerProvider {
|
||||
|
||||
@Override
|
||||
public void customize(AutoConfigurationCustomizer autoConfigurationCustomizer) {
|
||||
autoConfigurationCustomizer.addPropertiesSupplier(
|
||||
() -> Collections.singletonMap("otel.exporter.otlp.protocol", "http/protobuf"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int order() {
|
||||
// make sure it runs BEFORE all the user-provided customizers
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.tooling.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry;
|
||||
import io.opentelemetry.api.events.GlobalEventEmitterProvider;
|
||||
import io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller;
|
||||
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
|
||||
import io.opentelemetry.sdk.autoconfigure.internal.AutoConfigureUtil;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junitpioneer.jupiter.SetSystemProperty;
|
||||
|
||||
class OtlpProtocolPropertiesSupplierTest {
|
||||
|
||||
@AfterEach
|
||||
void cleanUp() {
|
||||
GlobalOpenTelemetry.resetForTest();
|
||||
GlobalEventEmitterProvider.resetForTest();
|
||||
}
|
||||
|
||||
@SetSystemProperty(
|
||||
key = "otel.exporter.otlp.protocol",
|
||||
value = "grpc") // user explicitly sets grpc
|
||||
@Test
|
||||
void keepUserOtlpProtocolConfiguration() {
|
||||
// when
|
||||
AutoConfiguredOpenTelemetrySdk autoConfiguredSdk =
|
||||
OpenTelemetryInstaller.installOpenTelemetrySdk(this.getClass().getClassLoader());
|
||||
|
||||
// then
|
||||
assertThat(
|
||||
AutoConfigureUtil.getConfig(autoConfiguredSdk).getString("otel.exporter.otlp.protocol"))
|
||||
.isEqualTo("grpc");
|
||||
}
|
||||
|
||||
@Test
|
||||
void defaultHttpProtobufOtlpProtocolConfiguration() {
|
||||
// when
|
||||
AutoConfiguredOpenTelemetrySdk autoConfiguredSdk =
|
||||
OpenTelemetryInstaller.installOpenTelemetrySdk(this.getClass().getClassLoader());
|
||||
|
||||
// then
|
||||
assertThat(
|
||||
AutoConfigureUtil.getConfig(autoConfiguredSdk).getString("otel.exporter.otlp.protocol"))
|
||||
.isEqualTo("http/protobuf");
|
||||
}
|
||||
}
|
|
@ -1,2 +1,3 @@
|
|||
io.opentelemetry.javaagent.tooling.config.ConfigurationPropertiesSupplier
|
||||
io.opentelemetry.javaagent.tooling.config.OtlpProtocolPropertiesSupplier
|
||||
io.opentelemetry.javaagent.tooling.config.ConfigurationPropertiesSupplierTest$UserCustomPropertiesSupplier
|
||||
|
|
|
@ -30,6 +30,11 @@ public abstract class AbstractTestContainerManager implements TestContainerManag
|
|||
// Liberty20Jdk11, Payara6Jdk11 and Payara6Jdk17 fail with
|
||||
// java.util.zip.ZipException: Invalid CEN header (invalid zip64 extra data field size)
|
||||
+ " -Djdk.util.zip.disableZip64ExtraFieldValidation=true");
|
||||
|
||||
// TODO (heya) update smoke tests to run using http/protobuf
|
||||
// in the meantime, force smoke tests to use grpc protocol for all exporters
|
||||
environment.put("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc");
|
||||
|
||||
environment.put("OTEL_BSP_MAX_EXPORT_BATCH_SIZE", "1");
|
||||
environment.put("OTEL_BSP_SCHEDULE_DELAY", "10ms");
|
||||
environment.put("OTEL_METRIC_EXPORT_INTERVAL", "1000");
|
||||
|
|
Loading…
Reference in New Issue