Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport graphql-java-22.0 support to 1.33.x #11171

Merged
merged 2 commits into from
Apr 18, 2024
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 @@ -34,17 +34,25 @@ extra["testLatestDeps"] = testLatestDeps
abstract class TestLatestDepsRule : ComponentMetadataRule {
override fun execute(context: ComponentMetadataContext) {
val version = context.details.id.version
if (version.contains("-alpha", true) ||
version.contains("-beta", true) ||
version.contains("-rc", true) ||
version.contains("-m", true) || // e.g. spring milestones are published to grails repo
version.contains(".alpha", true) || // e.g. netty
version.contains(".beta", true) || // e.g. hibernate
version.contains(".cr", true) // e.g. hibernate
if (version.contains("-alpha", true)
|| version.contains("-beta", true)
|| version.contains("-rc", true)
|| version.contains("-m", true) // e.g. spring milestones are published to grails repo
|| version.contains(".alpha", true) // e.g. netty
|| version.contains(".beta", true) // e.g. hibernate
|| version.contains(".cr", true) // e.g. hibernate
|| version.endsWith("-nf-execution") // graphql
|| GIT_SHA_PATTERN.matches(version) // graphql
|| DATETIME_PATTERN.matches(version) // graphql
) {
context.details.status = "milestone"
}
}

companion object {
private val GIT_SHA_PATTERN = Regex("^.*-[0-9a-f]{7,}$")
private val DATETIME_PATTERN = Regex("^\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}.*$")
}
}

configurations {
Expand Down
4 changes: 2 additions & 2 deletions docs/supported-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ These are the supported libraries and frameworks:
| [Geode Client](https://geode.apache.org/) | 1.4+ | N/A | [Database Client Spans] |
| [Google HTTP Client](https://github.com/googleapis/google-http-java-client) | 1.19+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
| [Grails](https://grails.org/) | 3.0+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [GraphQL Java](https://www.graphql-java.com/) | 12.0+ | [opentelemetry-graphql-java-12.0](../instrumentation/graphql-java-12.0/library) | [GraphQL Server Spans] |
| [GraphQL Java](https://www.graphql-java.com/) | 12.0+ | [opentelemetry-graphql-java-12.0](../instrumentation/graphql-java/graphql-java-12.0/library),<br>[opentelemetry-graphql-java-20.0](../instrumentation/graphql-java/graphql-java-20.0/library) | [GraphQL Server Spans] |
| [gRPC](https://github.com/grpc/grpc-java) | 1.6+ | [opentelemetry-grpc-1.6](../instrumentation/grpc-1.6/library) | [RPC Client Spans], [RPC Client Metrics], [RPC Server Spans], [RPC Server Metrics] |
| [Guava ListenableFuture](https://guava.dev/releases/snapshot/api/docs/com/google/common/util/concurrent/ListenableFuture.html) | 10.0+ | [opentelemetry-guava-10.0](../instrumentation/guava-10.0/library) | Context propagation |
| [GWT](http://www.gwtproject.org/) | 2.0+ | N/A | [RPC Server Spans] |
Expand All @@ -72,7 +72,7 @@ These are the supported libraries and frameworks:
| [Java Executors](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html) | Java 8+ | N/A | Context propagation |
| [Java Http Client](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/package-summary.html) | Java 11+ | [opentelemetry-java-http-client](../instrumentation/java-http-client/library) | [HTTP Client Spans], [HTTP Client Metrics] |
| [java.util.logging](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html) | Java 8+ | N/A | none |
| [Java Platform](https://docs.oracle.com/javase/8/docs/api/java/lang/management/ManagementFactory.html) | Java 8+ | [opentelemetry-runtime-telemetry-java8](../instrumentation/runtime-telemetry/runtime-telemetry-java8/library),[opentelemetry-runtime-telemetry-java17](../instrumentation/runtime-telemetry/runtime-telemetry-java17/library),<br>[opentelemetry-resources](../instrumentation/resources/library) | [JVM Runtime Metrics] |
| [Java Platform](https://docs.oracle.com/javase/8/docs/api/java/lang/management/ManagementFactory.html) | Java 8+ | [opentelemetry-runtime-telemetry-java8](../instrumentation/runtime-telemetry/runtime-telemetry-java8/library),<br>[opentelemetry-runtime-telemetry-java17](../instrumentation/runtime-telemetry/runtime-telemetry-java17/library),<br>[opentelemetry-resources](../instrumentation/resources/library) | [JVM Runtime Metrics] |
| [JAX-RS](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/package-summary.html) | 0.5+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [JAX-RS Client](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/client/package-summary.html) | 1.1+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
| [JAX-WS](https://jakarta.ee/specifications/xml-web-services/2.3/apidocs/javax/xml/ws/package-summary.html) | 2.0+ (not including 3.x yet) | N/A | Provides `http.route` [2], Controller Spans [3] |
Expand Down
21 changes: 0 additions & 21 deletions instrumentation/graphql-java-12.0/javaagent/build.gradle.kts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id("otel.javaagent-instrumentation")
}

muzzle {
pass {
group.set("com.graphql-java")
module.set("graphql-java")
versions.set("[12,20)")
skip("230521-nf-execution")
assertInverse.set(true)
}
}

dependencies {
implementation(project(":instrumentation:graphql-java:graphql-java-12.0:library"))
implementation(project(":instrumentation:graphql-java:graphql-java-common:library"))

library("com.graphql-java:graphql-java:12.0")

testInstrumentation(project(":instrumentation:graphql-java:graphql-java-20.0:javaagent"))

testImplementation(project(":instrumentation:graphql-java:graphql-java-common:testing"))

latestDepTestLibrary("com.graphql-java:graphql-java:19.+")
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;

public class GraphqlInstrumentation implements TypeInstrumentation {
class GraphqlInstrumentation implements TypeInstrumentation {

@Override
public ElementMatcher<TypeDescription> typeMatcher() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@

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

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static net.bytebuddy.matcher.ElementMatchers.not;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.Collections;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

@SuppressWarnings("unused")
@AutoService(InstrumentationModule.class)
Expand All @@ -19,6 +23,13 @@ public GraphqlInstrumentationModule() {
super("graphql-java", "graphql-java-12.0");
}

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
// added in 20.0
return not(
hasClassesNamed("graphql.execution.instrumentation.SimplePerformantInstrumentation"));
}

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return Collections.singletonList(new GraphqlInstrumentation());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

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

import graphql.execution.instrumentation.Instrumentation;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.graphql.internal.InstrumentationUtil;
import io.opentelemetry.instrumentation.graphql.v12_0.GraphQLTelemetry;
import io.opentelemetry.javaagent.bootstrap.internal.InstrumentationConfig;

public final class GraphqlSingletons {

private static final boolean QUERY_SANITIZATION_ENABLED =
InstrumentationConfig.get()
.getBoolean("otel.instrumentation.graphql.query-sanitizer.enabled", true);

private static final GraphQLTelemetry TELEMETRY =
GraphQLTelemetry.builder(GlobalOpenTelemetry.get())
.setSanitizeQuery(QUERY_SANITIZATION_ENABLED)
.build();

private GraphqlSingletons() {}

public static Instrumentation addInstrumentation(Instrumentation instrumentation) {
Instrumentation ourInstrumentation = TELEMETRY.newInstrumentation();
return InstrumentationUtil.addInstrumentation(instrumentation, ourInstrumentation);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Library Instrumentation for GraphQL Java version 12.0 and higher
# Library Instrumentation for GraphQL Java version 12.0 to 20.0

Provides OpenTelemetry instrumentation for [GraphQL Java](https://www.graphql-java.com/).

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id("otel.library-instrumentation")
}

dependencies {
library("com.graphql-java:graphql-java:12.0")
implementation(project(":instrumentation:graphql-java:graphql-java-common:library"))

testImplementation(project(":instrumentation:graphql-java:graphql-java-common:testing"))

latestDepTestLibrary("com.graphql-java:graphql-java:19.+")
}
Loading
Loading