# GraphQL Java

<!-- llms-txt-link: /llms.txt -->

> OpenTelemetry Java agent instrumentation

This instrumentation enables spans for GraphQL operations.

- **Name**: `graphql-java-20.0`
- **Scope**: `io.opentelemetry.graphql-java-20.0`
- **Target versions**: `com.graphql-java:graphql-java:[20,)`
- **Library**: https://www.graphql-java.com/

## Telemetry

- **Span attributes**: `graphql.document`, `graphql.operation.name`, `graphql.operation.type`, `graphql.field.name`, `graphql.field.path`

## Configuration

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `otel.instrumentation.graphql.capture-query` | boolean | true | Whether to capture the query in `graphql.document` span attribute. |
| `otel.instrumentation.graphql.data-fetcher.enabled` | boolean | false | Enables span generation for data fetchers. |
| `otel.instrumentation.graphql.operation-name-in-span-name.enabled` | boolean | false | Whether GraphQL operation name is added to the span name. WARNING: The GraphQL operation name is provided by the client and can have high cardinality. Use only when the server is not exposed to malicious clients. |
| `otel.instrumentation.graphql.query-sanitization.enabled` | boolean | true | Enables sanitization of sensitive information from queries so they aren't added as span attributes. |
| `otel.instrumentation.graphql.trivial-data-fetcher.enabled` | boolean | false | Whether to create spans for trivial data fetchers. A trivial data fetcher is one that simply maps data from an object to a field. |

## Data

- **JSON**: [/data/javaagent/instrumentations/graphql-java-20.0/graphql-java-20.0-91c6c12819a5.json](/data/javaagent/instrumentations/graphql-java-20.0/graphql-java-20.0-91c6c12819a5.json)
- **Explore**: [/java-agent/instrumentation/graphql-java-20.0](/java-agent/instrumentation/graphql-java-20.0)
