From b98bc6ede0202aa45a80e31bd6cebc4d5daa814a Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Fri, 27 Aug 2021 16:32:43 +0200 Subject: [PATCH 1/4] Add error parameter to EndTimeExtractor and AttributesExtractor#onEnd() --- .../MethodSpanAttributesExtractor.java | 5 +++- .../api/instrumenter/AttributesExtractor.java | 17 +++++++----- .../api/instrumenter/EndTimeExtractor.java | 2 +- .../api/instrumenter/Instrumenter.java | 17 ++++++------ .../api/instrumenter/RequestListener.java | 4 +-- .../api/instrumenter/ServerInstrumenter.java | 5 +++- .../code/CodeAttributesExtractor.java | 5 +++- .../db/DbAttributesExtractor.java | 5 +++- .../http/HttpAttributesExtractor.java | 5 +++- .../instrumenter/http/HttpClientMetrics.java | 6 ++--- .../instrumenter/http/HttpServerMetrics.java | 8 +++--- .../MessagingAttributesExtractor.java | 5 +++- .../net/NetAttributesExtractor.java | 5 +++- .../rpc/RpcAttributesExtractor.java | 5 +++- .../instrumenter/AttributesExtractorTest.java | 27 +++++++++++++++---- .../api/instrumenter/InstrumenterTest.java | 13 ++++++--- .../code/CodeAttributesExtractorTest.java | 2 +- .../db/DbAttributesExtractorTest.java | 2 +- .../db/SqlAttributesExtractorTest.java | 2 +- .../http/HttpAttributesExtractorTest.java | 2 +- .../MessagingAttributesExtractorTest.java | 4 +-- ...cketAddressNetAttributesExtractorTest.java | 6 ++--- .../net/NetAttributesExtractorTest.java | 2 +- .../rpc/RpcAttributesExtractorTest.java | 2 +- ...tpClientAdditionalAttributesExtractor.java | 5 +++- .../v3_0/CassandraKeyspaceExtractor.java | 6 ++++- .../v4_0/CassandraAttributesExtractor.java | 3 ++- .../grpc/v1_6/GrpcAttributesExtractor.java | 6 ++++- .../ExperimentalAttributesExtractor.java | 5 +++- .../instrumentation/jms/JmsSingletons.java | 3 ++- ...ProducerAdditionalAttributesExtractor.java | 5 +++- ...ConsumerAdditionalAttributesExtractor.java | 5 +++- ...nsumerExperimentalAttributesExtractor.java | 5 +++- .../LettuceConnectAttributesExtractor.java | 4 ++- .../LettuceConnectAttributesExtractor.java | 4 ++- .../ExperimentalAttributesExtractor.java | 6 ++++- .../ModelAndViewAttributesExtractor.java | 5 +++- .../PeerServiceAttributesExtractor.java | 9 +++++-- .../PeerServiceAttributesExtractorTest.java | 10 +++---- 39 files changed, 164 insertions(+), 73 deletions(-) diff --git a/instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/MethodSpanAttributesExtractor.java b/instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/MethodSpanAttributesExtractor.java index ac24f517a5a2..f4c566669bc3 100644 --- a/instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/MethodSpanAttributesExtractor.java +++ b/instrumentation-api-annotation-support/src/main/java/io/opentelemetry/instrumentation/api/annotation/support/MethodSpanAttributesExtractor.java @@ -57,7 +57,10 @@ protected void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) {} + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) {} /** * Creates a binding of the parameters of the traced method to span attributes. diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java index 5caa1900f3a9..d126970a1eef 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractor.java @@ -15,10 +15,10 @@ /** * Extractor of {@link io.opentelemetry.api.common.Attributes} for a given request and response. * Will be called {@linkplain #onStart(AttributesBuilder, Object) on start} with just the {@link - * REQUEST} and again {@linkplain #onEnd(AttributesBuilder, Object, Object) on end} with both {@link - * REQUEST} and {@link RESPONSE} to allow populating attributes at each stage of a request's - * lifecycle. It is best to populate as much as possible in {@link #onStart(AttributesBuilder, - * Object)} to have it available during sampling. + * REQUEST} and again {@linkplain #onEnd(AttributesBuilder, Object, Object, Throwable) on end} with + * both {@link REQUEST} and {@link RESPONSE} to allow populating attributes at each stage of a + * request's lifecycle. It is best to populate as much as possible in {@link + * #onStart(AttributesBuilder, Object)} to have it available during sampling. * * @see DbAttributesExtractor * @see HttpAttributesExtractor @@ -32,11 +32,14 @@ public abstract class AttributesExtractor { protected abstract void onStart(AttributesBuilder attributes, REQUEST request); /** - * Extracts attributes from the {@link REQUEST} and {@link RESPONSE} into the {@link - * AttributesBuilder} at the end of a request. + * Extracts attributes from the {@link REQUEST} and either {@link RESPONSE} or {@code error} into + * the {@link AttributesBuilder} at the end of a request. */ protected abstract void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response); + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error); /** * Sets the {@code value} with the given {@code key} to the {@link AttributesBuilder} if {@code diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/EndTimeExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/EndTimeExtractor.java index 79f0d8b64fa9..2e4cfdaa6c36 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/EndTimeExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/EndTimeExtractor.java @@ -17,5 +17,5 @@ public interface EndTimeExtractor { /** Returns the timestamp marking the end of the response processing. */ - Instant extract(REQUEST request, @Nullable RESPONSE response); + Instant extract(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error); } diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java index 188a82878bd1..4143a0408dcd 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java @@ -165,30 +165,29 @@ public void end( Context context, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error) { Span span = Span.fromContext(context); + if (error != null) { + error = errorCauseExtractor.extractCause(error); + span.recordException(error); + } + UnsafeAttributes attributesBuilder = new UnsafeAttributes(); for (AttributesExtractor extractor : attributesExtractors) { - extractor.onEnd(attributesBuilder, request, response); + extractor.onEnd(attributesBuilder, request, response, error); } Attributes attributes = attributesBuilder; + span.setAllAttributes(attributes); for (RequestListener requestListener : requestListeners) { requestListener.end(context, attributes); } - span.setAllAttributes(attributes); - - if (error != null) { - error = errorCauseExtractor.extractCause(error); - span.recordException(error); - } - StatusCode statusCode = spanStatusExtractor.extract(request, response, error); if (statusCode != StatusCode.UNSET) { span.setStatus(statusCode); } if (endTimeExtractor != null) { - span.end(endTimeExtractor.extract(request, response)); + span.end(endTimeExtractor.extract(request, response, error)); } else { span.end(); } diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/RequestListener.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/RequestListener.java index ef8468ed7459..eaa56295ac01 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/RequestListener.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/RequestListener.java @@ -21,8 +21,8 @@ public interface RequestListener { * the start and end of the request, e.g., an in-progress span, it should be added to the passed * in {@link Context} and returned. */ - Context start(Context context, Attributes requestAttributes); + Context start(Context context, Attributes startAttributes); /** Listener method that is called at the end of a request. */ - void end(Context context, Attributes responseAttributes); + void end(Context context, Attributes endAttributes); } diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/ServerInstrumenter.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/ServerInstrumenter.java index 6a725c5db909..f988a3710928 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/ServerInstrumenter.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/ServerInstrumenter.java @@ -73,7 +73,10 @@ protected void onStart(AttributesBuilder attributes, REQUEST request) {} @Override protected void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) { + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) { String clientIp = getForwardedClientIp(request); if (clientIp == null && netAttributesExtractor != null) { clientIp = netAttributesExtractor.peerIp(request, response); diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java index 06df0d279733..151b0e84539d 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractor.java @@ -31,7 +31,10 @@ protected final void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected final void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) {} + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) {} @Nullable protected abstract Class codeClass(REQUEST request); diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractor.java index c05e5957af31..d32ecfde61fe 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractor.java @@ -33,7 +33,10 @@ protected void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected final void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) {} + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) {} @Nullable protected abstract String system(REQUEST request); diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractor.java index 854ff7094b1f..b28d17967b21 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractor.java @@ -37,7 +37,10 @@ protected final void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected final void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) { + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) { set( attributes, SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH, diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java index bef2d7aa10f4..85fb64621c0e 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientMetrics.java @@ -60,16 +60,16 @@ private HttpClientMetrics(Meter meter) { } @Override - public Context start(Context context, Attributes requestAttributes) { + public Context start(Context context, Attributes startAttributes) { long startTimeNanos = System.nanoTime(); return context.with( HTTP_CLIENT_REQUEST_METRICS_STATE, - new AutoValue_HttpClientMetrics_State(requestAttributes, startTimeNanos)); + new AutoValue_HttpClientMetrics_State(startAttributes, startTimeNanos)); } @Override - public void end(Context context, Attributes responseAttributes) { + public void end(Context context, Attributes endAttributes) { State state = context.get(HTTP_CLIENT_REQUEST_METRICS_STATE); if (state == null) { logger.debug( diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java index 63891ffc7a60..401e33284cc0 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerMetrics.java @@ -70,17 +70,17 @@ private HttpServerMetrics(Meter meter) { } @Override - public Context start(Context context, Attributes requestAttributes) { + public Context start(Context context, Attributes startAttributes) { long startTimeNanos = System.nanoTime(); - activeRequests.add(1, applyActiveRequestsView(requestAttributes)); + activeRequests.add(1, applyActiveRequestsView(startAttributes)); return context.with( HTTP_SERVER_REQUEST_METRICS_STATE, - new AutoValue_HttpServerMetrics_State(requestAttributes, startTimeNanos)); + new AutoValue_HttpServerMetrics_State(startAttributes, startTimeNanos)); } @Override - public void end(Context context, Attributes responseAttributes) { + public void end(Context context, Attributes endAttributes) { State state = context.get(HTTP_SERVER_REQUEST_METRICS_STATE); if (state == null) { logger.debug( diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java index 78cce07313aa..5b7e370951ab 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractor.java @@ -54,7 +54,10 @@ protected final void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected final void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) { + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) { set(attributes, SemanticAttributes.MESSAGING_MESSAGE_ID, messageId(request, response)); } diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java index 9fb03c66f9cc..f0cf96e95544 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractor.java @@ -32,7 +32,10 @@ protected final void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected final void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) { + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) { set(attributes, SemanticAttributes.NET_PEER_IP, peerIp(request, response)); set(attributes, SemanticAttributes.NET_PEER_NAME, peerName(request, response)); Integer peerPort = peerPort(request, response); diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractor.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractor.java index 8e1216918a61..d79b70263e09 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractor.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractor.java @@ -31,7 +31,10 @@ protected final void onStart(AttributesBuilder attributes, REQUEST request) { @Override protected final void onEnd( - AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) { + AttributesBuilder attributes, + REQUEST request, + @Nullable RESPONSE response, + @Nullable Throwable error) { // No response attributes } diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractorTest.java index e07eab2e697d..a290bbe7bb13 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/AttributesExtractorTest.java @@ -13,6 +13,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import java.util.HashMap; import java.util.Map; +import javax.annotation.Nullable; import org.junit.jupiter.api.Test; class AttributesExtractorTest { @@ -28,23 +29,39 @@ protected void onStart(AttributesBuilder attributes, Map request @Override protected void onEnd( - AttributesBuilder attributes, Map request, Map response) { - set(attributes, AttributeKey.stringKey("food"), response.get("food")); - set(attributes, AttributeKey.stringKey("number"), request.get("number")); + AttributesBuilder attributes, + Map request, + @Nullable Map response, + @Nullable Throwable error) { + if (response != null) { + set(attributes, AttributeKey.stringKey("food"), response.get("food")); + set(attributes, AttributeKey.stringKey("number"), request.get("number")); + } + if (error != null) { + set(attributes, AttributeKey.stringKey("full_error_class"), error.getClass().getName()); + } } } @Test void normal() { TestAttributesExtractor extractor = new TestAttributesExtractor(); + Map request = new HashMap<>(); request.put("animal", "cat"); Map response = new HashMap<>(); response.put("food", "pizza"); + Exception error = new RuntimeException(); + AttributesBuilder attributesBuilder = Attributes.builder(); extractor.onStart(attributesBuilder, request); - extractor.onEnd(attributesBuilder, request, response); + extractor.onEnd(attributesBuilder, request, response, null); + extractor.onEnd(attributesBuilder, request, null, error); + assertThat(attributesBuilder.build()) - .containsOnly(attributeEntry("animal", "cat"), attributeEntry("food", "pizza")); + .containsOnly( + attributeEntry("animal", "cat"), + attributeEntry("food", "pizza"), + attributeEntry("full_error_class", "java.lang.RuntimeException")); } } diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java index 9c60dbd13efb..ac6cdaf4dec8 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterTest.java @@ -37,6 +37,7 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nullable; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.RegisterExtension; @@ -80,7 +81,10 @@ protected void onStart(AttributesBuilder attributes, Map request @Override protected void onEnd( - AttributesBuilder attributes, Map request, Map response) { + AttributesBuilder attributes, + Map request, + Map response, + @Nullable Throwable error) { attributes.put("resp1", response.get("resp1")); attributes.put("resp2", response.get("resp2")); } @@ -97,7 +101,10 @@ protected void onStart(AttributesBuilder attributes, Map request @Override protected void onEnd( - AttributesBuilder attributes, Map request, Map response) { + AttributesBuilder attributes, + Map request, + Map response, + @Nullable Throwable error) { attributes.put("resp3", response.get("resp3")); attributes.put("resp2", response.get("resp2_2")); } @@ -490,7 +497,7 @@ void shouldStartSpanWithGivenStartTime() { Instrumenter instrumenter = Instrumenter.newBuilder( otelTesting.getOpenTelemetry(), "test", request -> "test span") - .setTimeExtractors(request -> request, (request, response) -> response) + .setTimeExtractors(request -> request, (request, response, error) -> response) .newInstrumenter(); Instant startTime = Instant.ofEpochSecond(100); diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java index 6c68bb9270b8..36d9f2bf370f 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/code/CodeAttributesExtractorTest.java @@ -61,7 +61,7 @@ void shouldExtractAllAttributes() { underTest.onStart(startAttributes, request); AttributesBuilder endAttributes = Attributes.builder(); - underTest.onEnd(endAttributes, request, null); + underTest.onEnd(endAttributes, request, null, null); // then assertThat(startAttributes.build()) diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractorTest.java index 1ef4ec938ff2..c4cc80156ca7 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/DbAttributesExtractorTest.java @@ -66,7 +66,7 @@ void shouldExtractAllAvailableAttributes() { underTest.onStart(startAttributes, request); AttributesBuilder endAttributes = Attributes.builder(); - underTest.onEnd(endAttributes, request, null); + underTest.onEnd(endAttributes, request, null, null); // then assertThat(startAttributes.build()) diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlAttributesExtractorTest.java index 8c4d3acb759d..5bfc535969c8 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/db/SqlAttributesExtractorTest.java @@ -70,7 +70,7 @@ void shouldExtractAllAttributes() { underTest.onStart(startAttributes, request); AttributesBuilder endAttributes = Attributes.builder(); - underTest.onEnd(endAttributes, request, null); + underTest.onEnd(endAttributes, request, null, null); // then assertThat(startAttributes.build()) diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractorTest.java index e063652c23a5..fec1c2fefdf7 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpAttributesExtractorTest.java @@ -127,7 +127,7 @@ void normal() { entry(SemanticAttributes.HTTP_SCHEME, "https"), entry(SemanticAttributes.HTTP_USER_AGENT, "okhttp 3.x")); - extractor.onEnd(attributes, request, response); + extractor.onEnd(attributes, request, response, null); assertThat(attributes.build()) .containsOnly( entry(SemanticAttributes.HTTP_METHOD, "POST"), diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java index 8e33a25c75ca..47f6eb06b113 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/messaging/MessagingAttributesExtractorTest.java @@ -120,7 +120,7 @@ void shouldExtractAllAvailableAttributes( underTest.onStart(startAttributes, request); AttributesBuilder endAttributes = Attributes.builder(); - underTest.onEnd(endAttributes, request, "42"); + underTest.onEnd(endAttributes, request, "42", null); // then List, Object>> expectedEntries = new ArrayList<>(); @@ -168,7 +168,7 @@ void shouldExtractNoAttributesIfNoneAreAvailable() { underTest.onStart(startAttributes, Collections.emptyMap()); AttributesBuilder endAttributes = Attributes.builder(); - underTest.onEnd(endAttributes, Collections.emptyMap(), null); + underTest.onEnd(endAttributes, Collections.emptyMap(), null, null); // then assertThat(startAttributes.build().isEmpty()).isTrue(); diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractorTest.java index 292441d223be..407273e0a27d 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetAttributesExtractorTest.java @@ -38,7 +38,7 @@ public String transport(InetSocketAddress inetSocketAddress) { void noInetSocketAddress() { AttributesBuilder attributes = Attributes.builder(); extractor.onStart(attributes, null); - extractor.onEnd(attributes, null, null); + extractor.onEnd(attributes, null, null, null); assertThat(attributes.build()) .containsOnly( entry(SemanticAttributes.NET_TRANSPORT, SemanticAttributes.NetTransportValues.IP_TCP)); @@ -55,7 +55,7 @@ void fullAddress() { extractor.onStart(startAttributes, address); AttributesBuilder endAttributes = Attributes.builder(); - extractor.onEnd(endAttributes, null, address); + extractor.onEnd(endAttributes, null, address, null); // then assertThat(startAttributes.build()) @@ -83,7 +83,7 @@ void unresolved() { extractor.onStart(startAttributes, address); AttributesBuilder endAttributes = Attributes.builder(); - extractor.onEnd(endAttributes, null, address); + extractor.onEnd(endAttributes, null, address, null); // then assertThat(startAttributes.build()) diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractorTest.java index a81a2e5ae9e8..e90c72a1e0f8 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributesExtractorTest.java @@ -71,7 +71,7 @@ void normal() { extractor.onStart(startAttributes, request); AttributesBuilder endAttributes = Attributes.builder(); - extractor.onEnd(endAttributes, request, response); + extractor.onEnd(endAttributes, request, response, null); // then assertThat(startAttributes.build()) diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java index 0050c9c275d1..7b2e698f2f1b 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/rpc/RpcAttributesExtractorTest.java @@ -49,7 +49,7 @@ void normal() { entry(SemanticAttributes.RPC_SYSTEM, "test"), entry(SemanticAttributes.RPC_SERVICE, "my.Service"), entry(SemanticAttributes.RPC_METHOD, "Method")); - extractor.onEnd(attributes, request, null); + extractor.onEnd(attributes, request, null, null); assertThat(attributes.build()) .containsOnly( entry(SemanticAttributes.RPC_SYSTEM, "test"), diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java index 3a727c9e822f..a04fbd27ee01 100644 --- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java +++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientAdditionalAttributesExtractor.java @@ -20,7 +20,10 @@ protected void onStart(AttributesBuilder attributes, RequestContext requestConte @Override protected void onEnd( - AttributesBuilder attributes, RequestContext requestContext, @Nullable Response response) { + AttributesBuilder attributes, + RequestContext requestContext, + @Nullable Response response, + @Nullable Throwable error) { NettyRequest nettyRequest = requestContext.getNettyRequest(); if (nettyRequest != null) { set( diff --git a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraKeyspaceExtractor.java b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraKeyspaceExtractor.java index 2f9c0ee6a93c..eab3162b1f33 100644 --- a/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraKeyspaceExtractor.java +++ b/instrumentation/cassandra/cassandra-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraKeyspaceExtractor.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import org.checkerframework.checker.nullness.qual.Nullable; final class CassandraKeyspaceExtractor extends AttributesExtractor { @@ -21,5 +22,8 @@ protected void onStart(AttributesBuilder attributes, CassandraRequest request) { @Override protected void onEnd( - AttributesBuilder attributes, CassandraRequest request, ExecutionInfo executionInfo) {} + AttributesBuilder attributes, + CassandraRequest request, + ExecutionInfo executionInfo, + @Nullable Throwable error) {} } diff --git a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraAttributesExtractor.java b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraAttributesExtractor.java index 03f0f956cd90..d2942a78eb34 100644 --- a/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraAttributesExtractor.java +++ b/instrumentation/cassandra/cassandra-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/cassandra/v4_0/CassandraAttributesExtractor.java @@ -31,7 +31,8 @@ protected void onStart(AttributesBuilder attributes, CassandraRequest request) { protected void onEnd( AttributesBuilder attributes, CassandraRequest request, - @Nullable ExecutionInfo executionInfo) { + @Nullable ExecutionInfo executionInfo, + @Nullable Throwable error) { if (executionInfo == null) { return; } diff --git a/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java b/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java index 9372a9fc7819..3ed94010f1b9 100644 --- a/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java +++ b/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcAttributesExtractor.java @@ -18,7 +18,11 @@ protected void onStart(AttributesBuilder attributes, GrpcRequest grpcRequest) { } @Override - protected void onEnd(AttributesBuilder attributes, GrpcRequest request, @Nullable Status status) { + protected void onEnd( + AttributesBuilder attributes, + GrpcRequest request, + @Nullable Status status, + @Nullable Throwable error) { if (status != null) { attributes.put(SemanticAttributes.RPC_GRPC_STATUS_CODE, status.getCode().value()); } diff --git a/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/ExperimentalAttributesExtractor.java b/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/ExperimentalAttributesExtractor.java index 62954d7aa4c8..3082e969f198 100644 --- a/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/ExperimentalAttributesExtractor.java +++ b/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/ExperimentalAttributesExtractor.java @@ -32,5 +32,8 @@ protected void onStart(AttributesBuilder attributes, HystrixRequest hystrixReque @Override protected void onEnd( - AttributesBuilder attributes, HystrixRequest hystrixRequest, @Nullable Void unused) {} + AttributesBuilder attributes, + HystrixRequest hystrixRequest, + @Nullable Void unused, + @Nullable Throwable error) {} } diff --git a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java index 3a92f9957be6..07c9a9e7ebb1 100644 --- a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java +++ b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java @@ -36,7 +36,8 @@ public final class JmsSingletons { otel, INSTRUMENTATION_NAME, spanNameExtractor) .addAttributesExtractor(attributesExtractor) .setTimeExtractors( - MessageWithDestination::startTime, (request, response) -> request.endTime()) + MessageWithDestination::getStartTime, + (request, response, error) -> request.endTime()) .newInstrumenter(SpanKindExtractor.alwaysConsumer()); LISTENER_INSTRUMENTER = Instrumenter.newBuilder( diff --git a/instrumentation/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerAdditionalAttributesExtractor.java b/instrumentation/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerAdditionalAttributesExtractor.java index eab2db4982b1..1a83c7c862ee 100644 --- a/instrumentation/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerAdditionalAttributesExtractor.java +++ b/instrumentation/kafka-clients/kafka-clients-0.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafkaclients/KafkaProducerAdditionalAttributesExtractor.java @@ -26,5 +26,8 @@ protected void onStart(AttributesBuilder attributes, ProducerRecord produc @Override protected void onEnd( - AttributesBuilder attributes, ProducerRecord producerRecord, @Nullable Void unused) {} + AttributesBuilder attributes, + ProducerRecord producerRecord, + @Nullable Void unused, + @Nullable Throwable error) {} } diff --git a/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerAdditionalAttributesExtractor.java b/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerAdditionalAttributesExtractor.java index d1ec09f07b04..9cbb7047cea4 100644 --- a/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerAdditionalAttributesExtractor.java +++ b/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerAdditionalAttributesExtractor.java @@ -26,5 +26,8 @@ protected void onStart(AttributesBuilder attributes, ConsumerRecord consum @Override protected void onEnd( - AttributesBuilder attributes, ConsumerRecord consumerRecord, @Nullable Void unused) {} + AttributesBuilder attributes, + ConsumerRecord consumerRecord, + @Nullable Void unused, + @Nullable Throwable error) {} } diff --git a/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerExperimentalAttributesExtractor.java b/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerExperimentalAttributesExtractor.java index 619cde564bde..a7c1b768e96c 100644 --- a/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerExperimentalAttributesExtractor.java +++ b/instrumentation/kafka-clients/kafka-clients-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kafka/KafkaConsumerExperimentalAttributesExtractor.java @@ -47,5 +47,8 @@ protected void onStart(AttributesBuilder attributes, ConsumerRecord consum @Override protected void onEnd( - AttributesBuilder attributes, ConsumerRecord consumerRecord, @Nullable Void unused) {} + AttributesBuilder attributes, + ConsumerRecord consumerRecord, + @Nullable Void unused, + @Nullable Throwable error) {} } diff --git a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectAttributesExtractor.java b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectAttributesExtractor.java index 2eebf0f8bf69..2d1f6f0916aa 100644 --- a/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectAttributesExtractor.java +++ b/instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceConnectAttributesExtractor.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import org.checkerframework.checker.nullness.qual.Nullable; final class LettuceConnectAttributesExtractor extends AttributesExtractor { @@ -23,5 +24,6 @@ protected void onStart(AttributesBuilder attributes, RedisURI redisUri) { } @Override - protected void onEnd(AttributesBuilder attributes, RedisURI redisUri, Void unused) {} + protected void onEnd( + AttributesBuilder attributes, RedisURI redisUri, Void unused, @Nullable Throwable error) {} } diff --git a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectAttributesExtractor.java b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectAttributesExtractor.java index a41f2a4f83cb..1e6e444e9037 100644 --- a/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectAttributesExtractor.java +++ b/instrumentation/lettuce/lettuce-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/LettuceConnectAttributesExtractor.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import org.checkerframework.checker.nullness.qual.Nullable; final class LettuceConnectAttributesExtractor extends AttributesExtractor { @@ -23,5 +24,6 @@ protected void onStart(AttributesBuilder attributes, RedisURI redisUri) { } @Override - protected void onEnd(AttributesBuilder attributes, RedisURI redisUri, Void unused) {} + protected void onEnd( + AttributesBuilder attributes, RedisURI redisUri, Void unused, @Nullable Throwable error) {} } diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/ExperimentalAttributesExtractor.java b/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/ExperimentalAttributesExtractor.java index dc8ac1b2bd43..409f7ee08759 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/ExperimentalAttributesExtractor.java +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/ExperimentalAttributesExtractor.java @@ -22,7 +22,11 @@ protected void onStart(AttributesBuilder attributes, Object handler) { } @Override - protected void onEnd(AttributesBuilder attributes, Object handler, @Nullable Void unused) {} + protected void onEnd( + AttributesBuilder attributes, + Object handler, + @Nullable Void unused, + @Nullable Throwable error) {} private static String getHandlerType(Object handler) { if (handler instanceof HandlerMethod) { diff --git a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/ModelAndViewAttributesExtractor.java b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/ModelAndViewAttributesExtractor.java index c803563d3381..0c151c548fa5 100644 --- a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/ModelAndViewAttributesExtractor.java +++ b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/ModelAndViewAttributesExtractor.java @@ -32,5 +32,8 @@ protected void onStart(AttributesBuilder attributes, ModelAndView modelAndView) @Override protected void onEnd( - AttributesBuilder attributes, ModelAndView modelAndView, @Nullable Void unused) {} + AttributesBuilder attributes, + ModelAndView modelAndView, + @Nullable Void unused, + @Nullable Throwable error) {} } diff --git a/javaagent-instrumentation-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java b/javaagent-instrumentation-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java index 183e065598d0..07503798eddb 100644 --- a/javaagent-instrumentation-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java +++ b/javaagent-instrumentation-api/src/main/java/io/opentelemetry/javaagent/instrumentation/api/instrumenter/PeerServiceAttributesExtractor.java @@ -11,6 +11,7 @@ import io.opentelemetry.instrumentation.api.instrumenter.net.NetAttributesExtractor; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Extractor of the {@code peer.service} span attribute, described in PeerServiceAttributesExtractor Date: Tue, 31 Aug 2021 08:59:13 +0200 Subject: [PATCH 2/4] fix compilation failure --- .../javaagent/instrumentation/jms/JmsSingletons.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java index 07c9a9e7ebb1..f100e77c548d 100644 --- a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java +++ b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java @@ -36,7 +36,7 @@ public final class JmsSingletons { otel, INSTRUMENTATION_NAME, spanNameExtractor) .addAttributesExtractor(attributesExtractor) .setTimeExtractors( - MessageWithDestination::getStartTime, + MessageWithDestination::startTime, (request, response, error) -> request.endTime()) .newInstrumenter(SpanKindExtractor.alwaysConsumer()); LISTENER_INSTRUMENTER = From 4ac1ea2b4c5619139093d28268bb8fbfbc0fd7e5 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Tue, 31 Aug 2021 10:42:12 +0200 Subject: [PATCH 3/4] spotless --- .../javaagent/instrumentation/jms/JmsSingletons.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java index f100e77c548d..7be47e9a83db 100644 --- a/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java +++ b/instrumentation/jms-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/JmsSingletons.java @@ -36,8 +36,7 @@ public final class JmsSingletons { otel, INSTRUMENTATION_NAME, spanNameExtractor) .addAttributesExtractor(attributesExtractor) .setTimeExtractors( - MessageWithDestination::startTime, - (request, response, error) -> request.endTime()) + MessageWithDestination::startTime, (request, response, error) -> request.endTime()) .newInstrumenter(SpanKindExtractor.alwaysConsumer()); LISTENER_INSTRUMENTER = Instrumenter.newBuilder( From 757a92a7ea4de2f0b8ed8447a1be188bb759ae06 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Wed, 8 Sep 2021 12:12:48 +0200 Subject: [PATCH 4/4] fixed merge conflict --- .../KubernetesExperimentalAttributesExtractor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesExperimentalAttributesExtractor.java b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesExperimentalAttributesExtractor.java index 9bc21e36b3e9..5c78f21fa984 100644 --- a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesExperimentalAttributesExtractor.java +++ b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesExperimentalAttributesExtractor.java @@ -23,5 +23,8 @@ protected void onStart(AttributesBuilder attributes, Request request) { @Override protected void onEnd( - AttributesBuilder attributes, Request request, @Nullable ApiResponse apiResponse) {} + AttributesBuilder attributes, + Request request, + @Nullable ApiResponse apiResponse, + @Nullable Throwable error) {} }