From 86355d05f050c31bd1cf8c4285e3dc64b2c90512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar?= <56847527+LikeTheSalad@users.noreply.github.com> Date: Fri, 27 Oct 2023 13:00:08 +0200 Subject: [PATCH] Bump opentelemetry java sdk version and add new semconv dependency (#217) * Bumping OTel sdk and adding semconv lib * Updating unit tests * Updating changelog * Updated notice files --- CHANGELOG.asciidoc | 1 + NOTICE | 1 + android-sdk-ktx/metadata/notice.properties | 2 +- android-sdk/build.gradle | 2 +- android-sdk/metadata/notice.properties | 2 +- .../common/CarrierHttpAttributesVisitor.java | 10 +++++----- .../ConnectionHttpAttributesVisitor.java | 6 +++--- .../attributes/resources/DeviceIdVisitor.java | 2 +- .../resources/DeviceInfoVisitor.java | 2 +- .../resources/OsDescriptorVisitor.java | 2 +- .../resources/RuntimeDescriptorVisitor.java | 2 +- .../sdk/attributes/resources/SdkIdVisitor.java | 2 +- .../attributes/resources/ServiceIdVisitor.java | 2 +- .../exceptions/ElasticExceptionHandler.java | 2 +- .../logs/ElasticLogRecordProcessor.java | 6 +++--- .../metrics/ElasticMetricReader.java | 17 +++++++---------- .../visitors/BasicHttpAttributesVisitor.java | 6 +++--- .../sdk/traces/http/filtering/HttpFilter.java | 8 ++++---- .../impl/okhttp/OtelOkHttpEventListener.java | 6 +++--- android-sdk/src/main/resources/META-INF/NOTICE | 1 + .../attributes/logs/GlobalAttributeTest.java | 8 ++++---- .../attributes/traces/GlobalAttributeTest.java | 16 ++++++++-------- .../test/network/okhttp/OkHttpSpansTest.java | 18 +++++++++--------- build.gradle | 2 +- 24 files changed, 63 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 7c2ddd0b3..5c26066a6 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -38,6 +38,7 @@ ${next_release_notes} * Removing Gradle's warning on missing serverUrl param: {pull}209[#209] * Adding http response content length attr to okhttp spans: {pull}211[#211] * Marking okhttp spans as failed when receiving an error response code: {pull}212[#212] +* Bumping OTel SDK to 1.31.0 and adding new semconv dependency: {pull}217[#217] //// [[release-notes-0.9.0]] diff --git a/NOTICE b/NOTICE index fbb362bd5..5d3750b91 100644 --- a/NOTICE +++ b/NOTICE @@ -16,6 +16,7 @@ This product includes software licensed under the 'Apache License Version 2.0' l - okhttp (https://square.github.io/okhttp/) - OpenTelemetry Java (https://github.com/open-telemetry/opentelemetry-java) - OpenTelemetry Java Contrib (https://github.com/open-telemetry/opentelemetry-java-contrib) + - OpenTelemetry Semantic Conventions Java (https://github.com/open-telemetry/semantic-conventions-java) - org.stagemonitor:stagemonitor-configuration (http://www.stagemonitor.org) - Weakly referenced lock-free data structures (https://github.com/raphw/weak-lock-free) diff --git a/android-sdk-ktx/metadata/notice.properties b/android-sdk-ktx/metadata/notice.properties index 1b7d6a0e9..403b63c43 100644 --- a/android-sdk-ktx/metadata/notice.properties +++ b/android-sdk-ktx/metadata/notice.properties @@ -1 +1 @@ -dependencies.hash=83E0E6D9CD40065C79FADBCA67A5607B \ No newline at end of file +dependencies.hash=81F0B6D19D5388F15DBE3E189D6C1B22 \ No newline at end of file diff --git a/android-sdk/build.gradle b/android-sdk/build.gradle index f30445bec..b0977ed20 100644 --- a/android-sdk/build.gradle +++ b/android-sdk/build.gradle @@ -44,7 +44,7 @@ dependencies { implementation 'com.blogspot.mydailyjava:weak-lock-free:0.18' implementation project(':android-common') implementation "io.opentelemetry:opentelemetry-exporter-otlp:$openTelemetry_version" - implementation "io.opentelemetry:opentelemetry-semconv:$openTelemetry_version-alpha" + implementation "io.opentelemetry.semconv:opentelemetry-semconv:1.21.0-alpha" implementation "io.opentelemetry.contrib:opentelemetry-disk-buffering:$openTelemetry_version-alpha" implementation "androidx.annotation:annotation:$androidAnnotations_version" implementation 'com.dslplatform:dsl-json-java8:1.10.0' diff --git a/android-sdk/metadata/notice.properties b/android-sdk/metadata/notice.properties index 989a26c86..d1c5b0a71 100644 --- a/android-sdk/metadata/notice.properties +++ b/android-sdk/metadata/notice.properties @@ -1 +1 @@ -dependencies.hash=553460B56887EDB98C3A019266F71C55 \ No newline at end of file +dependencies.hash=81E0A693875E87899494D84AB8C8D79D \ No newline at end of file diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/CarrierHttpAttributesVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/CarrierHttpAttributesVisitor.java index bd9b1bf3a..e8a923175 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/CarrierHttpAttributesVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/CarrierHttpAttributesVisitor.java @@ -25,7 +25,7 @@ import co.elastic.apm.android.sdk.internal.services.network.data.CarrierInfo; import co.elastic.apm.android.sdk.internal.utilities.providers.Provider; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; public class CarrierHttpAttributesVisitor implements AttributesVisitor { private final Provider networkServiceProvider; @@ -38,10 +38,10 @@ public CarrierHttpAttributesVisitor() { public void visit(AttributesBuilder builder) { CarrierInfo carrierInfo = networkServiceProvider.get().getCarrierInfo(); if (carrierInfo != null) { - builder.put(SemanticAttributes.NET_HOST_CARRIER_NAME, carrierInfo.name); - builder.put(SemanticAttributes.NET_HOST_CARRIER_MCC, carrierInfo.mcc); - builder.put(SemanticAttributes.NET_HOST_CARRIER_MNC, carrierInfo.mnc); - builder.put(SemanticAttributes.NET_HOST_CARRIER_ICC, carrierInfo.icc); + builder.put(SemanticAttributes.NETWORK_CARRIER_NAME, carrierInfo.name); + builder.put(SemanticAttributes.NETWORK_CARRIER_MCC, carrierInfo.mcc); + builder.put(SemanticAttributes.NETWORK_CARRIER_MNC, carrierInfo.mnc); + builder.put(SemanticAttributes.NETWORK_CARRIER_ICC, carrierInfo.icc); } } } diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/ConnectionHttpAttributesVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/ConnectionHttpAttributesVisitor.java index 3fb4d3798..0518dd05c 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/ConnectionHttpAttributesVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/common/ConnectionHttpAttributesVisitor.java @@ -24,7 +24,7 @@ import co.elastic.apm.android.sdk.internal.services.network.NetworkService; import co.elastic.apm.android.sdk.internal.services.network.data.type.NetworkType; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; public class ConnectionHttpAttributesVisitor implements AttributesVisitor { private final NetworkService networkService; @@ -48,9 +48,9 @@ private ConnectionHttpAttributesVisitor() { @Override public void visit(AttributesBuilder builder) { NetworkType networkType = networkService.getType(); - builder.put(SemanticAttributes.NET_HOST_CONNECTION_TYPE, networkType.getName()); + builder.put(SemanticAttributes.NETWORK_CONNECTION_TYPE, networkType.getName()); if (networkType.getSubTypeName() != null) { - builder.put(SemanticAttributes.NET_HOST_CONNECTION_SUBTYPE, networkType.getSubTypeName()); + builder.put(SemanticAttributes.NETWORK_CONNECTION_SUBTYPE, networkType.getSubTypeName()); } } } diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceIdVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceIdVisitor.java index 1f8a1bb66..f84300f5e 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceIdVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceIdVisitor.java @@ -25,7 +25,7 @@ import co.elastic.apm.android.sdk.internal.services.ServiceManager; import co.elastic.apm.android.sdk.internal.services.preferences.PreferencesService; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; public class DeviceIdVisitor implements AttributesVisitor { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceInfoVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceInfoVisitor.java index 36e06484f..7b3c424ce 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceInfoVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/DeviceInfoVisitor.java @@ -22,7 +22,7 @@ import co.elastic.apm.android.sdk.attributes.AttributesVisitor; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; public class DeviceInfoVisitor implements AttributesVisitor { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/OsDescriptorVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/OsDescriptorVisitor.java index 5a02df531..cc109512b 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/OsDescriptorVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/OsDescriptorVisitor.java @@ -22,7 +22,7 @@ import co.elastic.apm.android.sdk.attributes.AttributesVisitor; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; public class OsDescriptorVisitor implements AttributesVisitor { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/RuntimeDescriptorVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/RuntimeDescriptorVisitor.java index 32c0364ff..fee5608bb 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/RuntimeDescriptorVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/RuntimeDescriptorVisitor.java @@ -20,7 +20,7 @@ import co.elastic.apm.android.sdk.attributes.AttributesVisitor; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; public class RuntimeDescriptorVisitor implements AttributesVisitor { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/SdkIdVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/SdkIdVisitor.java index 9c58ab4a4..55101d63b 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/SdkIdVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/SdkIdVisitor.java @@ -21,7 +21,7 @@ import co.elastic.apm.android.sdk.BuildConfig; import co.elastic.apm.android.sdk.attributes.AttributesVisitor; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; public class SdkIdVisitor implements AttributesVisitor { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/ServiceIdVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/ServiceIdVisitor.java index 53f9e3b51..8d9cf1522 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/ServiceIdVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/attributes/resources/ServiceIdVisitor.java @@ -26,7 +26,7 @@ import co.elastic.apm.android.sdk.internal.services.appinfo.AppInfoService; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; public class ServiceIdVisitor implements AttributesVisitor { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/exceptions/ElasticExceptionHandler.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/exceptions/ElasticExceptionHandler.java index 76094be64..49367f957 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/exceptions/ElasticExceptionHandler.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/exceptions/ElasticExceptionHandler.java @@ -28,7 +28,7 @@ import co.elastic.apm.android.sdk.logs.ElasticEvents; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.events.EventEmitter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; public final class ElasticExceptionHandler implements Thread.UncaughtExceptionHandler { private final Thread.UncaughtExceptionHandler wrapped; diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/logs/ElasticLogRecordProcessor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/logs/ElasticLogRecordProcessor.java index 9b2fcda47..2d957e1a5 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/logs/ElasticLogRecordProcessor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/logs/ElasticLogRecordProcessor.java @@ -18,15 +18,15 @@ */ package co.elastic.apm.android.sdk.internal.opentelemetry.processors.logs; +import androidx.annotation.NonNull; + import org.slf4j.Logger; import co.elastic.apm.android.common.internal.logging.Elog; import co.elastic.apm.android.sdk.attributes.AttributesCreator; import co.elastic.apm.android.sdk.attributes.AttributesVisitor; import co.elastic.apm.android.sdk.instrumentation.Instrumentation; -import co.elastic.apm.android.sdk.instrumentation.Instrumentations; import co.elastic.apm.android.sdk.internal.api.filter.Filter; -import co.elastic.apm.android.sdk.internal.configuration.Configurations; import co.elastic.apm.android.sdk.internal.configuration.impl.AllInstrumentationConfiguration; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; @@ -48,7 +48,7 @@ public ElasticLogRecordProcessor(LogRecordProcessor original, AttributesVisitor } @Override - public void onEmit(Context context, ReadWriteLogRecord logRecord) { + public void onEmit(@NonNull Context context, @NonNull ReadWriteLogRecord logRecord) { if (!Instrumentation.isEnabled(AllInstrumentationConfiguration.class)) { Elog.getLogger().debug("Ignoring all log records"); return; diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/metrics/ElasticMetricReader.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/metrics/ElasticMetricReader.java index 84f0d46c5..b736e8fef 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/metrics/ElasticMetricReader.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/internal/opentelemetry/processors/metrics/ElasticMetricReader.java @@ -18,6 +18,8 @@ */ package co.elastic.apm.android.sdk.internal.opentelemetry.processors.metrics; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -33,7 +35,6 @@ import io.opentelemetry.sdk.metrics.data.MetricData; import io.opentelemetry.sdk.metrics.export.CollectionRegistration; import io.opentelemetry.sdk.metrics.export.MetricReader; -import io.opentelemetry.sdk.metrics.internal.export.MetricProducer; public final class ElasticMetricReader implements MetricReader { private final MetricReader wrapped; @@ -44,12 +45,8 @@ public ElasticMetricReader(MetricReader wrapped) { } @Override - public void register(CollectionRegistration registration) { - if (registration instanceof MetricProducer) { - wrapped.register(new ElasticMetricProducer((MetricProducer) registration, filter)); - } else { - wrapped.register(registration); - } + public void register(@NonNull CollectionRegistration registration) { + wrapped.register(new ElasticCollectionRegistration(registration, filter)); } @Override @@ -67,11 +64,11 @@ public AggregationTemporality getAggregationTemporality(InstrumentType instrumen return wrapped.getAggregationTemporality(instrumentType); } - private static class ElasticMetricProducer implements MetricProducer { - private final MetricProducer wrapped; + private static class ElasticCollectionRegistration implements CollectionRegistration { + private final CollectionRegistration wrapped; private final Filter filter; - private ElasticMetricProducer(MetricProducer wrapped, Filter filter) { + private ElasticCollectionRegistration(CollectionRegistration wrapped, Filter filter) { this.wrapped = wrapped; this.filter = filter; } diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/attributes/visitors/BasicHttpAttributesVisitor.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/attributes/visitors/BasicHttpAttributesVisitor.java index 725e201af..b00f1f6b9 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/attributes/visitors/BasicHttpAttributesVisitor.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/attributes/visitors/BasicHttpAttributesVisitor.java @@ -21,13 +21,13 @@ import co.elastic.apm.android.sdk.traces.http.attributes.HttpAttributesVisitor; import co.elastic.apm.android.sdk.traces.http.data.HttpRequest; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; public class BasicHttpAttributesVisitor implements HttpAttributesVisitor { @Override public void visit(AttributesBuilder builder, HttpRequest request) { - builder.put(SemanticAttributes.HTTP_URL, request.url.toString()) - .put(SemanticAttributes.HTTP_METHOD, request.method); + builder.put(SemanticAttributes.URL_FULL, request.url.toString()) + .put(SemanticAttributes.HTTP_REQUEST_METHOD, request.method); } } diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/filtering/HttpFilter.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/filtering/HttpFilter.java index bcafa8a73..a6b61bf54 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/filtering/HttpFilter.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/filtering/HttpFilter.java @@ -23,16 +23,16 @@ import java.net.MalformedURLException; import java.net.URL; -import co.elastic.apm.android.sdk.traces.tools.SpanFilter; import co.elastic.apm.android.sdk.traces.http.data.HttpRequest; +import co.elastic.apm.android.sdk.traces.tools.SpanFilter; import io.opentelemetry.sdk.trace.ReadableSpan; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; abstract public class HttpFilter implements SpanFilter { @Override public boolean shouldInclude(ReadableSpan item) { - String httpMethod = item.getAttribute(SemanticAttributes.HTTP_METHOD); + String httpMethod = item.getAttribute(SemanticAttributes.HTTP_REQUEST_METHOD); if (httpMethod == null) { // Not an http-related Span. return false; @@ -42,7 +42,7 @@ public boolean shouldInclude(ReadableSpan item) { } private URL getUrl(ReadableSpan span) { - String urlString = span.getAttribute(SemanticAttributes.HTTP_URL); + String urlString = span.getAttribute(SemanticAttributes.URL_FULL); try { return new URL(urlString); } catch (MalformedURLException e) { diff --git a/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/impl/okhttp/OtelOkHttpEventListener.java b/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/impl/okhttp/OtelOkHttpEventListener.java index 25220a4c4..1dbbb8360 100644 --- a/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/impl/okhttp/OtelOkHttpEventListener.java +++ b/android-sdk/src/main/java/co/elastic/apm/android/sdk/traces/http/impl/okhttp/OtelOkHttpEventListener.java @@ -38,7 +38,7 @@ import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; import io.opentelemetry.context.ContextKey; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; import okhttp3.Call; import okhttp3.EventListener; import okhttp3.HttpUrl; @@ -133,12 +133,12 @@ public void responseHeadersEnd(@NonNull Call call, @NonNull Response response) { private static void setResponseSize(@NonNull Response response, Span span) { String contentLength = response.header("Content-Length"); if (contentLength != null) { - span.setAttribute(SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH, Long.valueOf(contentLength)); + span.setAttribute(SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, Long.valueOf(contentLength)); } } private static void setStatusCode(Span span, int code) { - span.setAttribute(SemanticAttributes.HTTP_STATUS_CODE, code); + span.setAttribute(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE, code); } private static boolean isHttpError(int code) { diff --git a/android-sdk/src/main/resources/META-INF/NOTICE b/android-sdk/src/main/resources/META-INF/NOTICE index c19209f01..ef3921292 100644 --- a/android-sdk/src/main/resources/META-INF/NOTICE +++ b/android-sdk/src/main/resources/META-INF/NOTICE @@ -11,6 +11,7 @@ This product includes software licensed under the 'Apache License Version 2.0' l - okhttp (https://square.github.io/okhttp/) - OpenTelemetry Java (https://github.com/open-telemetry/opentelemetry-java) - OpenTelemetry Java Contrib (https://github.com/open-telemetry/opentelemetry-java-contrib) + - OpenTelemetry Semantic Conventions Java (https://github.com/open-telemetry/semantic-conventions-java) - org.stagemonitor:stagemonitor-configuration (http://www.stagemonitor.org) - Weakly referenced lock-free data structures (https://github.com/raphw/weak-lock-free) diff --git a/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/logs/GlobalAttributeTest.java b/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/logs/GlobalAttributeTest.java index 52225dabf..abf8a13be 100644 --- a/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/logs/GlobalAttributeTest.java +++ b/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/logs/GlobalAttributeTest.java @@ -24,7 +24,7 @@ public void whenALogIsCreated_andThereIsWifiConnectivity_verifyItHasWifiConnecti LogRecordData log = captureLog(); Logs.verifyRecord(log) - .hasAttribute("net.host.connection.type", "wifi"); + .hasAttribute("network.connection.type", "wifi"); } @Config(application = AppsWithConnectivity.WithCellular.class) @@ -33,7 +33,7 @@ public void whenALogIsCreated_andThereIsCellularConnectivity_verifyItHasCellular LogRecordData log = captureLog(); Logs.verifyRecord(log) - .hasAttribute("net.host.connection.type", "cell"); + .hasAttribute("network.connection.type", "cell"); } @Config(application = AppsWithConnectivity.WithCellularAndSubtype.class) @@ -42,8 +42,8 @@ public void whenALogIsCreated_andThereIsCellularConnectivityWithSubtype_verifyIt LogRecordData log = captureLog(); Logs.verifyRecord(log) - .hasAttribute("net.host.connection.type", "cell") - .hasAttribute("net.host.connection.subtype", "EDGE"); + .hasAttribute("network.connection.type", "cell") + .hasAttribute("network.connection.subtype", "EDGE"); } private LogRecordData captureLog() { diff --git a/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/traces/GlobalAttributeTest.java b/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/traces/GlobalAttributeTest.java index af78fb048..b651b4179 100644 --- a/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/traces/GlobalAttributeTest.java +++ b/android-test/app/src/test/java/co/elastic/apm/android/test/attributes/traces/GlobalAttributeTest.java @@ -40,10 +40,10 @@ public void whenASpanIsCreated_verifyItHasCarrierInfoParams() { SpanData customSpan = getSpanData(); Spans.verify(customSpan) - .hasAttribute("net.host.carrier.name", AppWithCarrierInfo.SIM_OPERATOR_NAME) - .hasAttribute("net.host.carrier.mcc", "123") - .hasAttribute("net.host.carrier.mnc", "456") - .hasAttribute("net.host.carrier.icc", AppWithCarrierInfo.SIM_COUNTRY_ISO); + .hasAttribute("network.carrier.name", AppWithCarrierInfo.SIM_OPERATOR_NAME) + .hasAttribute("network.carrier.mcc", "123") + .hasAttribute("network.carrier.mnc", "456") + .hasAttribute("network.carrier.icc", AppWithCarrierInfo.SIM_COUNTRY_ISO); } @Config(application = AppsWithConnectivity.WithWifi.class) @@ -52,7 +52,7 @@ public void whenASpanIsCreated_andThereIsAWifiConnection_verifyItHasWifiConnecti SpanData span = getSpanData(); Spans.verify(span) - .hasAttribute("net.host.connection.type", "wifi"); + .hasAttribute("network.connection.type", "wifi"); } @Config(application = AppsWithConnectivity.WithCellular.class) @@ -61,7 +61,7 @@ public void whenASpanIsCreated_andThereIsAMobileConnection_verifyItHasMobileConn SpanData span = getSpanData(); Spans.verify(span) - .hasAttribute("net.host.connection.type", "cell"); + .hasAttribute("network.connection.type", "cell"); } @Config(application = AppsWithConnectivity.WithCellularAndSubtype.class) @@ -70,8 +70,8 @@ public void whenASpanIsCreated_andThereIsAMobileConnectionWithSubtype_verifyItHa SpanData span = getSpanData(); Spans.verify(span) - .hasAttribute("net.host.connection.type", "cell") - .hasAttribute("net.host.connection.subtype", "EDGE"); + .hasAttribute("network.connection.type", "cell") + .hasAttribute("network.connection.subtype", "EDGE"); } private SpanData getSpanData() { diff --git a/android-test/app/src/test/java/co/elastic/apm/android/test/network/okhttp/OkHttpSpansTest.java b/android-test/app/src/test/java/co/elastic/apm/android/test/network/okhttp/OkHttpSpansTest.java index 833a53b55..1691d45b6 100644 --- a/android-test/app/src/test/java/co/elastic/apm/android/test/network/okhttp/OkHttpSpansTest.java +++ b/android-test/app/src/test/java/co/elastic/apm/android/test/network/okhttp/OkHttpSpansTest.java @@ -77,10 +77,10 @@ public void verifyHttpSpanStructure_whenSucceeded() { Spans.verify(httpSpan) .isNamed("GET localhost") .isOfKind(SpanKind.CLIENT) - .hasAttribute("http.url", "http://localhost:" + webServer.getPort() + "/") - .hasAttribute("http.method", "GET") - .hasAttribute("http.status_code", 200) - .hasAttribute("http.response_content_length", 2); + .hasAttribute("url.full", "http://localhost:" + webServer.getPort() + "/") + .hasAttribute("http.request.method", "GET") + .hasAttribute("http.response.status_code", 200) + .hasAttribute("http.response.body.size", 2); verify(contextStore).remove(any()); } @@ -94,9 +94,9 @@ public void verifyHttpSpanStructure_whenReceivingHttpError() { Spans.verifyFailed(httpSpan) .isNamed("GET localhost") .isOfKind(SpanKind.CLIENT) - .hasAttribute("http.url", "http://localhost:" + webServer.getPort() + "/") - .hasAttribute("http.method", "GET") - .hasAttribute("http.status_code", 500); + .hasAttribute("url.full", "http://localhost:" + webServer.getPort() + "/") + .hasAttribute("http.request.method", "GET") + .hasAttribute("http.response.status_code", 500); } @Test @@ -110,8 +110,8 @@ public void verifyHttpSpanStructure_whenFailed() { .isNamed("GET localhost") .isOfKind(SpanKind.CLIENT) .hasAmountOfRecordedExceptions(1) - .hasAttribute("http.url", "http://localhost:" + webServer.getPort() + "/") - .hasAttribute("http.method", "GET"); + .hasAttribute("url.full", "http://localhost:" + webServer.getPort() + "/") + .hasAttribute("http.request.method", "GET"); verify(contextStore).remove(any()); } diff --git a/build.gradle b/build.gradle index 5074b5197..533f4d829 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ ext { jvmCompatibility = JavaVersion.VERSION_11 androidMinSdk = 24 androidCompileSdk = 32 - openTelemetry_version = "1.28.0" + openTelemetry_version = "1.31.0" androidAnnotations_version = "1.4.0" bytebuddy_version = "1.14.9" okhttp_version = '3.11.0'