Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class FinatraSingletons {
public static final VirtualField<Response, Throwable> THROWABLE =
VirtualField.find(Response.class, Throwable.class);

private static final VirtualField<Route, Class<?>> callbackClassField =
private static final VirtualField<Route, Class<?>> CALLBACK_CLASS =
VirtualField.find(Route.class, Class.class);

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

public static void setCallbackClass(Route route, Class<?> clazz) {
callbackClassField.set(route, clazz);
CALLBACK_CLASS.set(route, clazz);
}

@Nullable
public static Class<?> getCallbackClass(Route route) {
return callbackClassField.get(route);
return CALLBACK_CLASS.get(route);
}

private FinatraSingletons() {}
Expand Down
1 change: 1 addition & 0 deletions instrumentation/google-http-client-1.19/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ configurations:
type: list
default: ""
- name: otel.instrumentation.common.peer-service-mapping
declarative_name: java.common.peer_service_mapping
description: Used to specify a mapping from host names or IP addresses to peer services.
type: map
default: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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

import static io.opentelemetry.javaagent.instrumentation.grails.v3_0.GrailsServerSpanNaming.serverSpanName;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
Expand Down Expand Up @@ -49,7 +50,7 @@ public static void nameSpan(@Advice.Argument(2) Object handler) {
HttpServerRoute.update(
parentContext,
HttpServerRouteSource.CONTROLLER,
GrailsServerSpanNaming.serverSpanName(),
serverSpanName(),
(GrailsControllerUrlMappingInfo) handler);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

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

import static io.opentelemetry.javaagent.instrumentation.graphql.v12_0.GraphqlSingletons.addInstrumentation;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
import static net.bytebuddy.matcher.ElementMatchers.returns;
Expand Down Expand Up @@ -38,7 +37,7 @@ public static class AddInstrumentationAdvice {
@AssignReturned.ToReturned
@Advice.OnMethodExit(suppress = Throwable.class, inline = false)
public static Instrumentation onExit(@Advice.Return Instrumentation instrumentation) {
return addInstrumentation(instrumentation);
return GraphqlSingletons.addInstrumentation(instrumentation);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ if (otelProps.testLatestDeps) {
}
}

tasks.withType<Test>().configureEach {
tasks.test {
jvmArgs("-Dotel.instrumentation.graphql.data-fetcher.enabled=true")
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ void successfulQueryWithoutName() {
void parseError() {
ExecutionResult result = graphql.execute("query foo bar");

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

getTesting()
.waitAndAssertTraces(
Expand Down Expand Up @@ -292,8 +293,10 @@ void validationError() {
+ " }");
// spotless:on

assertThat(result.getErrors()).hasSize(1);
assertThat(result.getErrors().get(0).getErrorType().toString()).isEqualTo("ValidationError");
assertThat(result.getErrors())
.singleElement()
.satisfies(
error -> assertThat(error.getErrorType().toString()).isEqualTo("ValidationError"));

getTesting()
.waitAndAssertTraces(
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/grizzly-2.3/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
}

tasks {
withType<Test>().configureEach {
test {
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.glassfish.grizzly.filterchain.BaseFilter;
import org.glassfish.grizzly.filterchain.FilterChainContext;

class FilterInstrumentation implements TypeInstrumentation {
Expand Down Expand Up @@ -52,8 +51,7 @@ public void transform(TypeTransformer transformer) {
public static class HandleReadAdvice {

@Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
public static Scope onEnter(
@Advice.This BaseFilter it, @Advice.Argument(0) FilterChainContext ctx) {
public static Scope onEnter(@Advice.Argument(0) FilterChainContext ctx) {
if (Java8BytecodeBridge.currentSpan().getSpanContext().isValid()) {
return null;
}
Expand All @@ -62,7 +60,7 @@ public static Scope onEnter(
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class, inline = false)
public static void onExit(@Advice.This BaseFilter it, @Advice.Enter @Nullable Scope scope) {
public static void onExit(@Advice.Enter @Nullable Scope scope) {
if (scope != null) {
scope.close();
}
Expand Down
Loading