diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-common.txt b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-common.txt index d0b1c3e9963..d074d37995d 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-sdk-common.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-sdk-common.txt @@ -2,6 +2,8 @@ Comparing source compatibility of against **** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.common.InstrumentationScopeInfo (not serializable) === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 +++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder builder(java.lang.String) + === UNCHANGED METHOD: PUBLIC STATIC io.opentelemetry.sdk.common.InstrumentationScopeInfo create(java.lang.String, java.lang.String, java.lang.String) + +++ NEW ANNOTATION: java.lang.Deprecated +++* NEW METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.common.Attributes getAttributes() +++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder (not serializable) +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. diff --git a/exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftSpanExporterTest.java b/exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftSpanExporterTest.java index c4f77f539b9..bf9a8152ebf 100644 --- a/exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftSpanExporterTest.java +++ b/exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftSpanExporterTest.java @@ -83,7 +83,9 @@ void testExport() throws SenderException, UnknownHostException { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setResource( Resource.create( Attributes.of( @@ -158,7 +160,9 @@ void testExportMultipleResources() throws SenderException, UnknownHostException .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setResource( Resource.create( Attributes.of( @@ -181,7 +185,9 @@ void testExportMultipleResources() throws SenderException, UnknownHostException .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setResource( Resource.create( Attributes.of( diff --git a/exporters/jaeger/src/test/java/io/opentelemetry/exporter/jaeger/JaegerGrpcSpanExporterTest.java b/exporters/jaeger/src/test/java/io/opentelemetry/exporter/jaeger/JaegerGrpcSpanExporterTest.java index 46d7b4cbb75..ceebf069008 100644 --- a/exporters/jaeger/src/test/java/io/opentelemetry/exporter/jaeger/JaegerGrpcSpanExporterTest.java +++ b/exporters/jaeger/src/test/java/io/opentelemetry/exporter/jaeger/JaegerGrpcSpanExporterTest.java @@ -126,7 +126,9 @@ void testExport() throws Exception { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setResource( Resource.create( Attributes.of( @@ -177,7 +179,9 @@ void testExportMultipleResources() throws Exception { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setResource( Resource.create( Attributes.of( @@ -202,7 +206,9 @@ void testExportMultipleResources() throws Exception { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setResource( Resource.create( Attributes.of( diff --git a/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingLogExporterTest.java b/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingLogExporterTest.java index 111f709619e..21086cc8584 100644 --- a/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingLogExporterTest.java +++ b/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingLogExporterTest.java @@ -61,7 +61,7 @@ class OtlpJsonLoggingLogExporterTest { TestLogData.builder() .setResource(RESOURCE) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("instrumentation2", "2", null)) + InstrumentationScopeInfo.builder("instrumentation2").setVersion("2").build()) .setBody("body2") .setSeverity(Severity.INFO) .setSeverityText("INFO") diff --git a/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporterTest.java b/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporterTest.java index 76568fa582c..22053528842 100644 --- a/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporterTest.java +++ b/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporterTest.java @@ -53,7 +53,7 @@ class OtlpJsonLoggingMetricExporterTest { private static final MetricData METRIC2 = ImmutableMetricData.createDoubleSum( RESOURCE, - InstrumentationScopeInfo.create("instrumentation2", "2", null), + InstrumentationScopeInfo.builder("instrumentation2").setVersion("2").build(), "metric2", "metric2 description", "s", diff --git a/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingSpanExporterTest.java b/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingSpanExporterTest.java index a139aabfbd0..9c429003c44 100644 --- a/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingSpanExporterTest.java +++ b/exporters/logging-otlp/src/test/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingSpanExporterTest.java @@ -86,7 +86,7 @@ class OtlpJsonLoggingSpanExporterTest { .setKind(SpanKind.CLIENT) .setResource(RESOURCE) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("instrumentation2", "2", null)) + InstrumentationScopeInfo.builder("instrumentation2").setVersion("2").build()) .build(); @RegisterExtension diff --git a/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingMetricExporterTest.java b/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingMetricExporterTest.java index 267904ef92d..fad2eba5e71 100644 --- a/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingMetricExporterTest.java +++ b/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingMetricExporterTest.java @@ -63,7 +63,7 @@ void testExport() { long nowEpochNanos = System.currentTimeMillis() * 1000 * 1000; Resource resource = Resource.create(Attributes.of(stringKey("host"), "localhost")); InstrumentationScopeInfo instrumentationScopeInfo = - InstrumentationScopeInfo.create("manualInstrumentation", "1.0", null); + InstrumentationScopeInfo.builder("manualInstrumentation").setVersion("1.0").build(); exporter.export( Arrays.asList( ImmutableMetricData.createDoubleSummary( diff --git a/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingSpanExporterTest.java b/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingSpanExporterTest.java index b1fa6330cd5..6f929d47a43 100644 --- a/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingSpanExporterTest.java +++ b/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/LoggingSpanExporterTest.java @@ -82,7 +82,8 @@ class LoggingSpanExporterTest { .setStatus(StatusData.error()) .setName("testSpan2") .setKind(SpanKind.CLIENT) - .setInstrumentationScopeInfo(InstrumentationScopeInfo.create("tracer2", "1.0", null)) + .setInstrumentationScopeInfo( + InstrumentationScopeInfo.builder("tracer2").setVersion("1.0").build()) .build(); @RegisterExtension diff --git a/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/SystemOutLogExporterTest.java b/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/SystemOutLogExporterTest.java index 6cc8a499ccf..b77a2330f00 100644 --- a/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/SystemOutLogExporterTest.java +++ b/exporters/logging/src/test/java/io/opentelemetry/exporter/logging/SystemOutLogExporterTest.java @@ -53,7 +53,8 @@ void format() { private static LogData sampleLog(long timestamp) { return TestLogData.builder() .setResource(Resource.empty()) - .setInstrumentationScopeInfo(InstrumentationScopeInfo.create("logTest", "1.0", null)) + .setInstrumentationScopeInfo( + InstrumentationScopeInfo.builder("logTest").setVersion("1.0").build()) .setAttributes(Attributes.of(stringKey("cheese"), "cheddar", longKey("amount"), 1L)) .setBody("message") .setSeverity(Severity.ERROR3) diff --git a/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java b/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java index 0389f3cbebc..140a279b963 100644 --- a/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java +++ b/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/http/trace/OtlpHttpSpanExporterTest.java @@ -347,7 +347,10 @@ private static SpanData generateFakeSpan() { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) + InstrumentationScopeInfo.builder("testLib") + .setVersion("1.0") + .setSchemaUrl("http://url") + .build()) .build(); } } diff --git a/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcSpanExporterTest.java b/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcSpanExporterTest.java index c638ae8cf55..f411e7f6fb0 100644 --- a/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcSpanExporterTest.java +++ b/exporters/otlp/all/src/test/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcSpanExporterTest.java @@ -78,7 +78,10 @@ protected SpanData generateFakeTelemetry() { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) + InstrumentationScopeInfo.builder("testLib") + .setVersion("1.0") + .setSchemaUrl("http://url") + .build()) .build(); } diff --git a/exporters/otlp/all/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettySpanExporterTest.java b/exporters/otlp/all/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettySpanExporterTest.java index 6b8fa1f4630..764f924dd8f 100644 --- a/exporters/otlp/all/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettySpanExporterTest.java +++ b/exporters/otlp/all/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettySpanExporterTest.java @@ -86,7 +86,10 @@ protected SpanData generateFakeTelemetry() { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) + InstrumentationScopeInfo.builder("testLib") + .setVersion("1.0") + .setSchemaUrl("http://url") + .build()) .build(); } diff --git a/exporters/otlp/all/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettyShadedSpanExporterTest.java b/exporters/otlp/all/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettyShadedSpanExporterTest.java index b47b417aafd..e876c1e9917 100644 --- a/exporters/otlp/all/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettyShadedSpanExporterTest.java +++ b/exporters/otlp/all/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcNettyShadedSpanExporterTest.java @@ -74,7 +74,10 @@ protected SpanData generateFakeTelemetry() { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) + InstrumentationScopeInfo.builder("testLib") + .setVersion("1.0") + .setSchemaUrl("http://url") + .build()) .build(); } diff --git a/exporters/otlp/all/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcOkHttpSpanExporterTest.java b/exporters/otlp/all/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcOkHttpSpanExporterTest.java index 17eced6bd3e..550a8f4524a 100644 --- a/exporters/otlp/all/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcOkHttpSpanExporterTest.java +++ b/exporters/otlp/all/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/trace/OtlpGrpcOkHttpSpanExporterTest.java @@ -74,7 +74,10 @@ protected SpanData generateFakeTelemetry() { .setTotalRecordedLinks(0) .setTotalRecordedEvents(0) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) + InstrumentationScopeInfo.builder("testLib") + .setVersion("1.0") + .setSchemaUrl("http://url") + .build()) .build(); } diff --git a/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/logs/LogsRequestMarshalerTest.java b/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/logs/LogsRequestMarshalerTest.java index 9b32077509f..98886745be9 100644 --- a/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/logs/LogsRequestMarshalerTest.java +++ b/exporters/otlp/common/src/test/java/io/opentelemetry/exporter/internal/otlp/logs/LogsRequestMarshalerTest.java @@ -103,7 +103,7 @@ void toProtoLogRecord() { .setResource( Resource.create(Attributes.builder().put("testKey", "testValue").build())) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("instrumentation", "1", null)) + InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build()) .setBody(BODY) .setSeverity(Severity.INFO) .setSeverityText("INFO") @@ -137,7 +137,7 @@ void toProtoLogRecord_MinimalFields() { .setResource( Resource.create(Attributes.builder().put("testKey", "testValue").build())) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("instrumentation", "1", null)) + InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build()) .setEpoch(12345, TimeUnit.NANOSECONDS) .build())); diff --git a/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java b/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java index bb713a6ac1f..227792df626 100644 --- a/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java +++ b/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/http/logs/OtlpHttpLogExporterTest.java @@ -342,7 +342,10 @@ private static LogData generateFakeLog() { return TestLogData.builder() .setResource(Resource.getDefault()) .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) + InstrumentationScopeInfo.builder("testLib") + .setVersion("1.0") + .setSchemaUrl("http://url") + .build()) .setBody("log body") .setAttributes(Attributes.builder().put("key", "value").build()) .setSeverity(Severity.INFO) diff --git a/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcLogExporterTest.java b/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcLogExporterTest.java index c5904cd3f35..712eed6c510 100644 --- a/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcLogExporterTest.java +++ b/exporters/otlp/logs/src/test/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcLogExporterTest.java @@ -58,7 +58,8 @@ protected TelemetryExporterBuilder exporterBuilder() { protected LogData generateFakeTelemetry() { return TestLogData.builder() .setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) - .setInstrumentationScopeInfo(InstrumentationScopeInfo.create("instrumentation", "1", null)) + .setInstrumentationScopeInfo( + InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build()) .setEpoch(Instant.now()) .setSeverity(Severity.ERROR) .setSeverityText("really severe") diff --git a/exporters/otlp/logs/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyLogExporterTest.java b/exporters/otlp/logs/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyLogExporterTest.java index 995c25fc639..57190d89072 100644 --- a/exporters/otlp/logs/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyLogExporterTest.java +++ b/exporters/otlp/logs/src/testGrpcNetty/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyLogExporterTest.java @@ -66,7 +66,8 @@ protected TelemetryExporterBuilder exporterBuilder() { protected LogData generateFakeTelemetry() { return TestLogData.builder() .setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) - .setInstrumentationScopeInfo(InstrumentationScopeInfo.create("instrumentation", "1", null)) + .setInstrumentationScopeInfo( + InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build()) .setEpoch(Instant.now()) .setSeverity(Severity.ERROR) .setSeverityText("really severe") diff --git a/exporters/otlp/logs/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyShadedLogExporterTest.java b/exporters/otlp/logs/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyShadedLogExporterTest.java index f73f80a3980..4cfa0cf2367 100644 --- a/exporters/otlp/logs/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyShadedLogExporterTest.java +++ b/exporters/otlp/logs/src/testGrpcNettyShaded/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyShadedLogExporterTest.java @@ -54,7 +54,8 @@ protected TelemetryExporterBuilder exporterBuilder() { protected LogData generateFakeTelemetry() { return TestLogData.builder() .setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) - .setInstrumentationScopeInfo(InstrumentationScopeInfo.create("instrumentation", "1", null)) + .setInstrumentationScopeInfo( + InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build()) .setEpoch(Instant.now()) .setSeverity(Severity.ERROR) .setSeverityText("really severe") diff --git a/exporters/otlp/logs/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyOkHttpLogExporterTest.java b/exporters/otlp/logs/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyOkHttpLogExporterTest.java index ab0574333ed..a7cfccd95d7 100644 --- a/exporters/otlp/logs/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyOkHttpLogExporterTest.java +++ b/exporters/otlp/logs/src/testGrpcOkhttp/java/io/opentelemetry/exporter/otlp/logs/OtlpGrpcNettyOkHttpLogExporterTest.java @@ -54,7 +54,8 @@ protected TelemetryExporterBuilder exporterBuilder() { protected LogData generateFakeTelemetry() { return TestLogData.builder() .setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) - .setInstrumentationScopeInfo(InstrumentationScopeInfo.create("instrumentation", "1", null)) + .setInstrumentationScopeInfo( + InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build()) .setEpoch(Instant.now()) .setSeverity(Severity.ERROR) .setSeverityText("really severe") diff --git a/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/MetricAdapterTest.java b/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/MetricAdapterTest.java index 95dcef4cd9f..52270a8fb95 100644 --- a/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/MetricAdapterTest.java +++ b/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/MetricAdapterTest.java @@ -52,7 +52,7 @@ class MetricAdapterTest { private static final MetricData MONOTONIC_CUMULATIVE_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -65,7 +65,7 @@ class MetricAdapterTest { private static final MetricData NON_MONOTONIC_CUMULATIVE_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -78,7 +78,7 @@ class MetricAdapterTest { private static final MetricData MONOTONIC_DELTA_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -91,7 +91,7 @@ class MetricAdapterTest { private static final MetricData NON_MONOTONIC_DELTA_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -104,7 +104,7 @@ class MetricAdapterTest { private static final MetricData MONOTONIC_CUMULATIVE_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -117,7 +117,7 @@ class MetricAdapterTest { private static final MetricData NON_MONOTONIC_CUMULATIVE_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -130,7 +130,7 @@ class MetricAdapterTest { private static final MetricData MONOTONIC_DELTA_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -143,7 +143,7 @@ class MetricAdapterTest { private static final MetricData NON_MONOTONIC_DELTA_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -157,7 +157,7 @@ class MetricAdapterTest { private static final MetricData DOUBLE_GAUGE = ImmutableMetricData.createDoubleGauge( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -168,7 +168,7 @@ class MetricAdapterTest { private static final MetricData LONG_GAUGE = ImmutableMetricData.createLongGauge( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -179,7 +179,7 @@ class MetricAdapterTest { private static final MetricData SUMMARY = ImmutableMetricData.createDoubleSummary( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -197,7 +197,7 @@ class MetricAdapterTest { private static final MetricData HISTOGRAM = ImmutableMetricData.createDoubleHistogram( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", diff --git a/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/PrometheusCollectorTest.java b/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/PrometheusCollectorTest.java index 0284555bdf9..101c19186b1 100644 --- a/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/PrometheusCollectorTest.java +++ b/exporters/prometheus/src/integrationTest/java/io/opentelemetry/exporter/prometheus/PrometheusCollectorTest.java @@ -79,7 +79,7 @@ private static ImmutableList generateTestData() { return ImmutableList.of( ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("grpc", "version", null), + InstrumentationScopeInfo.builder("grpc").setVersion("version").build(), "grpc.name", "long_description", "1", @@ -94,7 +94,7 @@ private static ImmutableList generateTestData() { 5)))), ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("http", "version", null), + InstrumentationScopeInfo.builder("http").setVersion("version").build(), "http.name", "double_description", "1", diff --git a/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerTest.java b/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerTest.java index 2d487aeda31..6cf4d2c3682 100644 --- a/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerTest.java +++ b/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerTest.java @@ -173,7 +173,7 @@ private static ImmutableList generateTestData() { return ImmutableList.of( ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("grpc", "version", null), + InstrumentationScopeInfo.builder("grpc").setVersion("version").build(), "grpc.name", "long_description", "1", @@ -185,7 +185,7 @@ private static ImmutableList generateTestData() { 123, 456, Attributes.of(stringKey("kp"), "vp"), 5)))), ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("http", "version", null), + InstrumentationScopeInfo.builder("http").setVersion("version").build(), "http.name", "double_description", "1", diff --git a/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/SerializerTest.java b/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/SerializerTest.java index 8fd29a27d5d..4c0b3d405a8 100644 --- a/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/SerializerTest.java +++ b/exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/SerializerTest.java @@ -43,7 +43,7 @@ class SerializerTest { private static final MetricData MONOTONIC_CUMULATIVE_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -59,7 +59,7 @@ class SerializerTest { private static final MetricData NON_MONOTONIC_CUMULATIVE_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "description", "1", @@ -75,7 +75,7 @@ class SerializerTest { private static final MetricData MONOTONIC_DELTA_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -91,7 +91,7 @@ class SerializerTest { private static final MetricData NON_MONOTONIC_DELTA_DOUBLE_SUM = ImmutableMetricData.createDoubleSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -107,7 +107,7 @@ class SerializerTest { private static final MetricData MONOTONIC_CUMULATIVE_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -123,7 +123,7 @@ class SerializerTest { private static final MetricData NON_MONOTONIC_CUMULATIVE_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -139,7 +139,7 @@ class SerializerTest { private static final MetricData MONOTONIC_DELTA_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -155,7 +155,7 @@ class SerializerTest { private static final MetricData NON_MONOTONIC_DELTA_LONG_SUM = ImmutableMetricData.createLongSum( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -172,7 +172,7 @@ class SerializerTest { private static final MetricData DOUBLE_GAUGE = ImmutableMetricData.createDoubleGauge( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -183,7 +183,7 @@ class SerializerTest { private static final MetricData LONG_GAUGE = ImmutableMetricData.createLongGauge( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -194,7 +194,7 @@ class SerializerTest { private static final MetricData SUMMARY = ImmutableMetricData.createDoubleSummary( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -212,7 +212,7 @@ class SerializerTest { private static final MetricData HISTOGRAM_NO_ATTRIBUTES = ImmutableMetricData.createDoubleHistogram( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -241,7 +241,7 @@ class SerializerTest { private static final MetricData HISTOGRAM_SINGLE_ATTRIBUTE = ImmutableMetricData.createDoubleHistogram( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -270,7 +270,7 @@ class SerializerTest { private static final MetricData DOUBLE_GAUGE_NO_ATTRIBUTES = ImmutableMetricData.createDoubleGauge( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", @@ -281,7 +281,7 @@ class SerializerTest { private static final MetricData DOUBLE_GAUGE_MULTIPLE_ATTRIBUTES = ImmutableMetricData.createDoubleGauge( Resource.create(Attributes.of(stringKey("kr"), "vr")), - InstrumentationScopeInfo.create("full", "version", null), + InstrumentationScopeInfo.builder("full").setVersion("version").build(), "instrument.name", "unused", "1", diff --git a/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/OtelToZipkinSpanTransformerTest.java b/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/OtelToZipkinSpanTransformerTest.java index 1966a755e12..b47b23e5d2d 100644 --- a/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/OtelToZipkinSpanTransformerTest.java +++ b/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/OtelToZipkinSpanTransformerTest.java @@ -205,7 +205,9 @@ void generateSpan_WithInstrumentationLibraryInfo() { SpanData data = spanBuilder() .setInstrumentationScopeInfo( - InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) + InstrumentationScopeInfo.builder("io.opentelemetry.auto") + .setVersion("1.0.0") + .build()) .setKind(SpanKind.CLIENT) .build(); diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/CounterTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/CounterTest.java index 839b85d2aed..2d2741313e2 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/CounterTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/CounterTest.java @@ -37,8 +37,7 @@ void testCounter() { metric -> assertThat(metric) .hasName("testCounter") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test counter") .hasUnit("items") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/DistributionSummaryTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/DistributionSummaryTest.java index a7c68e5504e..c0dee1047f2 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/DistributionSummaryTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/DistributionSummaryTest.java @@ -38,8 +38,7 @@ void testMicrometerDistributionSummary() { metric -> assertThat(metric) .hasName("testSummary") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test distribution summary") .hasUnit("things") .hasHistogramSatisfying( @@ -102,8 +101,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testSummary") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test distribution summary") .hasUnit("things") .hasHistogramSatisfying( @@ -175,8 +173,7 @@ void testMicrometerPercentiles() { metric -> assertThat(metric) .hasName("testSummary") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test distribution summary") .hasUnit("things") .hasHistogramSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionCounterTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionCounterTest.java index ec213a030c7..6e0b058925e 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionCounterTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionCounterTest.java @@ -40,8 +40,7 @@ void testFunctionCounter() { metric -> assertThat(metric) .hasName("testFunctionCounter") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function counter") .hasUnit("items") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerSecondsTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerSecondsTest.java index 2e42f8d4621..706015db9d3 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerSecondsTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerSecondsTest.java @@ -57,8 +57,7 @@ void testFunctionTimerWithBaseUnitSeconds() { metric -> assertThat(metric) .hasName("testFunctionTimerSeconds.count") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function timer") .hasUnit("1") .hasLongSumSatisfying( @@ -72,8 +71,7 @@ void testFunctionTimerWithBaseUnitSeconds() { metric -> assertThat(metric) .hasName("testFunctionTimerSeconds.sum") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function timer") .hasUnit("s") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerTest.java index 9446f5feb84..e8cb6448fc9 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/FunctionTimerTest.java @@ -52,8 +52,7 @@ void testFunctionTimer() throws InterruptedException { metric -> assertThat(metric) .hasName("testFunctionTimer.count") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function timer") .hasUnit("1") .hasLongSumSatisfying( @@ -67,8 +66,7 @@ void testFunctionTimer() throws InterruptedException { metric -> assertThat(metric) .hasName("testFunctionTimer.sum") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function timer") .hasUnit("ms") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/GaugeTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/GaugeTest.java index b0fd7717d19..0b1afca3756 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/GaugeTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/GaugeTest.java @@ -38,8 +38,7 @@ void testGauge() { metric -> assertThat(metric) .hasName("testGauge") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test gauge") .hasUnit("items") .hasDoubleGaugeSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerHistogramTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerHistogramTest.java index 1bf52e31ded..577a55fa7bc 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerHistogramTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerHistogramTest.java @@ -54,8 +54,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testLongTaskTimerHistogram.active") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("tasks") .hasLongSumSatisfying( @@ -66,8 +65,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testLongTaskTimerHistogram.duration") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("ms") .hasDoubleSumSatisfying( @@ -84,8 +82,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testLongTaskTimerHistogram.histogram") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDoubleGaugeSatisfying( gauge -> gauge.hasPointsSatisfying( @@ -106,8 +103,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testLongTaskTimerHistogram.active") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("tasks") .hasLongSumSatisfying( @@ -118,8 +114,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testLongTaskTimerHistogram.duration") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("ms") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerSecondsTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerSecondsTest.java index 714bfa03e43..fed7dbd5b6a 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerSecondsTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerSecondsTest.java @@ -47,8 +47,7 @@ void testLongTaskTimerWithBaseUnitSeconds() throws InterruptedException { metric -> assertThat(metric) .hasName("testLongTaskTimerSeconds.active") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test long task timer") .hasUnit("tasks") .hasLongSumSatisfying( @@ -62,8 +61,7 @@ void testLongTaskTimerWithBaseUnitSeconds() throws InterruptedException { metric -> assertThat(metric) .hasName("testLongTaskTimerSeconds.duration") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test long task timer") .hasUnit("s") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerTest.java index 3ee22ed80da..15a0aed8272 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/LongTaskTimerTest.java @@ -36,8 +36,7 @@ void testLongTaskTimer() throws InterruptedException { metric -> assertThat(metric) .hasName("testLongTaskTimer.active") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test long task timer") .hasUnit("tasks") .hasLongSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/MeterTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/MeterTest.java index 00432c9682b..342e4cb6de7 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/MeterTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/MeterTest.java @@ -52,8 +52,7 @@ void testMeter() { metric -> assertThat(metric) .hasName("testMeter.total") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test meter") .hasUnit("things") .hasDoubleSumSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/NamingConventionTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/NamingConventionTest.java index 5a48139fa0f..9c82e257909 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/NamingConventionTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/NamingConventionTest.java @@ -67,8 +67,7 @@ void renameCounter() { metric -> assertThat(metric) .hasName("test.renamedCounter") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDoubleSumSatisfying( sum -> sum.hasPointsSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/PrometheusModeTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/PrometheusModeTest.java index b2765a87832..77cc55ad45e 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/PrometheusModeTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/PrometheusModeTest.java @@ -62,8 +62,7 @@ void testCounter() { metric -> assertThat(metric) .hasName("testPrometheusCounter.items") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test counter") .hasUnit("items") .hasDoubleSumSatisfying( @@ -96,8 +95,7 @@ void testDistributionSummary() { metric -> assertThat(metric) .hasName("testPrometheusSummary.items") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test summary") .hasUnit("items") .hasHistogramSatisfying( @@ -111,8 +109,7 @@ void testDistributionSummary() { metric -> assertThat(metric) .hasName("testPrometheusSummary.items.max") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test summary") .hasUnit("items") .hasDoubleGaugeSatisfying( @@ -146,8 +143,7 @@ void testFunctionTimer() { metric -> assertThat(metric) .hasName("testPrometheusFunctionTimer.seconds.count") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function timer") .hasUnit("1") .hasLongSumSatisfying( @@ -161,8 +157,7 @@ void testFunctionTimer() { metric -> assertThat(metric) .hasName("testPrometheusFunctionTimer.seconds.sum") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test function timer") .hasUnit("s") .hasDoubleSumSatisfying( @@ -189,8 +184,7 @@ void testGauge() { metric -> assertThat(metric) .hasName("testPrometheusGauge.items") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test gauge") .hasUnit("items") .hasDoubleGaugeSatisfying( @@ -220,8 +214,7 @@ void testLongTaskTimer() throws InterruptedException { metric -> assertThat(metric) .hasName("testPrometheusLongTaskTimer.seconds.active") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test long task timer") .hasUnit("tasks") .hasLongSumSatisfying( @@ -235,8 +228,7 @@ void testLongTaskTimer() throws InterruptedException { metric -> assertThat(metric) .hasName("testPrometheusLongTaskTimer.seconds.duration") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test long task timer") .hasUnit("s") .hasDoubleSumSatisfying( @@ -300,8 +292,7 @@ void testTimer() { metric -> assertThat(metric) .hasName("testPrometheusTimer.seconds") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("s") .hasHistogramSatisfying( @@ -315,8 +306,7 @@ void testTimer() { metric -> assertThat(metric) .hasName("testPrometheusTimer.seconds.max") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("s") .hasDoubleGaugeSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerSecondsTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerSecondsTest.java index d8bd0a49dd4..a98381608b8 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerSecondsTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerSecondsTest.java @@ -47,8 +47,7 @@ void testTimerWithBaseUnitSeconds() { metric -> assertThat(metric) .hasName("testTimerSeconds") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("s") .hasHistogramSatisfying( @@ -80,8 +79,7 @@ void testTimerWithBaseUnitSeconds() { metric -> assertThat(metric) .hasName("testTimerSeconds") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("s") .hasHistogramSatisfying( diff --git a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerTest.java b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerTest.java index 0b49c22ff57..221fb866771 100644 --- a/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerTest.java +++ b/micrometer1-shim/src/test/java/io/opentelemetry/micrometer1shim/TimerTest.java @@ -39,8 +39,7 @@ void testTimer() { metric -> assertThat(metric) .hasName("testTimer") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("ms") .hasHistogramSatisfying( @@ -137,8 +136,7 @@ void testMicrometerHistogram() { metric -> assertThat(metric) .hasName("testTimer") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("ms") .hasHistogramSatisfying( @@ -210,8 +208,7 @@ void testMicrometerPercentiles() { metric -> assertThat(metric) .hasName("testTimer") - .hasInstrumentationScope( - InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null)) + .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME)) .hasDescription("This is a test timer") .hasUnit("ms") .hasHistogramSatisfying( diff --git a/sdk/common/src/main/java/io/opentelemetry/sdk/common/InstrumentationScopeInfo.java b/sdk/common/src/main/java/io/opentelemetry/sdk/common/InstrumentationScopeInfo.java index 5028ea6f433..0aab48f47e2 100644 --- a/sdk/common/src/main/java/io/opentelemetry/sdk/common/InstrumentationScopeInfo.java +++ b/sdk/common/src/main/java/io/opentelemetry/sdk/common/InstrumentationScopeInfo.java @@ -30,7 +30,12 @@ public static InstrumentationScopeInfo create(String name) { return InstrumentationScopeInfo.create(name, null, null, Attributes.empty()); } - /** Creates a new instance of {@link InstrumentationScopeInfo}. */ + /** + * Creates a new instance of {@link InstrumentationScopeInfo}. + * + * @deprecated Use {@link #builder(String)} or {@link #create(String)}. + */ + @Deprecated public static InstrumentationScopeInfo create( String name, @Nullable String version, @Nullable String schemaUrl) { return InstrumentationScopeInfo.create(name, version, schemaUrl, Attributes.empty()); diff --git a/sdk/common/src/main/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtil.java b/sdk/common/src/main/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtil.java index 299a6f7d778..0d20273bb8c 100644 --- a/sdk/common/src/main/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtil.java +++ b/sdk/common/src/main/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtil.java @@ -6,6 +6,7 @@ package io.opentelemetry.sdk.internal; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at @@ -27,10 +28,15 @@ public static io.opentelemetry.sdk.common.InstrumentationLibraryInfo toInstrumen @SuppressWarnings("deprecation") // Utility method for compatibility public static InstrumentationScopeInfo toInstrumentationScopeInfo( io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) { - return InstrumentationScopeInfo.create( - instrumentationLibraryInfo.getName(), - instrumentationLibraryInfo.getVersion(), - instrumentationLibraryInfo.getSchemaUrl()); + InstrumentationScopeInfoBuilder builder = + InstrumentationScopeInfo.builder(instrumentationLibraryInfo.getName()); + if (instrumentationLibraryInfo.getVersion() != null) { + builder.setVersion(instrumentationLibraryInfo.getVersion()); + } + if (instrumentationLibraryInfo.getSchemaUrl() != null) { + builder.setSchemaUrl(instrumentationLibraryInfo.getSchemaUrl()); + } + return builder.build(); } private InstrumentationScopeUtil() {} diff --git a/sdk/common/src/test/java/io/opentelemetry/sdk/common/InstrumentationScopeInfoTest.java b/sdk/common/src/test/java/io/opentelemetry/sdk/common/InstrumentationScopeInfoTest.java index c31def8c2aa..d5093d2f3bf 100644 --- a/sdk/common/src/test/java/io/opentelemetry/sdk/common/InstrumentationScopeInfoTest.java +++ b/sdk/common/src/test/java/io/opentelemetry/sdk/common/InstrumentationScopeInfoTest.java @@ -6,7 +6,6 @@ package io.opentelemetry.sdk.common; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import io.opentelemetry.api.common.Attributes; @@ -23,18 +22,35 @@ void create_InvalidArguments() { @Test void create_Valid() { - assertThatCode(() -> InstrumentationScopeInfo.builder("name").build()) - .doesNotThrowAnyException(); - assertThatCode(() -> InstrumentationScopeInfo.builder("name").setVersion(null).build()) - .doesNotThrowAnyException(); - assertThatCode(() -> InstrumentationScopeInfo.builder("name").setSchemaUrl(null).build()) - .doesNotThrowAnyException(); - assertThatCode( - () -> - InstrumentationScopeInfo.builder("name") - .setAttributes(Attributes.builder().put("key", "value").build()) - .build()) - .doesNotThrowAnyException(); + InstrumentationScopeInfo scope = InstrumentationScopeInfo.builder("name").build(); + assertThat(scope.getName()).isEqualTo("name"); + assertThat(scope.getVersion()).isNull(); + assertThat(scope.getSchemaUrl()).isNull(); + assertThat(scope.getAttributes()).isEqualTo(Attributes.empty()); + + scope = + InstrumentationScopeInfo.builder("name") + .setVersion("version") + .setSchemaUrl("schemaUrl") + .setAttributes(Attributes.builder().put("key", "value").build()) + .build(); + assertThat(scope.getName()).isEqualTo("name"); + assertThat(scope.getVersion()).isEqualTo("version"); + assertThat(scope.getSchemaUrl()).isEqualTo("schemaUrl"); + assertThat(scope.getAttributes()).isEqualTo(Attributes.builder().put("key", "value").build()); + } + + @Test + @SuppressWarnings("deprecation") // Testing deprecated code + void create_AllArgs() { + assertThat(InstrumentationScopeInfo.create("name", "version", "schemaUrl")) + .isEqualTo( + InstrumentationScopeInfo.builder("name") + .setVersion("version") + .setSchemaUrl("schemaUrl") + .build()); + assertThat(InstrumentationScopeInfo.create("name", null, null)) + .isEqualTo(InstrumentationScopeInfo.builder("name").build()); } @Test diff --git a/sdk/common/src/test/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtilTest.java b/sdk/common/src/test/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtilTest.java new file mode 100644 index 00000000000..27f2b28e997 --- /dev/null +++ b/sdk/common/src/test/java/io/opentelemetry/sdk/internal/InstrumentationScopeUtilTest.java @@ -0,0 +1,52 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.sdk.internal; + +import static org.assertj.core.api.Assertions.assertThat; + +import io.opentelemetry.api.common.Attributes; +import io.opentelemetry.sdk.common.InstrumentationScopeInfo; +import org.junit.jupiter.api.Test; + +@SuppressWarnings("deprecation") // Testing deprecated code +class InstrumentationScopeUtilTest { + + @Test + void toInstrumentationLibraryInfo() { + assertThat( + InstrumentationScopeUtil.toInstrumentationLibraryInfo( + InstrumentationScopeInfo.builder("name").build())) + .isEqualTo( + io.opentelemetry.sdk.common.InstrumentationLibraryInfo.create("name", null, null)); + assertThat( + InstrumentationScopeUtil.toInstrumentationLibraryInfo( + InstrumentationScopeInfo.builder("name") + .setVersion("version") + .setSchemaUrl("schemaUrl") + .setAttributes(Attributes.builder().put("key", "value").build()) + .build())) + .isEqualTo( + io.opentelemetry.sdk.common.InstrumentationLibraryInfo.create( + "name", "version", "schemaUrl")); + } + + @Test + void toInstrumentationScopeInfo() { + assertThat( + InstrumentationScopeUtil.toInstrumentationScopeInfo( + io.opentelemetry.sdk.common.InstrumentationLibraryInfo.create("name", null, null))) + .isEqualTo(InstrumentationScopeInfo.builder("name").build()); + assertThat( + InstrumentationScopeUtil.toInstrumentationScopeInfo( + io.opentelemetry.sdk.common.InstrumentationLibraryInfo.create( + "name", "version", "schemaUrl"))) + .isEqualTo( + InstrumentationScopeInfo.builder("name") + .setVersion("version") + .setSchemaUrl("schemaUrl") + .build()); + } +} diff --git a/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkLogEmitterProviderTest.java b/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkLogEmitterProviderTest.java index c379d12b236..b8191b02686 100644 --- a/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkLogEmitterProviderTest.java +++ b/sdk/logs/src/test/java/io/opentelemetry/sdk/logs/SdkLogEmitterProviderTest.java @@ -185,7 +185,10 @@ void logEmitterBuilder_SameNameVersionAndSchema() { @Test void logEmitterBuilder_PropagatesToEmitter() { InstrumentationScopeInfo expected = - InstrumentationScopeInfo.create("test", "version", "http://url"); + InstrumentationScopeInfo.builder("test") + .setVersion("version") + .setSchemaUrl("http://url") + .build(); assertThat( ((SdkLogEmitter) sdkLogEmitterProvider diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java index f9e76215f34..f4dfd95fe39 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/IdentityTest.java @@ -173,7 +173,7 @@ void differentMeterSameInstrumentNoViews() { metricData -> assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", "version1", null)) + InstrumentationScopeInfo.builder("meter1").setVersion("version1").build()) .hasName("counter1") .hasLongSumSatisfying( sum -> sum.hasPointsSatisfying(point -> point.hasValue(10)))); @@ -199,14 +199,17 @@ void differentMeterSameInstrumentNoViews() { metricData -> assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", "version1", null)) + InstrumentationScopeInfo.builder("meter1").setVersion("version1").build()) .hasName("counter1") .hasLongSumSatisfying( sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))), metricData -> assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", "version1", "schema1")) + InstrumentationScopeInfo.builder("meter1") + .setVersion("version1") + .setSchemaUrl("schema1") + .build()) .hasName("counter1") .hasLongSumSatisfying( sum -> sum.hasPointsSatisfying(point -> point.hasValue(10)))); @@ -566,7 +569,7 @@ void differentMeterSameInstrumentViewSelectingMeterVersion() { metricData -> assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", "version1", null)) + InstrumentationScopeInfo.builder("meter1").setVersion("version1").build()) .hasName("counter1") .hasDescription("description1") .hasLongSumSatisfying( @@ -574,7 +577,7 @@ void differentMeterSameInstrumentViewSelectingMeterVersion() { metricData -> { assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", "version2", null)) + InstrumentationScopeInfo.builder("meter1").setVersion("version2").build()) .hasName("counter1") .hasLongSumSatisfying( sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))); @@ -613,7 +616,7 @@ void differentMeterSameInstrumentViewSelectingMeterSchema() { metricData -> assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", null, "schema1")) + InstrumentationScopeInfo.builder("meter1").setSchemaUrl("schema1").build()) .hasName("counter1") .hasDescription("description1") .hasLongSumSatisfying( @@ -621,7 +624,7 @@ void differentMeterSameInstrumentViewSelectingMeterSchema() { metricData -> { assertThat(metricData) .hasInstrumentationScope( - InstrumentationScopeInfo.create("meter1", null, "schema2")) + InstrumentationScopeInfo.builder("meter1").setSchemaUrl("schema2").build()) .hasName("counter1") .hasLongSumSatisfying( sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))); diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkMeterRegistryTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkMeterRegistryTest.java index 1edc76dca1d..49a92aa3a3b 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkMeterRegistryTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/SdkMeterRegistryTest.java @@ -91,7 +91,10 @@ void getSameInstanceForSameName_WithVersionAndSchema() { @Test void propagatesInstrumentationScopeInfoToMeter() { InstrumentationScopeInfo expected = - InstrumentationScopeInfo.create("theName", "theVersion", "http://theschema"); + InstrumentationScopeInfo.builder("theName") + .setVersion("theVersion") + .setSchemaUrl("http://theschema") + .build(); SdkMeter meter = (SdkMeter) meterProvider diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/state/SynchronousMetricStorageTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/state/SynchronousMetricStorageTest.java index c1cc856b71b..7f4a0d68ece 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/state/SynchronousMetricStorageTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/state/SynchronousMetricStorageTest.java @@ -39,7 +39,7 @@ public class SynchronousMetricStorageTest { private static final Resource RESOURCE = Resource.empty(); private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = - InstrumentationScopeInfo.create("test", "1.0", null); + InstrumentationScopeInfo.builder("test").setVersion("1.0").build(); private static final InstrumentDescriptor DESCRIPTOR = InstrumentDescriptor.create( "name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.DOUBLE); diff --git a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/view/ViewRegistryTest.java b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/view/ViewRegistryTest.java index 6ea6790cadf..7ea64cf2793 100644 --- a/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/view/ViewRegistryTest.java +++ b/sdk/metrics/src/test/java/io/opentelemetry/sdk/metrics/internal/view/ViewRegistryTest.java @@ -30,7 +30,10 @@ class ViewRegistryTest { @RegisterExtension LogCapturer logs = LogCapturer.create().captureForType(ViewRegistry.class); private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = - InstrumentationScopeInfo.create("name", "version", "schema_url"); + InstrumentationScopeInfo.builder("name") + .setVersion("version") + .setSchemaUrl("schema_url") + .build(); private static RegisteredView registeredView(InstrumentSelector instrumentSelector, View view) { return RegisteredView.create( diff --git a/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java b/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java index 2fc0602b986..b2b68f38539 100644 --- a/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java +++ b/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/MetricAssertionsTest.java @@ -53,7 +53,7 @@ class MetricAssertionsTest { private static final Resource RESOURCE = Resource.create(Attributes.builder().put("dog", "bark").build()); private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = - InstrumentationScopeInfo.create("opentelemetry", "1.0", null); + InstrumentationScopeInfo.builder("opentelemetry").setVersion("1.0").build(); private static final AttributeKey BEAR = AttributeKey.stringKey("bear"); private static final AttributeKey CAT = AttributeKey.stringKey("cat"); diff --git a/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/TraceAssertionsTest.java b/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/TraceAssertionsTest.java index 118fdfffd3e..9c87b5df118 100644 --- a/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/TraceAssertionsTest.java +++ b/sdk/testing/src/test/java/io/opentelemetry/sdk/testing/assertj/TraceAssertionsTest.java @@ -46,7 +46,7 @@ class TraceAssertionsTest { private static final Resource RESOURCE = Resource.create(Attributes.builder().put("dog", "bark").build()); private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = - InstrumentationScopeInfo.create("opentelemetry", "1.0", null); + InstrumentationScopeInfo.builder("opentelemetry").setVersion("1.0").build(); private static final AttributeKey BEAR = AttributeKey.stringKey("bear"); private static final AttributeKey CAT = AttributeKey.stringKey("cat"); diff --git a/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerProviderTest.java b/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerProviderTest.java index 95ffa8a6c6e..c3386379e2d 100644 --- a/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerProviderTest.java +++ b/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerProviderTest.java @@ -171,7 +171,10 @@ void getSameInstanceForSameName_WithVersionAndSchema() { @Test void propagatesInstrumentationScopeInfoToTracer() { InstrumentationScopeInfo expected = - InstrumentationScopeInfo.create("theName", "theVersion", "http://url"); + InstrumentationScopeInfo.builder("theName") + .setVersion("theVersion") + .setSchemaUrl("http://url") + .build(); Tracer tracer = tracerFactory .tracerBuilder(expected.getName()) diff --git a/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerTest.java b/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerTest.java index eafe5ca517b..c17c121a36e 100644 --- a/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerTest.java +++ b/sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkTracerTest.java @@ -27,8 +27,10 @@ class SdkTracerTest { "io.opentelemetry.sdk.trace.TracerSdkTest"; private static final String INSTRUMENTATION_SCOPE_VERSION = "0.2.0"; private static final InstrumentationScopeInfo instrumentationScopeInfo = - InstrumentationScopeInfo.create( - INSTRUMENTATION_SCOPE_NAME, INSTRUMENTATION_SCOPE_VERSION, "http://schemaurl"); + InstrumentationScopeInfo.builder(INSTRUMENTATION_SCOPE_NAME) + .setVersion(INSTRUMENTATION_SCOPE_VERSION) + .setSchemaUrl("http://schemaurl") + .build(); private final SdkTracer tracer = (SdkTracer) SdkTracerProvider.builder() @@ -51,12 +53,7 @@ void getInstrumentationScopeInfo() { @Test void propagatesInstrumentationScopeInfoToSpan() { ReadableSpan readableSpan = (ReadableSpan) tracer.spanBuilder("spanName").startSpan(); - assertThat(readableSpan.getInstrumentationScopeInfo()) - .isEqualTo( - InstrumentationScopeInfo.create( - instrumentationScopeInfo.getName(), - instrumentationScopeInfo.getVersion(), - instrumentationScopeInfo.getSchemaUrl())); + assertThat(readableSpan.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo); } @Test