diff --git a/splunk-otel-android-volley/build.gradle.kts b/splunk-otel-android-volley/build.gradle.kts index 1a95e9d9f..576a7ab32 100644 --- a/splunk-otel-android-volley/build.gradle.kts +++ b/splunk-otel-android-volley/build.gradle.kts @@ -46,7 +46,7 @@ android { val otelVersion = "1.23.1" val otelAlphaVersion = "$otelVersion-alpha" -val otelInstrumentationAlphaVersion = "1.23.0-alpha" +val otelInstrumentationAlphaVersion = "1.24.0-alpha-SNAPSHOT" dependencies { implementation("androidx.appcompat:appcompat:1.6.1") diff --git a/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyHttpClientAttributesGetter.java b/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyHttpClientAttributesGetter.java index 213286f14..4d1bce1c3 100644 --- a/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyHttpClientAttributesGetter.java +++ b/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyHttpClientAttributesGetter.java @@ -33,19 +33,19 @@ enum VolleyHttpClientAttributesGetter INSTANCE; @Override - public String url(RequestWrapper requestWrapper) { + public String getUrl(RequestWrapper requestWrapper) { return requestWrapper.getRequest().getUrl(); } @Nullable @Override - public String flavor(RequestWrapper requestWrapper, @Nullable HttpResponse response) { + public String getFlavor(RequestWrapper requestWrapper, @Nullable HttpResponse response) { return null; } @Nullable @Override - public String method(RequestWrapper requestWrapper) { + public String getMethod(RequestWrapper requestWrapper) { Request request = requestWrapper.getRequest(); switch (request.getMethod()) { case Request.Method.GET: @@ -70,7 +70,7 @@ public String method(RequestWrapper requestWrapper) { } @Override - public List requestHeader(RequestWrapper requestWrapper, String name) { + public List getRequestHeader(RequestWrapper requestWrapper, String name) { Request request = requestWrapper.getRequest(); try { Map headers = request.getHeaders(); @@ -95,13 +95,13 @@ private List findCaseInsensitive(String name, Map header } @Override - public Integer statusCode( + public Integer getStatusCode( RequestWrapper requestWrapper, HttpResponse response, @Nullable Throwable error) { return response.getStatusCode(); } @Override - public List responseHeader( + public List getResponseHeader( RequestWrapper requestWrapper, @Nullable HttpResponse response, String name) { if (response == null) { return emptyList(); diff --git a/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyNetClientAttributesGetter.java b/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyNetClientAttributesGetter.java index e0f43e93c..f7375d24e 100644 --- a/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyNetClientAttributesGetter.java +++ b/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyNetClientAttributesGetter.java @@ -26,19 +26,19 @@ enum VolleyNetClientAttributesGetter INSTANCE; @Override - public String transport(RequestWrapper requestWrapper, @Nullable HttpResponse httpResponse) { + public String getTransport(RequestWrapper requestWrapper, @Nullable HttpResponse httpResponse) { return SemanticAttributes.NetTransportValues.IP_TCP; } @Nullable @Override - public String peerName(RequestWrapper requestWrapper) { + public String getPeerName(RequestWrapper requestWrapper) { return UrlParser.getHost(requestWrapper.getRequest().getUrl()); } @Nullable @Override - public Integer peerPort(RequestWrapper requestWrapper) { + public Integer getPeerPort(RequestWrapper requestWrapper) { return UrlParser.getPort(requestWrapper.getRequest().getUrl()); } } diff --git a/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyTracingBuilder.java b/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyTracingBuilder.java index a3dba074c..a313310c4 100644 --- a/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyTracingBuilder.java +++ b/splunk-otel-android-volley/src/main/java/com/splunk/rum/VolleyTracingBuilder.java @@ -26,7 +26,6 @@ import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractorBuilder; import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor; import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor; -import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesExtractor; import java.util.ArrayList; import java.util.List; @@ -41,7 +40,8 @@ public final class VolleyTracingBuilder { private final HttpClientAttributesExtractorBuilder httpClientAttributesExtractorBuilder = HttpClientAttributesExtractor.builder( - VolleyHttpClientAttributesGetter.INSTANCE); + VolleyHttpClientAttributesGetter.INSTANCE, + VolleyNetClientAttributesGetter.INSTANCE); VolleyTracingBuilder(OpenTelemetry openTelemetry) { this.openTelemetry = openTelemetry; @@ -83,8 +83,6 @@ public VolleyTracingBuilder setCapturedResponseHeaders(List responseHead public VolleyTracing build() { VolleyHttpClientAttributesGetter httpAttributesGetter = VolleyHttpClientAttributesGetter.INSTANCE; - VolleyNetClientAttributesGetter netAttributesGetter = - VolleyNetClientAttributesGetter.INSTANCE; SpanStatusExtractor spanStatusExtractor = HttpSpanStatusExtractor.create(httpAttributesGetter); SpanNameExtractor spanNameExtractor = @@ -95,8 +93,6 @@ public VolleyTracing build() { openTelemetry, INSTRUMENTATION_NAME, spanNameExtractor) .setSpanStatusExtractor(spanStatusExtractor) .addAttributesExtractor(httpClientAttributesExtractorBuilder.build()) - .addAttributesExtractor( - NetClientAttributesExtractor.create(netAttributesGetter)) .addAttributesExtractor( new VolleyResponseAttributesExtractor( new ServerTimingHeaderParser())) diff --git a/splunk-otel-android-volley/src/test/java/com/splunk/rum/VolleyHttpClientAttributesGetterTest.java b/splunk-otel-android-volley/src/test/java/com/splunk/rum/VolleyHttpClientAttributesGetterTest.java index bcca85bb1..47be55590 100644 --- a/splunk-otel-android-volley/src/test/java/com/splunk/rum/VolleyHttpClientAttributesGetterTest.java +++ b/splunk-otel-android-volley/src/test/java/com/splunk/rum/VolleyHttpClientAttributesGetterTest.java @@ -57,12 +57,12 @@ public void testRequestHeader() throws Exception { VolleyHttpClientAttributesGetter testClass = VolleyHttpClientAttributesGetter.INSTANCE; - List values = testClass.requestHeader(requestWrapper, "content-type"); + List values = testClass.getRequestHeader(requestWrapper, "content-type"); assertThat(values).containsExactly("application/json"); - List fooValues = testClass.requestHeader(requestWrapper, "FOO"); + List fooValues = testClass.getRequestHeader(requestWrapper, "FOO"); assertThat(fooValues).containsExactly("bar", "baz", "beep"); - List ayeValues = testClass.requestHeader(requestWrapper, "aYe"); + List ayeValues = testClass.getRequestHeader(requestWrapper, "aYe"); assertThat(ayeValues).contains("b", "beeee"); } @@ -81,17 +81,17 @@ public void testResponseHeader() { VolleyHttpClientAttributesGetter testClass = VolleyHttpClientAttributesGetter.INSTANCE; - List values = testClass.responseHeader(request, response, "content-type"); + List values = testClass.getResponseHeader(request, response, "content-type"); assertThat(values).containsExactly("application/json"); - List fooValues = testClass.responseHeader(request, response, "FOO"); + List fooValues = testClass.getResponseHeader(request, response, "FOO"); assertThat(fooValues).containsExactly("bar", "baz"); } @Test public void testNullResponse() { VolleyHttpClientAttributesGetter testClass = VolleyHttpClientAttributesGetter.INSTANCE; - List values = testClass.responseHeader(null, null, "content-type"); + List values = testClass.getResponseHeader(null, null, "content-type"); assertThat(values).isEmpty(); } } diff --git a/splunk-otel-android/build.gradle.kts b/splunk-otel-android/build.gradle.kts index 2274d7a71..3bbdbdc3f 100644 --- a/splunk-otel-android/build.gradle.kts +++ b/splunk-otel-android/build.gradle.kts @@ -44,7 +44,7 @@ android { val otelVersion = "1.23.1" val otelAlphaVersion = "$otelVersion-alpha" -val otelInstrumentationAlphaVersion = "1.23.0-alpha" +val otelInstrumentationAlphaVersion = "1.24.0-alpha-SNAPSHOT" dependencies { implementation("androidx.appcompat:appcompat:1.6.1")