Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate InstrumentationLibraryInfo #4256

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ static Span toJaeger(SpanData span) {

tags.add(
new Tag(KEY_INSTRUMENTATION_LIBRARY_NAME, TagType.STRING)
.setVStr(span.getInstrumentationLibraryInfo().getName()));
.setVStr(span.getInstrumentationScopeInfo().getName()));

if (span.getInstrumentationLibraryInfo().getVersion() != null) {
if (span.getInstrumentationScopeInfo().getVersion() != null) {
tags.add(
new Tag(KEY_INSTRUMENTATION_LIBRARY_VERSION, TagType.STRING)
.setVStr(span.getInstrumentationLibraryInfo().getVersion()));
.setVStr(span.getInstrumentationScopeInfo().getVersion()));
}

if (span.getStatus().getStatusCode() == StatusCode.ERROR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.testing.trace.TestSpanData;
import io.opentelemetry.sdk.trace.data.SpanData;
Expand Down Expand Up @@ -82,8 +82,8 @@ void testExport() throws SenderException, UnknownHostException {
.setLinks(Collections.emptyList())
.setTotalRecordedLinks(0)
.setTotalRecordedEvents(0)
.setInstrumentationLibraryInfo(
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null))
.setResource(
Resource.create(
Attributes.of(
Expand Down Expand Up @@ -154,8 +154,8 @@ void testExportMultipleResources() throws SenderException, UnknownHostException
.setLinks(Collections.emptyList())
.setTotalRecordedLinks(0)
.setTotalRecordedEvents(0)
.setInstrumentationLibraryInfo(
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null))
.setResource(
Resource.create(
Attributes.of(
Expand All @@ -177,8 +177,8 @@ void testExportMultipleResources() throws SenderException, UnknownHostException
.setLinks(Collections.emptyList())
.setTotalRecordedLinks(0)
.setTotalRecordedEvents(0)
.setInstrumentationLibraryInfo(
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null))
.setResource(
Resource.create(
Attributes.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ static SpanMarshaler create(SpanData span) {

tags.add(
KeyValueMarshaler.create(
KEY_INSTRUMENTATION_LIBRARY_NAME, span.getInstrumentationLibraryInfo().getName()));
KEY_INSTRUMENTATION_LIBRARY_NAME, span.getInstrumentationScopeInfo().getName()));

if (span.getInstrumentationLibraryInfo().getVersion() != null) {
if (span.getInstrumentationScopeInfo().getVersion() != null) {
tags.add(
KeyValueMarshaler.create(
KEY_INSTRUMENTATION_LIBRARY_VERSION,
span.getInstrumentationLibraryInfo().getVersion()));
span.getInstrumentationScopeInfo().getVersion()));
}

if (span.getStatus().getStatusCode() == StatusCode.ERROR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import io.opentelemetry.exporter.jaeger.proto.api_v2.Collector;
import io.opentelemetry.exporter.jaeger.proto.api_v2.Model;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.testing.trace.TestSpanData;
import io.opentelemetry.sdk.trace.data.SpanData;
Expand Down Expand Up @@ -120,8 +120,8 @@ void testExport() throws Exception {
.setLinks(Collections.emptyList())
.setTotalRecordedLinks(0)
.setTotalRecordedEvents(0)
.setInstrumentationLibraryInfo(
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null))
.setResource(
Resource.create(
Attributes.of(
Expand Down Expand Up @@ -171,8 +171,8 @@ void testExportMultipleResources() throws Exception {
.setLinks(Collections.emptyList())
.setTotalRecordedLinks(0)
.setTotalRecordedEvents(0)
.setInstrumentationLibraryInfo(
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null))
.setResource(
Resource.create(
Attributes.of(
Expand All @@ -196,8 +196,8 @@ void testExportMultipleResources() throws Exception {
.setLinks(Collections.emptyList())
.setTotalRecordedLinks(0)
.setTotalRecordedEvents(0)
.setInstrumentationLibraryInfo(
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("io.opentelemetry.auto", "1.0.0", null))
.setResource(
Resource.create(
Attributes.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.internal.testing.slf4j.SuppressLogger;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.logs.data.LogData;
import io.opentelemetry.sdk.logs.data.LogDataBuilder;
import io.opentelemetry.sdk.logs.data.Severity;
Expand All @@ -38,7 +38,7 @@ class OtlpJsonLoggingLogExporterTest {

@SuppressWarnings("deprecation") // test deprecated setName method
private static final LogData LOG1 =
LogDataBuilder.create(RESOURCE, InstrumentationLibraryInfo.create("instrumentation", "1"))
LogDataBuilder.create(RESOURCE, InstrumentationScopeInfo.create("instrumentation", "1", null))
.setName("testLog1")
.setBody("body1")
.setSeverity(Severity.INFO)
Expand All @@ -55,7 +55,8 @@ class OtlpJsonLoggingLogExporterTest {

@SuppressWarnings("deprecation") // test deprecated setName method
private static final LogData LOG2 =
LogDataBuilder.create(RESOURCE, InstrumentationLibraryInfo.create("instrumentation2", "2"))
LogDataBuilder.create(
RESOURCE, InstrumentationScopeInfo.create("instrumentation2", "2", null))
.setName("testLog2")
.setBody("body2")
.setSeverity(Severity.INFO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.github.netmikey.logunit.api.LogCapturer;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.internal.testing.slf4j.SuppressLogger;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
import io.opentelemetry.sdk.metrics.data.DoublePointData;
import io.opentelemetry.sdk.metrics.data.MetricData;
Expand All @@ -34,7 +34,7 @@ class OtlpJsonLoggingMetricExporterTest {
private static final MetricData METRIC1 =
MetricData.createDoubleSum(
RESOURCE,
InstrumentationLibraryInfo.create("instrumentation", "1"),
InstrumentationScopeInfo.create("instrumentation", "1", null),
"metric1",
"metric1 description",
"m",
Expand All @@ -47,7 +47,7 @@ class OtlpJsonLoggingMetricExporterTest {
private static final MetricData METRIC2 =
MetricData.createDoubleSum(
RESOURCE,
InstrumentationLibraryInfo.create("instrumentation2", "2"),
InstrumentationScopeInfo.create("instrumentation2", "2", null),
"metric2",
"metric2 description",
"s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.internal.testing.slf4j.SuppressLogger;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.testing.trace.TestSpanData;
import io.opentelemetry.sdk.trace.data.EventData;
Expand Down Expand Up @@ -62,7 +62,8 @@ class OtlpJsonLoggingSpanExporterTest {
.setTotalAttributeCount(2)
.setTotalRecordedEvents(1)
.setTotalRecordedLinks(0)
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.create("instrumentation", "1"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("instrumentation", "1", null))
.setResource(RESOURCE)
.build();

Expand All @@ -81,7 +82,8 @@ class OtlpJsonLoggingSpanExporterTest {
.setName("testSpan2")
.setKind(SpanKind.CLIENT)
.setResource(RESOURCE)
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.create("instrumentation2", "2"))
.setInstrumentationScopeInfo(
InstrumentationScopeInfo.create("instrumentation2", "2", null))
.build();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package io.opentelemetry.exporter.logging;

import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import java.util.Collection;
Expand Down Expand Up @@ -37,7 +37,7 @@ public CompletableResultCode export(Collection<SpanData> spans) {
StringBuilder sb = new StringBuilder(60);
for (SpanData span : spans) {
sb.setLength(0);
InstrumentationLibraryInfo instrumentationLibraryInfo = span.getInstrumentationLibraryInfo();
InstrumentationScopeInfo instrumentationScopeInfo = span.getInstrumentationScopeInfo();
sb.append("'")
.append(span.getName())
.append("' : ")
Expand All @@ -47,12 +47,12 @@ public CompletableResultCode export(Collection<SpanData> spans) {
.append(" ")
.append(span.getKind())
.append(" [tracer: ")
.append(instrumentationLibraryInfo.getName())
.append(instrumentationScopeInfo.getName())
.append(":")
.append(
instrumentationLibraryInfo.getVersion() == null
instrumentationScopeInfo.getVersion() == null
? ""
: instrumentationLibraryInfo.getVersion())
: instrumentationScopeInfo.getVersion())
.append("] ")
.append(span.getAttributes());
logger.log(Level.INFO, sb.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static java.util.concurrent.TimeUnit.NANOSECONDS;

import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.logs.data.LogData;
import io.opentelemetry.sdk.logs.export.LogExporter;
import java.time.Instant;
Expand Down Expand Up @@ -59,7 +59,7 @@ public CompletableResultCode flush() {

// VisibleForTesting
static void formatLog(StringBuilder stringBuilder, LogData log) {
InstrumentationLibraryInfo instrumentationLibraryInfo = log.getInstrumentationLibraryInfo();
InstrumentationScopeInfo instrumentationScopeInfo = log.getInstrumentationScopeInfo();
stringBuilder
.append(
ISO_FORMAT.format(
Expand All @@ -73,13 +73,13 @@ static void formatLog(StringBuilder stringBuilder, LogData log) {
.append(log.getSpanContext().getTraceId())
.append(" ")
.append(log.getSpanContext().getSpanId())
.append(" [libraryInfo: ")
.append(instrumentationLibraryInfo.getName())
.append(" [scopeInfo: ")
.append(instrumentationScopeInfo.getName())
.append(":")
.append(
instrumentationLibraryInfo.getVersion() == null
instrumentationScopeInfo.getVersion() == null
? ""
: instrumentationLibraryInfo.getVersion())
: instrumentationScopeInfo.getVersion())
.append("] ")
.append(log.getAttributes());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.internal.testing.slf4j.SuppressLogger;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
import io.opentelemetry.sdk.metrics.data.DoublePointData;
import io.opentelemetry.sdk.metrics.data.LongPointData;
Expand Down Expand Up @@ -59,13 +59,13 @@ void preferredTemporality() {
void testExport() {
long nowEpochNanos = System.currentTimeMillis() * 1000 * 1000;
Resource resource = Resource.create(Attributes.of(stringKey("host"), "localhost"));
InstrumentationLibraryInfo instrumentationLibraryInfo =
InstrumentationLibraryInfo.create("manualInstrumentation", "1.0");
InstrumentationScopeInfo instrumentationScopeInfo =
InstrumentationScopeInfo.create("manualInstrumentation", "1.0", null);
exporter.export(
Arrays.asList(
MetricData.createDoubleSummary(
resource,
instrumentationLibraryInfo,
instrumentationScopeInfo,
"measureOne",
"A summarized test measure",
"ms",
Expand All @@ -82,7 +82,7 @@ void testExport() {
ImmutableValueAtPercentile.create(100.0, 433)))))),
MetricData.createLongSum(
resource,
instrumentationLibraryInfo,
instrumentationScopeInfo,
"counterOne",
"A simple counter",
"one",
Expand All @@ -97,7 +97,7 @@ void testExport() {
1010)))),
MetricData.createDoubleSum(
resource,
instrumentationLibraryInfo,
instrumentationScopeInfo,
"observedValue",
"an observer gauge",
"kb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.internal.testing.slf4j.SuppressLogger;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.testing.trace.TestSpanData;
import io.opentelemetry.sdk.trace.data.EventData;
import io.opentelemetry.sdk.trace.data.SpanData;
Expand Down Expand Up @@ -65,7 +65,7 @@ class LoggingSpanExporterTest {
Attributes.of(booleanKey("important"), true))))
.setTotalRecordedEvents(1)
.setTotalRecordedLinks(0)
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.create("tracer1", null))
.setInstrumentationScopeInfo(InstrumentationScopeInfo.create("tracer1"))
.build();

private static final SpanData SPAN2 =
Expand All @@ -82,7 +82,7 @@ class LoggingSpanExporterTest {
.setStatus(StatusData.error())
.setName("testSpan2")
.setKind(SpanKind.CLIENT)
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.create("tracer2", "1.0"))
.setInstrumentationScopeInfo(InstrumentationScopeInfo.create("tracer2", "1.0", null))
.build();

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.logs.data.LogData;
import io.opentelemetry.sdk.logs.data.LogDataBuilder;
import io.opentelemetry.sdk.logs.data.Severity;
Expand Down Expand Up @@ -47,12 +47,12 @@ void format() {
assertThat(output.toString())
.isEqualTo(
"1970-08-07T10:00:00Z ERROR3 'message' : 00000000000000010000000000000002 0000000000000003 "
+ "[libraryInfo: logTest:1.0] {amount=1, cheese=\"cheddar\"}");
+ "[scopeInfo: logTest:1.0] {amount=1, cheese=\"cheddar\"}");
}

private static LogData sampleLog(long timestamp) {
return LogDataBuilder.create(
Resource.empty(), InstrumentationLibraryInfo.create("logTest", "1.0"))
Resource.empty(), InstrumentationScopeInfo.create("logTest", "1.0", null))
.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 @@ -31,7 +31,7 @@
import io.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;
import io.opentelemetry.proto.logs.v1.ResourceLogs;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.logs.data.LogData;
import io.opentelemetry.sdk.logs.data.LogDataBuilder;
import io.opentelemetry.sdk.logs.data.Severity;
Expand Down Expand Up @@ -333,8 +333,7 @@ private static <T extends Message> HttpResponse buildResponse(HttpStatus httpSta
@SuppressWarnings("deprecation") // test deprecated setName method
private static LogData generateFakeLog() {
return LogDataBuilder.create(
Resource.getDefault(),
InstrumentationLibraryInfo.create("testLib", "1.0", "http://url"))
Resource.getDefault(), InstrumentationScopeInfo.create("testLib", "1.0", "http://url"))
.setName("log-name")
.setBody("log body")
.setAttributes(Attributes.builder().put("key", "value").build())
Expand Down
Loading