Remove experimental prefix from otlp protocol config properties (#3622)
* Remove experimental prefix from otlp protocol config properties * Restore experimental otlp protocol configuration options, but mark as deprecated.
This commit is contained in:
parent
5643958493
commit
a1ea0d5ce1
|
|
@ -65,9 +65,12 @@ The [OpenTelemetry Protocol (OTLP)](https://github.com/open-telemetry/openteleme
|
||||||
| otel.exporter.otlp.timeout | OTEL_EXPORTER_OTLP_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace and metric batch. Default is `10000`. |
|
| otel.exporter.otlp.timeout | OTEL_EXPORTER_OTLP_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace and metric batch. Default is `10000`. |
|
||||||
| otel.exporter.otlp.traces.timeout | OTEL_EXPORTER_OTLP_TRACES_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace batch. Default is `10000`. |
|
| otel.exporter.otlp.traces.timeout | OTEL_EXPORTER_OTLP_TRACES_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace batch. Default is `10000`. |
|
||||||
| otel.exporter.otlp.metrics.timeout | OTEL_EXPORTER_OTLP_METRICS_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP metric batch. Default is `10000`. |
|
| otel.exporter.otlp.metrics.timeout | OTEL_EXPORTER_OTLP_METRICS_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP metric batch. Default is `10000`. |
|
||||||
| otel.experimental.exporter.otlp.protocol | OTEL_EXPERIMENTAL_EXPORTER_OTLP_PROTOCOL | The transport protocol to use on OTLP trace and metrics requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
| otel.exporter.otlp.protocol | OTEL_EXPORTER_OTLP_PROTOCOL | The transport protocol to use on OTLP trace and metrics requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
||||||
| otel.experimental.exporter.otlp.traces.protocol | OTEL_EXPERIMENTAL_EXPORTER_OTLP_TRACES_PROTOCOL | The transport protocol to use on OTLP trace requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
| otel.exporter.otlp.traces.protocol | OTEL_EXPORTER_OTLP_TRACES_PROTOCOL | The transport protocol to use on OTLP trace requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
||||||
| otel.experimental.exporter.otlp.metrics.protocol | OTEL_EXPERIMENTAL_EXPORTER_OTLP_METRICS_PROTOCOL | The transport protocol to use on OTLP metrics requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
| otel.exporter.otlp.metrics.protocol | OTEL_EXPORTER_OTLP_METRICS_PROTOCOL | The transport protocol to use on OTLP metrics requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
||||||
|
| otel.experimental.exporter.otlp.protocol | OTEL_EXPERIMENTAL_EXPORTER_OTLP_PROTOCOL | **DEPRECATED for removal in 1.8.0.** The transport protocol to use on OTLP trace and metrics requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
||||||
|
| otel.experimental.exporter.otlp.traces.protocol | OTEL_EXPERIMENTAL_EXPORTER_OTLP_TRACES_PROTOCOL | **DEPRECATED for removal in 1.8.0.** The transport protocol to use on OTLP trace requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
||||||
|
| otel.experimental.exporter.otlp.metrics.protocol | OTEL_EXPERIMENTAL_EXPORTER_OTLP_METRICS_PROTOCOL | **DEPRECATED for removal in 1.8.0.** The transport protocol to use on OTLP metrics requests. Options include `grpc` and `http/protobuf`. Default is `grpc`. |
|
||||||
|
|
||||||
To configure the service name for the OTLP exporter, add the `service.name` key
|
To configure the service name for the OTLP exporter, add the `service.name` key
|
||||||
to the OpenTelemetry Resource ([see below](#opentelemetry-resource)), e.g. `OTEL_RESOURCE_ATTRIBUTES=service.name=myservice`.
|
to the OpenTelemetry Resource ([see below](#opentelemetry-resource)), e.g. `OTEL_RESOURCE_ATTRIBUTES=service.name=myservice`.
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,13 @@ final class OtlpConfigUtil {
|
||||||
static final String DATA_TYPE_METRICS = "metrics";
|
static final String DATA_TYPE_METRICS = "metrics";
|
||||||
|
|
||||||
static String getOtlpProtocol(String dataType, ConfigProperties config) {
|
static String getOtlpProtocol(String dataType, ConfigProperties config) {
|
||||||
String protocol = config.getString("otel.experimental.exporter.otlp." + dataType + ".protocol");
|
String protocol = config.getString("otel.exporter.otlp." + dataType + ".protocol");
|
||||||
|
if (protocol == null) {
|
||||||
|
protocol = config.getString("otel.exporter.otlp.protocol");
|
||||||
|
}
|
||||||
|
if (protocol == null) {
|
||||||
|
protocol = config.getString("otel.experimental.exporter.otlp." + dataType + ".protocol");
|
||||||
|
}
|
||||||
if (protocol == null) {
|
if (protocol == null) {
|
||||||
protocol = config.getString("otel.experimental.exporter.otlp.protocol");
|
protocol = config.getString("otel.experimental.exporter.otlp.protocol");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class NotOnClasspathTest {
|
||||||
void otlpHttpSpans() {
|
void otlpHttpSpans() {
|
||||||
ConfigProperties config =
|
ConfigProperties config =
|
||||||
DefaultConfigProperties.createForTest(
|
DefaultConfigProperties.createForTest(
|
||||||
Collections.singletonMap("otel.experimental.exporter.otlp.protocol", "http/protobuf"));
|
Collections.singletonMap("otel.exporter.otlp.protocol", "http/protobuf"));
|
||||||
assertThatThrownBy(
|
assertThatThrownBy(
|
||||||
() ->
|
() ->
|
||||||
SpanExporterConfiguration.configureExporter("otlp", config, Collections.emptyMap()))
|
SpanExporterConfiguration.configureExporter("otlp", config, Collections.emptyMap()))
|
||||||
|
|
@ -104,7 +104,7 @@ class NotOnClasspathTest {
|
||||||
void otlpHttpMetrics() {
|
void otlpHttpMetrics() {
|
||||||
ConfigProperties config =
|
ConfigProperties config =
|
||||||
DefaultConfigProperties.createForTest(
|
DefaultConfigProperties.createForTest(
|
||||||
Collections.singletonMap("otel.experimental.exporter.otlp.protocol", "http/protobuf"));
|
Collections.singletonMap("otel.exporter.otlp.protocol", "http/protobuf"));
|
||||||
assertThatCode(
|
assertThatCode(
|
||||||
() ->
|
() ->
|
||||||
MetricExporterConfiguration.configureExporter(
|
MetricExporterConfiguration.configureExporter(
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,29 @@ class OtlpConfigUtilTest {
|
||||||
DATA_TYPE_TRACES,
|
DATA_TYPE_TRACES,
|
||||||
DefaultConfigProperties.createForTest(
|
DefaultConfigProperties.createForTest(
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
"otel.experimental.exporter.otlp.protocol",
|
"otel.experimental.exporter.otlp.protocol", "foo",
|
||||||
"foo",
|
"otel.experimental.exporter.otlp.traces.protocol", "bar"))))
|
||||||
"otel.experimental.exporter.otlp.traces.protocol",
|
|
||||||
"bar"))))
|
|
||||||
.isEqualTo("bar");
|
.isEqualTo("bar");
|
||||||
|
|
||||||
|
assertThat(
|
||||||
|
OtlpConfigUtil.getOtlpProtocol(
|
||||||
|
DATA_TYPE_TRACES,
|
||||||
|
DefaultConfigProperties.createForTest(
|
||||||
|
ImmutableMap.of(
|
||||||
|
"otel.experimental.exporter.otlp.protocol", "foo",
|
||||||
|
"otel.experimental.exporter.otlp.traces.protocol", "bar",
|
||||||
|
"otel.exporter.otlp.protocol", "baz"))))
|
||||||
|
.isEqualTo("baz");
|
||||||
|
|
||||||
|
assertThat(
|
||||||
|
OtlpConfigUtil.getOtlpProtocol(
|
||||||
|
DATA_TYPE_TRACES,
|
||||||
|
DefaultConfigProperties.createForTest(
|
||||||
|
ImmutableMap.of(
|
||||||
|
"otel.experimental.exporter.otlp.protocol", "foo",
|
||||||
|
"otel.experimental.exporter.otlp.traces.protocol", "bar",
|
||||||
|
"otel.exporter.otlp.protocol", "baz",
|
||||||
|
"otel.exporter.otlp.traces.protocol", "qux"))))
|
||||||
|
.isEqualTo("qux");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class MetricExporterConfigurationTest {
|
||||||
() ->
|
() ->
|
||||||
MetricExporterConfiguration.configureOtlpMetrics(
|
MetricExporterConfiguration.configureOtlpMetrics(
|
||||||
DefaultConfigProperties.createForTest(
|
DefaultConfigProperties.createForTest(
|
||||||
ImmutableMap.of("otel.experimental.exporter.otlp.protocol", "foo")),
|
ImmutableMap.of("otel.exporter.otlp.protocol", "foo")),
|
||||||
SdkMeterProvider.builder().build()))
|
SdkMeterProvider.builder().build()))
|
||||||
.isInstanceOf(ConfigurationException.class)
|
.isInstanceOf(ConfigurationException.class)
|
||||||
.hasMessageContaining("Unsupported OTLP metrics protocol: foo");
|
.hasMessageContaining("Unsupported OTLP metrics protocol: foo");
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class SpanExporterConfigurationTest {
|
||||||
() ->
|
() ->
|
||||||
SpanExporterConfiguration.configureOtlp(
|
SpanExporterConfiguration.configureOtlp(
|
||||||
DefaultConfigProperties.createForTest(
|
DefaultConfigProperties.createForTest(
|
||||||
ImmutableMap.of("otel.experimental.exporter.otlp.protocol", "foo"))))
|
ImmutableMap.of("otel.exporter.otlp.protocol", "foo"))))
|
||||||
.isInstanceOf(ConfigurationException.class)
|
.isInstanceOf(ConfigurationException.class)
|
||||||
.hasMessageContaining("Unsupported OTLP traces protocol: foo");
|
.hasMessageContaining("Unsupported OTLP traces protocol: foo");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ class OtlpHttpConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void configureExportersGeneral() {
|
void configureExportersGeneral() {
|
||||||
Map<String, String> props = new HashMap<>();
|
Map<String, String> props = new HashMap<>();
|
||||||
props.put("otel.experimental.exporter.otlp.protocol", "http/protobuf");
|
props.put("otel.exporter.otlp.protocol", "http/protobuf");
|
||||||
props.put("otel.exporter.otlp.traces.endpoint", traceEndpoint());
|
props.put("otel.exporter.otlp.traces.endpoint", traceEndpoint());
|
||||||
props.put("otel.exporter.otlp.metrics.endpoint", metricEndpoint());
|
props.put("otel.exporter.otlp.metrics.endpoint", metricEndpoint());
|
||||||
props.put("otel.exporter.otlp.certificate", certificateExtension.filePath);
|
props.put("otel.exporter.otlp.certificate", certificateExtension.filePath);
|
||||||
|
|
@ -219,8 +219,8 @@ class OtlpHttpConfigTest {
|
||||||
// Set values for general and signal specific properties. Signal specific should override
|
// Set values for general and signal specific properties. Signal specific should override
|
||||||
// general.
|
// general.
|
||||||
Map<String, String> props = new HashMap<>();
|
Map<String, String> props = new HashMap<>();
|
||||||
props.put("otel.experimental.exporter.otlp.protocol", "grpc");
|
props.put("otel.exporter.otlp.protocol", "grpc");
|
||||||
props.put("otel.experimental.exporter.otlp.traces.protocol", "http/protobuf");
|
props.put("otel.exporter.otlp.traces.protocol", "http/protobuf");
|
||||||
props.put("otel.exporter.otlp.endpoint", "http://foo.bar");
|
props.put("otel.exporter.otlp.endpoint", "http://foo.bar");
|
||||||
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
|
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
|
||||||
props.put("otel.exporter.otlp.headers", "header-key=dummy-value");
|
props.put("otel.exporter.otlp.headers", "header-key=dummy-value");
|
||||||
|
|
@ -259,8 +259,8 @@ class OtlpHttpConfigTest {
|
||||||
// Set values for general and signal specific properties. Signal specific should override
|
// Set values for general and signal specific properties. Signal specific should override
|
||||||
// general.
|
// general.
|
||||||
Map<String, String> props = new HashMap<>();
|
Map<String, String> props = new HashMap<>();
|
||||||
props.put("otel.experimental.exporter.otlp.protocol", "grpc");
|
props.put("otel.exporter.otlp.protocol", "grpc");
|
||||||
props.put("otel.experimental.exporter.otlp.metrics.protocol", "http/protobuf");
|
props.put("otel.exporter.otlp.metrics.protocol", "http/protobuf");
|
||||||
props.put("otel.exporter.otlp.endpoint", "http://foo.bar");
|
props.put("otel.exporter.otlp.endpoint", "http://foo.bar");
|
||||||
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
|
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
|
||||||
props.put("otel.exporter.otlp.headers", "header-key=dummy-value");
|
props.put("otel.exporter.otlp.headers", "header-key=dummy-value");
|
||||||
|
|
@ -296,7 +296,7 @@ class OtlpHttpConfigTest {
|
||||||
@Test
|
@Test
|
||||||
void configureTlsInvalidCertificatePath() {
|
void configureTlsInvalidCertificatePath() {
|
||||||
Map<String, String> props = new HashMap<>();
|
Map<String, String> props = new HashMap<>();
|
||||||
props.put("otel.experimental.exporter.otlp.protocol", "http/protobuf");
|
props.put("otel.exporter.otlp.protocol", "http/protobuf");
|
||||||
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
|
props.put("otel.exporter.otlp.certificate", Paths.get("foo", "bar", "baz").toString());
|
||||||
ConfigProperties properties = DefaultConfigProperties.createForTest(props);
|
ConfigProperties properties = DefaultConfigProperties.createForTest(props);
|
||||||
|
|
||||||
|
|
@ -348,7 +348,7 @@ class OtlpHttpConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void configuresGlobal() {
|
void configuresGlobal() {
|
||||||
System.setProperty("otel.experimental.exporter.otlp.protocol", "http/protobuf");
|
System.setProperty("otel.exporter.otlp.protocol", "http/protobuf");
|
||||||
System.setProperty("otel.exporter.otlp.traces.endpoint", traceEndpoint());
|
System.setProperty("otel.exporter.otlp.traces.endpoint", traceEndpoint());
|
||||||
System.setProperty("otel.exporter.otlp.metrics.endpoint", metricEndpoint());
|
System.setProperty("otel.exporter.otlp.metrics.endpoint", metricEndpoint());
|
||||||
System.setProperty("otel.exporter.otlp.certificate", certificateExtension.filePath);
|
System.setProperty("otel.exporter.otlp.certificate", certificateExtension.filePath);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue