Deprecate multi argument InstrumentationScopeInfo create method (#4710)

* Deprecate multi argument InstrumentationScopeInfo create method

* PR feedback
This commit is contained in:
jack-berg 2022-08-24 13:35:31 -05:00 committed by GitHub
parent 8445642052
commit 2bc88f45c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 262 additions and 166 deletions

View File

@ -2,6 +2,8 @@ Comparing source compatibility of against
**** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.common.InstrumentationScopeInfo (not serializable) **** MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.common.InstrumentationScopeInfo (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0 === CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder builder(java.lang.String) +++ 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 METHOD: PUBLIC(+) ABSTRACT(+) io.opentelemetry.api.common.Attributes getAttributes()
+++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder (not serializable) +++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.sdk.common.InstrumentationScopeInfoBuilder (not serializable)
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a. +++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.

View File

@ -83,7 +83,9 @@ class JaegerThriftSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setResource( .setResource(
Resource.create( Resource.create(
Attributes.of( Attributes.of(
@ -158,7 +160,9 @@ class JaegerThriftSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setResource( .setResource(
Resource.create( Resource.create(
Attributes.of( Attributes.of(
@ -181,7 +185,9 @@ class JaegerThriftSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setResource( .setResource(
Resource.create( Resource.create(
Attributes.of( Attributes.of(

View File

@ -126,7 +126,9 @@ class JaegerGrpcSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setResource( .setResource(
Resource.create( Resource.create(
Attributes.of( Attributes.of(
@ -177,7 +179,9 @@ class JaegerGrpcSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setResource( .setResource(
Resource.create( Resource.create(
Attributes.of( Attributes.of(
@ -202,7 +206,9 @@ class JaegerGrpcSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setResource( .setResource(
Resource.create( Resource.create(
Attributes.of( Attributes.of(

View File

@ -61,7 +61,7 @@ class OtlpJsonLoggingLogExporterTest {
TestLogData.builder() TestLogData.builder()
.setResource(RESOURCE) .setResource(RESOURCE)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("instrumentation2", "2", null)) InstrumentationScopeInfo.builder("instrumentation2").setVersion("2").build())
.setBody("body2") .setBody("body2")
.setSeverity(Severity.INFO) .setSeverity(Severity.INFO)
.setSeverityText("INFO") .setSeverityText("INFO")

View File

@ -53,7 +53,7 @@ class OtlpJsonLoggingMetricExporterTest {
private static final MetricData METRIC2 = private static final MetricData METRIC2 =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
RESOURCE, RESOURCE,
InstrumentationScopeInfo.create("instrumentation2", "2", null), InstrumentationScopeInfo.builder("instrumentation2").setVersion("2").build(),
"metric2", "metric2",
"metric2 description", "metric2 description",
"s", "s",

View File

@ -86,7 +86,7 @@ class OtlpJsonLoggingSpanExporterTest {
.setKind(SpanKind.CLIENT) .setKind(SpanKind.CLIENT)
.setResource(RESOURCE) .setResource(RESOURCE)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("instrumentation2", "2", null)) InstrumentationScopeInfo.builder("instrumentation2").setVersion("2").build())
.build(); .build();
@RegisterExtension @RegisterExtension

View File

@ -63,7 +63,7 @@ class LoggingMetricExporterTest {
long nowEpochNanos = System.currentTimeMillis() * 1000 * 1000; long nowEpochNanos = System.currentTimeMillis() * 1000 * 1000;
Resource resource = Resource.create(Attributes.of(stringKey("host"), "localhost")); Resource resource = Resource.create(Attributes.of(stringKey("host"), "localhost"));
InstrumentationScopeInfo instrumentationScopeInfo = InstrumentationScopeInfo instrumentationScopeInfo =
InstrumentationScopeInfo.create("manualInstrumentation", "1.0", null); InstrumentationScopeInfo.builder("manualInstrumentation").setVersion("1.0").build();
exporter.export( exporter.export(
Arrays.asList( Arrays.asList(
ImmutableMetricData.createDoubleSummary( ImmutableMetricData.createDoubleSummary(

View File

@ -82,7 +82,8 @@ class LoggingSpanExporterTest {
.setStatus(StatusData.error()) .setStatus(StatusData.error())
.setName("testSpan2") .setName("testSpan2")
.setKind(SpanKind.CLIENT) .setKind(SpanKind.CLIENT)
.setInstrumentationScopeInfo(InstrumentationScopeInfo.create("tracer2", "1.0", null)) .setInstrumentationScopeInfo(
InstrumentationScopeInfo.builder("tracer2").setVersion("1.0").build())
.build(); .build();
@RegisterExtension @RegisterExtension

View File

@ -53,7 +53,8 @@ class SystemOutLogExporterTest {
private static LogData sampleLog(long timestamp) { private static LogData sampleLog(long timestamp) {
return TestLogData.builder() return TestLogData.builder()
.setResource(Resource.empty()) .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)) .setAttributes(Attributes.of(stringKey("cheese"), "cheddar", longKey("amount"), 1L))
.setBody("message") .setBody("message")
.setSeverity(Severity.ERROR3) .setSeverity(Severity.ERROR3)

View File

@ -347,7 +347,10 @@ class OtlpHttpSpanExporterTest {
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) InstrumentationScopeInfo.builder("testLib")
.setVersion("1.0")
.setSchemaUrl("http://url")
.build())
.build(); .build();
} }
} }

View File

@ -78,7 +78,10 @@ class OtlpGrpcSpanExporterTest extends AbstractGrpcTelemetryExporterTest<SpanDat
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) InstrumentationScopeInfo.builder("testLib")
.setVersion("1.0")
.setSchemaUrl("http://url")
.build())
.build(); .build();
} }

View File

@ -86,7 +86,10 @@ class OtlpGrpcNettySpanExporterTest
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) InstrumentationScopeInfo.builder("testLib")
.setVersion("1.0")
.setSchemaUrl("http://url")
.build())
.build(); .build();
} }

View File

@ -74,7 +74,10 @@ class OtlpGrpcNettyShadedSpanExporterTest
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) InstrumentationScopeInfo.builder("testLib")
.setVersion("1.0")
.setSchemaUrl("http://url")
.build())
.build(); .build();
} }

View File

@ -74,7 +74,10 @@ class OtlpGrpcOkHttpSpanExporterTest
.setTotalRecordedLinks(0) .setTotalRecordedLinks(0)
.setTotalRecordedEvents(0) .setTotalRecordedEvents(0)
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) InstrumentationScopeInfo.builder("testLib")
.setVersion("1.0")
.setSchemaUrl("http://url")
.build())
.build(); .build();
} }

View File

@ -103,7 +103,7 @@ class LogsRequestMarshalerTest {
.setResource( .setResource(
Resource.create(Attributes.builder().put("testKey", "testValue").build())) Resource.create(Attributes.builder().put("testKey", "testValue").build()))
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("instrumentation", "1", null)) InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build())
.setBody(BODY) .setBody(BODY)
.setSeverity(Severity.INFO) .setSeverity(Severity.INFO)
.setSeverityText("INFO") .setSeverityText("INFO")
@ -137,7 +137,7 @@ class LogsRequestMarshalerTest {
.setResource( .setResource(
Resource.create(Attributes.builder().put("testKey", "testValue").build())) Resource.create(Attributes.builder().put("testKey", "testValue").build()))
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("instrumentation", "1", null)) InstrumentationScopeInfo.builder("instrumentation").setVersion("1").build())
.setEpoch(12345, TimeUnit.NANOSECONDS) .setEpoch(12345, TimeUnit.NANOSECONDS)
.build())); .build()));

View File

@ -342,7 +342,10 @@ class OtlpHttpLogExporterTest {
return TestLogData.builder() return TestLogData.builder()
.setResource(Resource.getDefault()) .setResource(Resource.getDefault())
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("testLib", "1.0", "http://url")) InstrumentationScopeInfo.builder("testLib")
.setVersion("1.0")
.setSchemaUrl("http://url")
.build())
.setBody("log body") .setBody("log body")
.setAttributes(Attributes.builder().put("key", "value").build()) .setAttributes(Attributes.builder().put("key", "value").build())
.setSeverity(Severity.INFO) .setSeverity(Severity.INFO)

View File

@ -58,7 +58,8 @@ class OtlpGrpcLogExporterTest extends AbstractGrpcTelemetryExporterTest<LogData,
protected LogData generateFakeTelemetry() { protected LogData generateFakeTelemetry() {
return TestLogData.builder() return TestLogData.builder()
.setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) .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()) .setEpoch(Instant.now())
.setSeverity(Severity.ERROR) .setSeverity(Severity.ERROR)
.setSeverityText("really severe") .setSeverityText("really severe")

View File

@ -66,7 +66,8 @@ class OtlpGrpcNettyLogExporterTest
protected LogData generateFakeTelemetry() { protected LogData generateFakeTelemetry() {
return TestLogData.builder() return TestLogData.builder()
.setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) .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()) .setEpoch(Instant.now())
.setSeverity(Severity.ERROR) .setSeverity(Severity.ERROR)
.setSeverityText("really severe") .setSeverityText("really severe")

View File

@ -54,7 +54,8 @@ class OtlpGrpcNettyShadedLogExporterTest
protected LogData generateFakeTelemetry() { protected LogData generateFakeTelemetry() {
return TestLogData.builder() return TestLogData.builder()
.setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) .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()) .setEpoch(Instant.now())
.setSeverity(Severity.ERROR) .setSeverity(Severity.ERROR)
.setSeverityText("really severe") .setSeverityText("really severe")

View File

@ -54,7 +54,8 @@ class OtlpGrpcNettyOkHttpLogExporterTest
protected LogData generateFakeTelemetry() { protected LogData generateFakeTelemetry() {
return TestLogData.builder() return TestLogData.builder()
.setResource(Resource.create(Attributes.builder().put("testKey", "testValue").build())) .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()) .setEpoch(Instant.now())
.setSeverity(Severity.ERROR) .setSeverity(Severity.ERROR)
.setSeverityText("really severe") .setSeverityText("really severe")

View File

@ -52,7 +52,7 @@ class MetricAdapterTest {
private static final MetricData MONOTONIC_CUMULATIVE_DOUBLE_SUM = private static final MetricData MONOTONIC_CUMULATIVE_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -65,7 +65,7 @@ class MetricAdapterTest {
private static final MetricData NON_MONOTONIC_CUMULATIVE_DOUBLE_SUM = private static final MetricData NON_MONOTONIC_CUMULATIVE_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -78,7 +78,7 @@ class MetricAdapterTest {
private static final MetricData MONOTONIC_DELTA_DOUBLE_SUM = private static final MetricData MONOTONIC_DELTA_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -91,7 +91,7 @@ class MetricAdapterTest {
private static final MetricData NON_MONOTONIC_DELTA_DOUBLE_SUM = private static final MetricData NON_MONOTONIC_DELTA_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -104,7 +104,7 @@ class MetricAdapterTest {
private static final MetricData MONOTONIC_CUMULATIVE_LONG_SUM = private static final MetricData MONOTONIC_CUMULATIVE_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -117,7 +117,7 @@ class MetricAdapterTest {
private static final MetricData NON_MONOTONIC_CUMULATIVE_LONG_SUM = private static final MetricData NON_MONOTONIC_CUMULATIVE_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -130,7 +130,7 @@ class MetricAdapterTest {
private static final MetricData MONOTONIC_DELTA_LONG_SUM = private static final MetricData MONOTONIC_DELTA_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -143,7 +143,7 @@ class MetricAdapterTest {
private static final MetricData NON_MONOTONIC_DELTA_LONG_SUM = private static final MetricData NON_MONOTONIC_DELTA_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -157,7 +157,7 @@ class MetricAdapterTest {
private static final MetricData DOUBLE_GAUGE = private static final MetricData DOUBLE_GAUGE =
ImmutableMetricData.createDoubleGauge( ImmutableMetricData.createDoubleGauge(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -168,7 +168,7 @@ class MetricAdapterTest {
private static final MetricData LONG_GAUGE = private static final MetricData LONG_GAUGE =
ImmutableMetricData.createLongGauge( ImmutableMetricData.createLongGauge(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -179,7 +179,7 @@ class MetricAdapterTest {
private static final MetricData SUMMARY = private static final MetricData SUMMARY =
ImmutableMetricData.createDoubleSummary( ImmutableMetricData.createDoubleSummary(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -197,7 +197,7 @@ class MetricAdapterTest {
private static final MetricData HISTOGRAM = private static final MetricData HISTOGRAM =
ImmutableMetricData.createDoubleHistogram( ImmutableMetricData.createDoubleHistogram(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",

View File

@ -79,7 +79,7 @@ class PrometheusCollectorTest {
return ImmutableList.of( return ImmutableList.of(
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("grpc", "version", null), InstrumentationScopeInfo.builder("grpc").setVersion("version").build(),
"grpc.name", "grpc.name",
"long_description", "long_description",
"1", "1",
@ -94,7 +94,7 @@ class PrometheusCollectorTest {
5)))), 5)))),
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("http", "version", null), InstrumentationScopeInfo.builder("http").setVersion("version").build(),
"http.name", "http.name",
"double_description", "double_description",
"1", "1",

View File

@ -173,7 +173,7 @@ class PrometheusHttpServerTest {
return ImmutableList.of( return ImmutableList.of(
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("grpc", "version", null), InstrumentationScopeInfo.builder("grpc").setVersion("version").build(),
"grpc.name", "grpc.name",
"long_description", "long_description",
"1", "1",
@ -185,7 +185,7 @@ class PrometheusHttpServerTest {
123, 456, Attributes.of(stringKey("kp"), "vp"), 5)))), 123, 456, Attributes.of(stringKey("kp"), "vp"), 5)))),
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("http", "version", null), InstrumentationScopeInfo.builder("http").setVersion("version").build(),
"http.name", "http.name",
"double_description", "double_description",
"1", "1",

View File

@ -43,7 +43,7 @@ class SerializerTest {
private static final MetricData MONOTONIC_CUMULATIVE_DOUBLE_SUM = private static final MetricData MONOTONIC_CUMULATIVE_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -59,7 +59,7 @@ class SerializerTest {
private static final MetricData NON_MONOTONIC_CUMULATIVE_DOUBLE_SUM = private static final MetricData NON_MONOTONIC_CUMULATIVE_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"description", "description",
"1", "1",
@ -75,7 +75,7 @@ class SerializerTest {
private static final MetricData MONOTONIC_DELTA_DOUBLE_SUM = private static final MetricData MONOTONIC_DELTA_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -91,7 +91,7 @@ class SerializerTest {
private static final MetricData NON_MONOTONIC_DELTA_DOUBLE_SUM = private static final MetricData NON_MONOTONIC_DELTA_DOUBLE_SUM =
ImmutableMetricData.createDoubleSum( ImmutableMetricData.createDoubleSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -107,7 +107,7 @@ class SerializerTest {
private static final MetricData MONOTONIC_CUMULATIVE_LONG_SUM = private static final MetricData MONOTONIC_CUMULATIVE_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -123,7 +123,7 @@ class SerializerTest {
private static final MetricData NON_MONOTONIC_CUMULATIVE_LONG_SUM = private static final MetricData NON_MONOTONIC_CUMULATIVE_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -139,7 +139,7 @@ class SerializerTest {
private static final MetricData MONOTONIC_DELTA_LONG_SUM = private static final MetricData MONOTONIC_DELTA_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -155,7 +155,7 @@ class SerializerTest {
private static final MetricData NON_MONOTONIC_DELTA_LONG_SUM = private static final MetricData NON_MONOTONIC_DELTA_LONG_SUM =
ImmutableMetricData.createLongSum( ImmutableMetricData.createLongSum(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -172,7 +172,7 @@ class SerializerTest {
private static final MetricData DOUBLE_GAUGE = private static final MetricData DOUBLE_GAUGE =
ImmutableMetricData.createDoubleGauge( ImmutableMetricData.createDoubleGauge(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -183,7 +183,7 @@ class SerializerTest {
private static final MetricData LONG_GAUGE = private static final MetricData LONG_GAUGE =
ImmutableMetricData.createLongGauge( ImmutableMetricData.createLongGauge(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -194,7 +194,7 @@ class SerializerTest {
private static final MetricData SUMMARY = private static final MetricData SUMMARY =
ImmutableMetricData.createDoubleSummary( ImmutableMetricData.createDoubleSummary(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -212,7 +212,7 @@ class SerializerTest {
private static final MetricData HISTOGRAM_NO_ATTRIBUTES = private static final MetricData HISTOGRAM_NO_ATTRIBUTES =
ImmutableMetricData.createDoubleHistogram( ImmutableMetricData.createDoubleHistogram(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -241,7 +241,7 @@ class SerializerTest {
private static final MetricData HISTOGRAM_SINGLE_ATTRIBUTE = private static final MetricData HISTOGRAM_SINGLE_ATTRIBUTE =
ImmutableMetricData.createDoubleHistogram( ImmutableMetricData.createDoubleHistogram(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -270,7 +270,7 @@ class SerializerTest {
private static final MetricData DOUBLE_GAUGE_NO_ATTRIBUTES = private static final MetricData DOUBLE_GAUGE_NO_ATTRIBUTES =
ImmutableMetricData.createDoubleGauge( ImmutableMetricData.createDoubleGauge(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",
@ -281,7 +281,7 @@ class SerializerTest {
private static final MetricData DOUBLE_GAUGE_MULTIPLE_ATTRIBUTES = private static final MetricData DOUBLE_GAUGE_MULTIPLE_ATTRIBUTES =
ImmutableMetricData.createDoubleGauge( ImmutableMetricData.createDoubleGauge(
Resource.create(Attributes.of(stringKey("kr"), "vr")), Resource.create(Attributes.of(stringKey("kr"), "vr")),
InstrumentationScopeInfo.create("full", "version", null), InstrumentationScopeInfo.builder("full").setVersion("version").build(),
"instrument.name", "instrument.name",
"unused", "unused",
"1", "1",

View File

@ -205,7 +205,9 @@ class OtelToZipkinSpanTransformerTest {
SpanData data = SpanData data =
spanBuilder() spanBuilder()
.setInstrumentationScopeInfo( .setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null)) InstrumentationScopeInfo.builder("io.opentelemetry.auto")
.setVersion("1.0.0")
.build())
.setKind(SpanKind.CLIENT) .setKind(SpanKind.CLIENT)
.build(); .build();

View File

@ -37,8 +37,7 @@ class CounterTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testCounter") .hasName("testCounter")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test counter") .hasDescription("This is a test counter")
.hasUnit("items") .hasUnit("items")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -38,8 +38,7 @@ class DistributionSummaryTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testSummary") .hasName("testSummary")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test distribution summary") .hasDescription("This is a test distribution summary")
.hasUnit("things") .hasUnit("things")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -102,8 +101,7 @@ class DistributionSummaryTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testSummary") .hasName("testSummary")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test distribution summary") .hasDescription("This is a test distribution summary")
.hasUnit("things") .hasUnit("things")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -175,8 +173,7 @@ class DistributionSummaryTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testSummary") .hasName("testSummary")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test distribution summary") .hasDescription("This is a test distribution summary")
.hasUnit("things") .hasUnit("things")
.hasHistogramSatisfying( .hasHistogramSatisfying(

View File

@ -40,8 +40,7 @@ class FunctionCounterTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testFunctionCounter") .hasName("testFunctionCounter")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function counter") .hasDescription("This is a test function counter")
.hasUnit("items") .hasUnit("items")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -57,8 +57,7 @@ class FunctionTimerSecondsTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testFunctionTimerSeconds.count") .hasName("testFunctionTimerSeconds.count")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function timer") .hasDescription("This is a test function timer")
.hasUnit("1") .hasUnit("1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -72,8 +71,7 @@ class FunctionTimerSecondsTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testFunctionTimerSeconds.sum") .hasName("testFunctionTimerSeconds.sum")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function timer") .hasDescription("This is a test function timer")
.hasUnit("s") .hasUnit("s")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -52,8 +52,7 @@ class FunctionTimerTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testFunctionTimer.count") .hasName("testFunctionTimer.count")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function timer") .hasDescription("This is a test function timer")
.hasUnit("1") .hasUnit("1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -67,8 +66,7 @@ class FunctionTimerTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testFunctionTimer.sum") .hasName("testFunctionTimer.sum")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function timer") .hasDescription("This is a test function timer")
.hasUnit("ms") .hasUnit("ms")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -38,8 +38,7 @@ class GaugeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testGauge") .hasName("testGauge")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test gauge") .hasDescription("This is a test gauge")
.hasUnit("items") .hasUnit("items")
.hasDoubleGaugeSatisfying( .hasDoubleGaugeSatisfying(

View File

@ -54,8 +54,7 @@ class LongTaskTimerHistogramTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerHistogram.active") .hasName("testLongTaskTimerHistogram.active")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("tasks") .hasUnit("tasks")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -66,8 +65,7 @@ class LongTaskTimerHistogramTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerHistogram.duration") .hasName("testLongTaskTimerHistogram.duration")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("ms") .hasUnit("ms")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(
@ -84,8 +82,7 @@ class LongTaskTimerHistogramTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerHistogram.histogram") .hasName("testLongTaskTimerHistogram.histogram")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDoubleGaugeSatisfying( .hasDoubleGaugeSatisfying(
gauge -> gauge ->
gauge.hasPointsSatisfying( gauge.hasPointsSatisfying(
@ -106,8 +103,7 @@ class LongTaskTimerHistogramTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerHistogram.active") .hasName("testLongTaskTimerHistogram.active")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("tasks") .hasUnit("tasks")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -118,8 +114,7 @@ class LongTaskTimerHistogramTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerHistogram.duration") .hasName("testLongTaskTimerHistogram.duration")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("ms") .hasUnit("ms")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -47,8 +47,7 @@ class LongTaskTimerSecondsTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerSeconds.active") .hasName("testLongTaskTimerSeconds.active")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test long task timer") .hasDescription("This is a test long task timer")
.hasUnit("tasks") .hasUnit("tasks")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -62,8 +61,7 @@ class LongTaskTimerSecondsTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimerSeconds.duration") .hasName("testLongTaskTimerSeconds.duration")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test long task timer") .hasDescription("This is a test long task timer")
.hasUnit("s") .hasUnit("s")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -36,8 +36,7 @@ class LongTaskTimerTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testLongTaskTimer.active") .hasName("testLongTaskTimer.active")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test long task timer") .hasDescription("This is a test long task timer")
.hasUnit("tasks") .hasUnit("tasks")
.hasLongSumSatisfying( .hasLongSumSatisfying(

View File

@ -52,8 +52,7 @@ class MeterTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testMeter.total") .hasName("testMeter.total")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test meter") .hasDescription("This is a test meter")
.hasUnit("things") .hasUnit("things")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(

View File

@ -67,8 +67,7 @@ class NamingConventionTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("test.renamedCounter") .hasName("test.renamedCounter")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(
sum -> sum ->
sum.hasPointsSatisfying( sum.hasPointsSatisfying(

View File

@ -62,8 +62,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusCounter.items") .hasName("testPrometheusCounter.items")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test counter") .hasDescription("This is a test counter")
.hasUnit("items") .hasUnit("items")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(
@ -96,8 +95,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusSummary.items") .hasName("testPrometheusSummary.items")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test summary") .hasDescription("This is a test summary")
.hasUnit("items") .hasUnit("items")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -111,8 +109,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusSummary.items.max") .hasName("testPrometheusSummary.items.max")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test summary") .hasDescription("This is a test summary")
.hasUnit("items") .hasUnit("items")
.hasDoubleGaugeSatisfying( .hasDoubleGaugeSatisfying(
@ -146,8 +143,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusFunctionTimer.seconds.count") .hasName("testPrometheusFunctionTimer.seconds.count")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function timer") .hasDescription("This is a test function timer")
.hasUnit("1") .hasUnit("1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -161,8 +157,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusFunctionTimer.seconds.sum") .hasName("testPrometheusFunctionTimer.seconds.sum")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test function timer") .hasDescription("This is a test function timer")
.hasUnit("s") .hasUnit("s")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(
@ -189,8 +184,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusGauge.items") .hasName("testPrometheusGauge.items")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test gauge") .hasDescription("This is a test gauge")
.hasUnit("items") .hasUnit("items")
.hasDoubleGaugeSatisfying( .hasDoubleGaugeSatisfying(
@ -220,8 +214,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusLongTaskTimer.seconds.active") .hasName("testPrometheusLongTaskTimer.seconds.active")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test long task timer") .hasDescription("This is a test long task timer")
.hasUnit("tasks") .hasUnit("tasks")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -235,8 +228,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusLongTaskTimer.seconds.duration") .hasName("testPrometheusLongTaskTimer.seconds.duration")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test long task timer") .hasDescription("This is a test long task timer")
.hasUnit("s") .hasUnit("s")
.hasDoubleSumSatisfying( .hasDoubleSumSatisfying(
@ -300,8 +292,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusTimer.seconds") .hasName("testPrometheusTimer.seconds")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("s") .hasUnit("s")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -315,8 +306,7 @@ class PrometheusModeTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testPrometheusTimer.seconds.max") .hasName("testPrometheusTimer.seconds.max")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("s") .hasUnit("s")
.hasDoubleGaugeSatisfying( .hasDoubleGaugeSatisfying(

View File

@ -47,8 +47,7 @@ class TimerSecondsTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testTimerSeconds") .hasName("testTimerSeconds")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("s") .hasUnit("s")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -80,8 +79,7 @@ class TimerSecondsTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testTimerSeconds") .hasName("testTimerSeconds")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("s") .hasUnit("s")
.hasHistogramSatisfying( .hasHistogramSatisfying(

View File

@ -39,8 +39,7 @@ class TimerTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testTimer") .hasName("testTimer")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("ms") .hasUnit("ms")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -137,8 +136,7 @@ class TimerTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testTimer") .hasName("testTimer")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("ms") .hasUnit("ms")
.hasHistogramSatisfying( .hasHistogramSatisfying(
@ -210,8 +208,7 @@ class TimerTest {
metric -> metric ->
assertThat(metric) assertThat(metric)
.hasName("testTimer") .hasName("testTimer")
.hasInstrumentationScope( .hasInstrumentationScope(InstrumentationScopeInfo.create(INSTRUMENTATION_NAME))
InstrumentationScopeInfo.create(INSTRUMENTATION_NAME, null, null))
.hasDescription("This is a test timer") .hasDescription("This is a test timer")
.hasUnit("ms") .hasUnit("ms")
.hasHistogramSatisfying( .hasHistogramSatisfying(

View File

@ -30,7 +30,12 @@ public abstract class InstrumentationScopeInfo {
return InstrumentationScopeInfo.create(name, null, null, Attributes.empty()); 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( public static InstrumentationScopeInfo create(
String name, @Nullable String version, @Nullable String schemaUrl) { String name, @Nullable String version, @Nullable String schemaUrl) {
return InstrumentationScopeInfo.create(name, version, schemaUrl, Attributes.empty()); return InstrumentationScopeInfo.create(name, version, schemaUrl, Attributes.empty());

View File

@ -6,6 +6,7 @@
package io.opentelemetry.sdk.internal; package io.opentelemetry.sdk.internal;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo; 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 * This class is internal and is hence not for public use. Its APIs are unstable and can change at
@ -27,10 +28,15 @@ public final class InstrumentationScopeUtil {
@SuppressWarnings("deprecation") // Utility method for compatibility @SuppressWarnings("deprecation") // Utility method for compatibility
public static InstrumentationScopeInfo toInstrumentationScopeInfo( public static InstrumentationScopeInfo toInstrumentationScopeInfo(
io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) { io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) {
return InstrumentationScopeInfo.create( InstrumentationScopeInfoBuilder builder =
instrumentationLibraryInfo.getName(), InstrumentationScopeInfo.builder(instrumentationLibraryInfo.getName());
instrumentationLibraryInfo.getVersion(), if (instrumentationLibraryInfo.getVersion() != null) {
instrumentationLibraryInfo.getSchemaUrl()); builder.setVersion(instrumentationLibraryInfo.getVersion());
}
if (instrumentationLibraryInfo.getSchemaUrl() != null) {
builder.setSchemaUrl(instrumentationLibraryInfo.getSchemaUrl());
}
return builder.build();
} }
private InstrumentationScopeUtil() {} private InstrumentationScopeUtil() {}

View File

@ -6,7 +6,6 @@
package io.opentelemetry.sdk.common; package io.opentelemetry.sdk.common;
import static org.assertj.core.api.Assertions.assertThat; 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 static org.assertj.core.api.Assertions.assertThatThrownBy;
import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.Attributes;
@ -23,18 +22,35 @@ class InstrumentationScopeInfoTest {
@Test @Test
void create_Valid() { void create_Valid() {
assertThatCode(() -> InstrumentationScopeInfo.builder("name").build()) InstrumentationScopeInfo scope = InstrumentationScopeInfo.builder("name").build();
.doesNotThrowAnyException(); assertThat(scope.getName()).isEqualTo("name");
assertThatCode(() -> InstrumentationScopeInfo.builder("name").setVersion(null).build()) assertThat(scope.getVersion()).isNull();
.doesNotThrowAnyException(); assertThat(scope.getSchemaUrl()).isNull();
assertThatCode(() -> InstrumentationScopeInfo.builder("name").setSchemaUrl(null).build()) assertThat(scope.getAttributes()).isEqualTo(Attributes.empty());
.doesNotThrowAnyException();
assertThatCode( scope =
() ->
InstrumentationScopeInfo.builder("name") InstrumentationScopeInfo.builder("name")
.setVersion("version")
.setSchemaUrl("schemaUrl")
.setAttributes(Attributes.builder().put("key", "value").build()) .setAttributes(Attributes.builder().put("key", "value").build())
.build()) .build();
.doesNotThrowAnyException(); 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 @Test

View File

@ -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());
}
}

View File

@ -185,7 +185,10 @@ class SdkLogEmitterProviderTest {
@Test @Test
void logEmitterBuilder_PropagatesToEmitter() { void logEmitterBuilder_PropagatesToEmitter() {
InstrumentationScopeInfo expected = InstrumentationScopeInfo expected =
InstrumentationScopeInfo.create("test", "version", "http://url"); InstrumentationScopeInfo.builder("test")
.setVersion("version")
.setSchemaUrl("http://url")
.build();
assertThat( assertThat(
((SdkLogEmitter) ((SdkLogEmitter)
sdkLogEmitterProvider sdkLogEmitterProvider

View File

@ -173,7 +173,7 @@ class IdentityTest {
metricData -> metricData ->
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", "version1", null)) InstrumentationScopeInfo.builder("meter1").setVersion("version1").build())
.hasName("counter1") .hasName("counter1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
sum -> sum.hasPointsSatisfying(point -> point.hasValue(10)))); sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))));
@ -199,14 +199,17 @@ class IdentityTest {
metricData -> metricData ->
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", "version1", null)) InstrumentationScopeInfo.builder("meter1").setVersion("version1").build())
.hasName("counter1") .hasName("counter1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))), sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))),
metricData -> metricData ->
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", "version1", "schema1")) InstrumentationScopeInfo.builder("meter1")
.setVersion("version1")
.setSchemaUrl("schema1")
.build())
.hasName("counter1") .hasName("counter1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
sum -> sum.hasPointsSatisfying(point -> point.hasValue(10)))); sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))));
@ -566,7 +569,7 @@ class IdentityTest {
metricData -> metricData ->
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", "version1", null)) InstrumentationScopeInfo.builder("meter1").setVersion("version1").build())
.hasName("counter1") .hasName("counter1")
.hasDescription("description1") .hasDescription("description1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -574,7 +577,7 @@ class IdentityTest {
metricData -> { metricData -> {
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", "version2", null)) InstrumentationScopeInfo.builder("meter1").setVersion("version2").build())
.hasName("counter1") .hasName("counter1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))); sum -> sum.hasPointsSatisfying(point -> point.hasValue(10)));
@ -613,7 +616,7 @@ class IdentityTest {
metricData -> metricData ->
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", null, "schema1")) InstrumentationScopeInfo.builder("meter1").setSchemaUrl("schema1").build())
.hasName("counter1") .hasName("counter1")
.hasDescription("description1") .hasDescription("description1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
@ -621,7 +624,7 @@ class IdentityTest {
metricData -> { metricData -> {
assertThat(metricData) assertThat(metricData)
.hasInstrumentationScope( .hasInstrumentationScope(
InstrumentationScopeInfo.create("meter1", null, "schema2")) InstrumentationScopeInfo.builder("meter1").setSchemaUrl("schema2").build())
.hasName("counter1") .hasName("counter1")
.hasLongSumSatisfying( .hasLongSumSatisfying(
sum -> sum.hasPointsSatisfying(point -> point.hasValue(10))); sum -> sum.hasPointsSatisfying(point -> point.hasValue(10)));

View File

@ -91,7 +91,10 @@ class SdkMeterRegistryTest {
@Test @Test
void propagatesInstrumentationScopeInfoToMeter() { void propagatesInstrumentationScopeInfoToMeter() {
InstrumentationScopeInfo expected = InstrumentationScopeInfo expected =
InstrumentationScopeInfo.create("theName", "theVersion", "http://theschema"); InstrumentationScopeInfo.builder("theName")
.setVersion("theVersion")
.setSchemaUrl("http://theschema")
.build();
SdkMeter meter = SdkMeter meter =
(SdkMeter) (SdkMeter)
meterProvider meterProvider

View File

@ -39,7 +39,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
public class SynchronousMetricStorageTest { public class SynchronousMetricStorageTest {
private static final Resource RESOURCE = Resource.empty(); private static final Resource RESOURCE = Resource.empty();
private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = 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 = private static final InstrumentDescriptor DESCRIPTOR =
InstrumentDescriptor.create( InstrumentDescriptor.create(
"name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.DOUBLE); "name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.DOUBLE);

View File

@ -30,7 +30,10 @@ class ViewRegistryTest {
@RegisterExtension LogCapturer logs = LogCapturer.create().captureForType(ViewRegistry.class); @RegisterExtension LogCapturer logs = LogCapturer.create().captureForType(ViewRegistry.class);
private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = 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) { private static RegisteredView registeredView(InstrumentSelector instrumentSelector, View view) {
return RegisteredView.create( return RegisteredView.create(

View File

@ -53,7 +53,7 @@ class MetricAssertionsTest {
private static final Resource RESOURCE = private static final Resource RESOURCE =
Resource.create(Attributes.builder().put("dog", "bark").build()); Resource.create(Attributes.builder().put("dog", "bark").build());
private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO =
InstrumentationScopeInfo.create("opentelemetry", "1.0", null); InstrumentationScopeInfo.builder("opentelemetry").setVersion("1.0").build();
private static final AttributeKey<String> BEAR = AttributeKey.stringKey("bear"); private static final AttributeKey<String> BEAR = AttributeKey.stringKey("bear");
private static final AttributeKey<String> CAT = AttributeKey.stringKey("cat"); private static final AttributeKey<String> CAT = AttributeKey.stringKey("cat");

View File

@ -46,7 +46,7 @@ class TraceAssertionsTest {
private static final Resource RESOURCE = private static final Resource RESOURCE =
Resource.create(Attributes.builder().put("dog", "bark").build()); Resource.create(Attributes.builder().put("dog", "bark").build());
private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO = private static final InstrumentationScopeInfo INSTRUMENTATION_SCOPE_INFO =
InstrumentationScopeInfo.create("opentelemetry", "1.0", null); InstrumentationScopeInfo.builder("opentelemetry").setVersion("1.0").build();
private static final AttributeKey<String> BEAR = AttributeKey.stringKey("bear"); private static final AttributeKey<String> BEAR = AttributeKey.stringKey("bear");
private static final AttributeKey<String> CAT = AttributeKey.stringKey("cat"); private static final AttributeKey<String> CAT = AttributeKey.stringKey("cat");

View File

@ -171,7 +171,10 @@ class SdkTracerProviderTest {
@Test @Test
void propagatesInstrumentationScopeInfoToTracer() { void propagatesInstrumentationScopeInfoToTracer() {
InstrumentationScopeInfo expected = InstrumentationScopeInfo expected =
InstrumentationScopeInfo.create("theName", "theVersion", "http://url"); InstrumentationScopeInfo.builder("theName")
.setVersion("theVersion")
.setSchemaUrl("http://url")
.build();
Tracer tracer = Tracer tracer =
tracerFactory tracerFactory
.tracerBuilder(expected.getName()) .tracerBuilder(expected.getName())

View File

@ -27,8 +27,10 @@ class SdkTracerTest {
"io.opentelemetry.sdk.trace.TracerSdkTest"; "io.opentelemetry.sdk.trace.TracerSdkTest";
private static final String INSTRUMENTATION_SCOPE_VERSION = "0.2.0"; private static final String INSTRUMENTATION_SCOPE_VERSION = "0.2.0";
private static final InstrumentationScopeInfo instrumentationScopeInfo = private static final InstrumentationScopeInfo instrumentationScopeInfo =
InstrumentationScopeInfo.create( InstrumentationScopeInfo.builder(INSTRUMENTATION_SCOPE_NAME)
INSTRUMENTATION_SCOPE_NAME, INSTRUMENTATION_SCOPE_VERSION, "http://schemaurl"); .setVersion(INSTRUMENTATION_SCOPE_VERSION)
.setSchemaUrl("http://schemaurl")
.build();
private final SdkTracer tracer = private final SdkTracer tracer =
(SdkTracer) (SdkTracer)
SdkTracerProvider.builder() SdkTracerProvider.builder()
@ -51,12 +53,7 @@ class SdkTracerTest {
@Test @Test
void propagatesInstrumentationScopeInfoToSpan() { void propagatesInstrumentationScopeInfoToSpan() {
ReadableSpan readableSpan = (ReadableSpan) tracer.spanBuilder("spanName").startSpan(); ReadableSpan readableSpan = (ReadableSpan) tracer.spanBuilder("spanName").startSpan();
assertThat(readableSpan.getInstrumentationScopeInfo()) assertThat(readableSpan.getInstrumentationScopeInfo()).isEqualTo(instrumentationScopeInfo);
.isEqualTo(
InstrumentationScopeInfo.create(
instrumentationScopeInfo.getName(),
instrumentationScopeInfo.getVersion(),
instrumentationScopeInfo.getSchemaUrl()));
} }
@Test @Test