Skip to content

Commit b784fc1

Browse files
otelbot[bot]trask
andauthored
Module cleanup (run 25293783415) (#18543)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent 6b1fb82 commit b784fc1

8 files changed

Lines changed: 19 additions & 20 deletions

File tree

instrumentation/finatra-2.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/finatra/v2_9/FinatraSingletons.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class FinatraSingletons {
2424
public static final VirtualField<Response, Throwable> THROWABLE =
2525
VirtualField.find(Response.class, Throwable.class);
2626

27-
private static final VirtualField<Route, Class<?>> callbackClassField =
27+
private static final VirtualField<Route, Class<?>> CALLBACK_CLASS =
2828
VirtualField.find(Route.class, Class.class);
2929

3030
private static final Instrumenter<FinatraRequest, Void> instrumenter;
@@ -35,10 +35,7 @@ public class FinatraSingletons {
3535
Instrumenter.<FinatraRequest, Void>builder(
3636
GlobalOpenTelemetry.get(),
3737
"io.opentelemetry.finatra-2.9",
38-
request ->
39-
request.controllerClass() != null
40-
? ClassNames.simpleName(request.controllerClass())
41-
: "<unknown>")
38+
request -> ClassNames.simpleName(request.controllerClass()))
4239
.addAttributesExtractor(CodeAttributesExtractor.create(codeAttributesGetter))
4340
.setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled())
4441
.buildInstrumenter();
@@ -53,12 +50,12 @@ public static void updateServerSpanName(Context context, RouteInfo routeInfo) {
5350
}
5451

5552
public static void setCallbackClass(Route route, Class<?> clazz) {
56-
callbackClassField.set(route, clazz);
53+
CALLBACK_CLASS.set(route, clazz);
5754
}
5855

5956
@Nullable
6057
public static Class<?> getCallbackClass(Route route) {
61-
return callbackClassField.get(route);
58+
return CALLBACK_CLASS.get(route);
6259
}
6360

6461
private FinatraSingletons() {}

instrumentation/google-http-client-1.19/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ configurations:
2323
type: list
2424
default: ""
2525
- name: otel.instrumentation.common.peer-service-mapping
26+
declarative_name: java.common.peer_service_mapping
2627
description: Used to specify a mapping from host names or IP addresses to peer services.
2728
type: map
2829
default: ""

instrumentation/grails-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grails/v3_0/UrlMappingsInfoHandlerAdapterInstrumentation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package io.opentelemetry.javaagent.instrumentation.grails.v3_0;
77

8+
import static io.opentelemetry.javaagent.instrumentation.grails.v3_0.GrailsServerSpanNaming.serverSpanName;
89
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
910
import static net.bytebuddy.matcher.ElementMatchers.named;
1011
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
@@ -49,7 +50,7 @@ public static void nameSpan(@Advice.Argument(2) Object handler) {
4950
HttpServerRoute.update(
5051
parentContext,
5152
HttpServerRouteSource.CONTROLLER,
52-
GrailsServerSpanNaming.serverSpanName(),
53+
serverSpanName(),
5354
(GrailsControllerUrlMappingInfo) handler);
5455
}
5556
}

instrumentation/graphql-java/graphql-java-12.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v12_0/GraphqlInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
package io.opentelemetry.javaagent.instrumentation.graphql.v12_0;
77

8-
import static io.opentelemetry.javaagent.instrumentation.graphql.v12_0.GraphqlSingletons.addInstrumentation;
98
import static net.bytebuddy.matcher.ElementMatchers.named;
109
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
1110
import static net.bytebuddy.matcher.ElementMatchers.returns;
@@ -38,7 +37,7 @@ public static class AddInstrumentationAdvice {
3837
@AssignReturned.ToReturned
3938
@Advice.OnMethodExit(suppress = Throwable.class, inline = false)
4039
public static Instrumentation onExit(@Advice.Return Instrumentation instrumentation) {
41-
return addInstrumentation(instrumentation);
40+
return GraphqlSingletons.addInstrumentation(instrumentation);
4241
}
4342
}
4443
}

instrumentation/graphql-java/graphql-java-20.0/library/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ if (otelProps.testLatestDeps) {
1515
}
1616
}
1717

18-
tasks.withType<Test>().configureEach {
18+
tasks.test {
1919
jvmArgs("-Dotel.instrumentation.graphql.data-fetcher.enabled=true")
2020
}

instrumentation/graphql-java/graphql-java-common-12.0/testing/src/main/java/io/opentelemetry/instrumentation/graphql/common/v12_0/AbstractGraphqlTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ void successfulQueryWithoutName() {
252252
void parseError() {
253253
ExecutionResult result = graphql.execute("query foo bar");
254254

255-
assertThat(result.getErrors()).hasSize(1);
256-
assertThat(result.getErrors().get(0).getErrorType().toString()).isEqualTo("InvalidSyntax");
255+
assertThat(result.getErrors())
256+
.singleElement()
257+
.satisfies(error -> assertThat(error.getErrorType().toString()).isEqualTo("InvalidSyntax"));
257258

258259
getTesting()
259260
.waitAndAssertTraces(
@@ -292,8 +293,10 @@ void validationError() {
292293
+ " }");
293294
// spotless:on
294295

295-
assertThat(result.getErrors()).hasSize(1);
296-
assertThat(result.getErrors().get(0).getErrorType().toString()).isEqualTo("ValidationError");
296+
assertThat(result.getErrors())
297+
.singleElement()
298+
.satisfies(
299+
error -> assertThat(error.getErrorType().toString()).isEqualTo("ValidationError"));
297300

298301
getTesting()
299302
.waitAndAssertTraces(

instrumentation/grizzly-2.3/javaagent/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
}
2929

3030
tasks {
31-
withType<Test>().configureEach {
31+
test {
3232
// required on jdk17
3333
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
3434
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")

instrumentation/grizzly-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/v2_3/FilterInstrumentation.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import net.bytebuddy.asm.Advice;
2222
import net.bytebuddy.description.type.TypeDescription;
2323
import net.bytebuddy.matcher.ElementMatcher;
24-
import org.glassfish.grizzly.filterchain.BaseFilter;
2524
import org.glassfish.grizzly.filterchain.FilterChainContext;
2625

2726
class FilterInstrumentation implements TypeInstrumentation {
@@ -52,8 +51,7 @@ public void transform(TypeTransformer transformer) {
5251
public static class HandleReadAdvice {
5352

5453
@Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
55-
public static Scope onEnter(
56-
@Advice.This BaseFilter it, @Advice.Argument(0) FilterChainContext ctx) {
54+
public static Scope onEnter(@Advice.Argument(0) FilterChainContext ctx) {
5755
if (Java8BytecodeBridge.currentSpan().getSpanContext().isValid()) {
5856
return null;
5957
}
@@ -62,7 +60,7 @@ public static Scope onEnter(
6260
}
6361

6462
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
65-
public static void onExit(@Advice.This BaseFilter it, @Advice.Enter @Nullable Scope scope) {
63+
public static void onExit(@Advice.Enter @Nullable Scope scope) {
6664
if (scope != null) {
6765
scope.close();
6866
}

0 commit comments

Comments
 (0)