Skip to content

Commit

Permalink
Deprecate multi argument InstrumentationScopeInfo create method (open…
Browse files Browse the repository at this point in the history
…-telemetry#4710)

* Deprecate multi argument InstrumentationScopeInfo create method

* PR feedback
  • Loading branch information
jack-berg authored Aug 24, 2022
1 parent 8445642 commit 2bc88f4
Show file tree
Hide file tree
Showing 52 changed files with 262 additions and 166 deletions.
2 changes: 2 additions & 0 deletions docs/apidiffs/current_vs_latest/opentelemetry-sdk-common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ protected TelemetryExporterBuilder<LogData> 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected TelemetryExporterBuilder<LogData> 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ protected TelemetryExporterBuilder<LogData> 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ protected TelemetryExporterBuilder<LogData> 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static ImmutableList<MetricData> 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",
Expand All @@ -94,7 +94,7 @@ private static ImmutableList<MetricData> 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",
Expand Down
Loading

0 comments on commit 2bc88f4

Please sign in to comment.