Skip to content

Commit 7cfee29

Browse files
otelbot[bot]trask
andauthored
Code review sweep (run 25255576018) (open-telemetry#18510)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent 740e692 commit 7cfee29

12 files changed

Lines changed: 26 additions & 23 deletions

File tree

instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class SpringSchedulingTest {
4848
@RegisterExtension
4949
private static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
5050

51-
@RegisterExtension static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
51+
@RegisterExtension
52+
private static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
5253

5354
@Test
5455
void scheduleOneTimeTest() throws InterruptedException {

instrumentation/spring/spring-security-config-6.0/library/src/main/java/io/opentelemetry/instrumentation/spring/security/config/v6_0/EnduserAttributesCapturer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ public void captureEnduserAttributes(
8383
if (enduserRoleEnabled || enduserScopeEnabled) {
8484
for (GrantedAuthority authority : authentication.getAuthorities()) {
8585
String authorityString = authority.getAuthority();
86+
if (authorityString == null) {
87+
continue;
88+
}
8689
if (enduserRoleEnabled && authorityString.startsWith(roleGrantedAuthorityPrefix)) {
8790
roleBuilder = appendSuffix(roleGrantedAuthorityPrefix, authorityString, roleBuilder);
8891
} else if (enduserScopeEnabled

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ tasks {
7474
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
7575
jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
7676

77-
systemProperty("metadataConfig", "otel.instrumentation.common.experimental.controller-telemetry.enabled")
77+
systemProperty("metadataConfig", "otel.instrumentation.common.experimental.controller-telemetry.enabled=true")
7878
systemProperty("testLatestDeps", otelProps.testLatestDeps)
7979
systemProperty("collectMetadata", otelProps.collectMetadata)
8080
}
@@ -85,7 +85,7 @@ tasks {
8585
jvmArgs("-Dotel.semconv-stability.opt-in=service.peer")
8686
systemProperty(
8787
"metadataConfig",
88-
"otel.instrumentation.common.experimental.controller-telemetry.enabled," +
88+
"otel.instrumentation.common.experimental.controller-telemetry.enabled=true," +
8989
"otel.semconv-stability.opt-in=service.peer"
9090
)
9191
}

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/DispatcherHandlerInstrumentation.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ public void transform(TypeTransformer transformer) {
4444
public static class HandleAdvice {
4545

4646
@AssignReturned.ToReturned
47-
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
47+
@Advice.OnMethodExit(suppress = Throwable.class, inline = false)
4848
public static Mono<Void> methodExit(
49-
@Advice.Thrown Throwable throwable,
50-
@Advice.Argument(0) ServerWebExchange exchange,
51-
@Advice.Return Mono<Void> originalMono) {
49+
@Advice.Argument(0) ServerWebExchange exchange, @Advice.Return Mono<Void> originalMono) {
5250
Mono<Void> mono = originalMono;
5351
if (mono != null) {
5452
// note: it seems like this code should go in @OnMethodExit of

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/HandlerCodeAttributesGetter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import io.opentelemetry.instrumentation.api.incubator.semconv.code.CodeAttributesGetter;
99
import org.springframework.web.method.HandlerMethod;
1010

11-
public class HandlerCodeAttributesGetter implements CodeAttributesGetter<Object> {
11+
class HandlerCodeAttributesGetter implements CodeAttributesGetter<Object> {
1212
@Override
1313
public Class<?> getCodeClass(Object handler) {
1414
if (handler instanceof HandlerMethod) {

instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/v5_0/server/WebfluxSpanNameExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import io.opentelemetry.instrumentation.api.semconv.util.SpanNames;
1111
import org.springframework.web.method.HandlerMethod;
1212

13-
public class WebfluxSpanNameExtractor implements SpanNameExtractor<Object> {
13+
class WebfluxSpanNameExtractor implements SpanNameExtractor<Object> {
1414

1515
private final SpanNameExtractor<Object> handlerSpanNameExtractor =
1616
CodeSpanNameExtractor.create(new HandlerCodeAttributesGetter());

instrumentation/spring/spring-webflux/spring-webflux-5.0/testing-webflux7/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ otelJava {
2222
minJavaVersionSupported.set(JavaVersion.VERSION_17)
2323
}
2424

25-
tasks.withType<Test>().configureEach {
25+
tasks.test {
2626
jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true")
2727
}

instrumentation/spring/spring-webflux/spring-webflux-5.0/testing/src/main/java/server/SpringWebFluxTestApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ RouterFunction<ServerResponse> greetRouterFunction(GreetingHandler greetingHandl
7878
try {
7979
slowRequestLatch.await(10, SECONDS);
8080
} catch (InterruptedException e) {
81+
Thread.currentThread().interrupt();
8182
throw new IllegalStateException(e);
8283
}
8384
return Mono.delay(Duration.ofMillis(100))

instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/WebfluxServerHttpAttributesGetter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ private static Integer getStatusCode(ServerHttpResponse response) {
6666
if (GET_RAW_STATUS_CODE != null) {
6767
try {
6868
return (Integer) GET_RAW_STATUS_CODE.invoke(response);
69-
} catch (Throwable e) {
69+
} catch (Throwable ignored) {
7070
// ignore
7171
}
7272
}
7373
if (GET_STATUS_CODE != null && STATUS_CODE_VALUE != null) {
7474
try {
7575
Object statusCode = GET_STATUS_CODE.invoke(response);
7676
return (Integer) STATUS_CODE_VALUE.invoke(statusCode);
77-
} catch (Throwable e) {
77+
} catch (Throwable ignored) {
7878
// ignore
7979
}
8080
}

instrumentation/spring/spring-webflux/spring-webflux-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/v5_3/internal/HeaderUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public final class HeaderUtil {
4343
headerNames =
4444
MethodHandles.lookup()
4545
.findVirtual(HttpHeaders.class, "headerNames", MethodType.methodType(Set.class));
46-
} catch (Throwable t) {
46+
} catch (Throwable ignored) {
4747
// ignore - will fall back to casting to Map
4848
}
4949
HEADER_NAMES = headerNames;
@@ -59,7 +59,7 @@ private static MethodHandle firstAvailableHandle(
5959
private static MethodHandle findGetHeadersMethod(MethodType methodType) {
6060
try {
6161
return MethodHandles.lookup().findVirtual(HttpHeaders.class, "get", methodType);
62-
} catch (Throwable t) {
62+
} catch (Throwable ignored) {
6363
return null;
6464
}
6565
}
@@ -72,7 +72,7 @@ public static List<String> getHeader(HttpHeaders headers, String name) {
7272
if (result != null) {
7373
return result;
7474
}
75-
} catch (Throwable t) {
75+
} catch (Throwable ignored) {
7676
// ignore
7777
}
7878
}
@@ -88,7 +88,7 @@ public static Set<String> getKeys(HttpHeaders headers) {
8888
if (result != null) {
8989
return result;
9090
}
91-
} catch (Throwable t) {
91+
} catch (Throwable ignored) {
9292
// ignore
9393
}
9494
} else {

0 commit comments

Comments
 (0)