opentelemetry-java-instrume.../instrumentation/graphql-java/graphql-java-20.0/library
Jay DeLuca 729f559f50
Metadata for graphql-java (#14526)
2025-08-27 15:12:56 +03:00
..
src Remove operation name from graphql span name (#13794) 2025-04-30 08:47:18 +03:00
README.md Add instrumentation for graphql 20 that does not use deprecated methods (#10779) 2024-03-12 13:48:17 +02:00
build.gradle.kts Metadata for graphql-java (#14526) 2025-08-27 15:12:56 +03:00

README.md

Library Instrumentation for GraphQL Java version 20.0 and higher

Provides OpenTelemetry instrumentation for GraphQL Java.

Quickstart

Add these dependencies to your project

Replace OPENTELEMETRY_VERSION with the latest release.

For Maven, add to your pom.xml dependencies:

<dependencies>
  <dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-graphql-java-20.0</artifactId>
    <version>OPENTELEMETRY_VERSION</version>
  </dependency>
</dependencies>

For Gradle, add to your dependencies:

implementation("io.opentelemetry.instrumentation:opentelemetry-graphql-java-20.0:OPENTELEMETRY_VERSION")

Usage

The instrumentation library provides a GraphQL Java Instrumentation implementation that can be added to an instance of the GraphQL to provide OpenTelemetry-based spans.

void configure(OpenTelemetry openTelemetry, GraphQL.Builder builder) {
  GraphQLTelemetry telemetry = GraphQLTelemetry.builder(openTelemetry).build();
  builder.instrumentation(telemetry.newInstrumentation());
}