Skip to content

Commit 67df933

Browse files
otelbot[bot]Copilottrask
authored
Review fixes for jaxws-metro-2.2:javaagent (#18150)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: trask <218610+trask@users.noreply.github.com>
1 parent 5ea99d5 commit 67df933

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

instrumentation/jaxws/jaxws-metro-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroServerSpanNameUpdater.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.LinkedHashMap;
1818
import java.util.Map;
1919
import java.util.logging.Logger;
20+
import javax.annotation.Nullable;
2021
import javax.xml.namespace.QName;
2122

2223
final class MetroServerSpanNameUpdater {
@@ -73,9 +74,6 @@ private void registerHttpServletRequestAdapter(
7374

7475
public void updateServerSpanName(Context context, MetroRequest metroRequest) {
7576
String spanName = metroRequest.spanName();
76-
if (spanName == null) {
77-
return;
78-
}
7977

8078
Span serverSpan = LocalRootSpan.fromContextOrNull(context);
8179
if (serverSpan == null) {
@@ -141,14 +139,17 @@ boolean canHandle(Object httpServletRequest) {
141139
return httpServletRequestClass.isInstance(httpServletRequest);
142140
}
143141

142+
@Nullable
144143
String getServletPath(Object httpServletRequest) {
145144
return invokeSafely(getServletPathMethodHandle, httpServletRequest);
146145
}
147146

147+
@Nullable
148148
String getPathInfo(Object httpServletRequest) {
149149
return invokeSafely(getPathInfoMethodHandle, httpServletRequest);
150150
}
151151

152+
@Nullable
152153
private static String invokeSafely(MethodHandle methodHandle, Object httpServletRequest) {
153154
try {
154155
return (String) methodHandle.invoke(httpServletRequest);

instrumentation/jaxws/jaxws-metro-2.2/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ features:
88
- CONTROLLER_SPANS
99
configurations:
1010
- name: otel.instrumentation.common.experimental.controller-telemetry.enabled
11+
declarative_name: java.common.controller_telemetry/development.enabled
1112
description: Enables the creation of experimental controller spans.
1213
type: boolean
1314
default: false

0 commit comments

Comments
 (0)