Skip to content

Commit cafca13

Browse files
committed
address review comments
1 parent 7dcaefc commit cafca13

File tree

3 files changed

+9
-1
lines changed
  • instrumentation/graphql-java

3 files changed

+9
-1
lines changed

instrumentation/graphql-java/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
|------------------------------------------------------------------------|---------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55
| `otel.instrumentation.graphql.query-sanitizer.enabled` | Boolean | `true` | Whether to remove sensitive information from query source that is added as span attribute. |
66
| `otel.instrumentation.graphql.add-operation-name-to-span-name.enabled` | Boolean | `false` | Whether GraphQL operation name is added to the span name. <p>**WARNING**: GraphQL operation name is provided by the client and can have high cardinality. Use only when the server is not exposed to malicious clients. |
7-
| `otel.instrumentation.graphql.caputure-query` | Boolean | `true` | Whether to capture the query in `graphql.document` span attribute. |
7+
| `otel.instrumentation.graphql.capture-query` | Boolean | `true` | Whether to capture the query in `graphql.document` span attribute. |
88

99
# Settings for the GraphQL 20 instrumentation
1010

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
public final class GraphqlSingletons {
1515

16+
private static final boolean CAPTURE_QUERY =
17+
AgentInstrumentationConfig.get()
18+
.getBoolean("otel.instrumentation.graphql.capture-query", true);
1619
private static final boolean QUERY_SANITIZATION_ENABLED =
1720
AgentInstrumentationConfig.get()
1821
.getBoolean("otel.instrumentation.graphql.query-sanitizer.enabled", true);
@@ -23,6 +26,7 @@ public final class GraphqlSingletons {
2326

2427
private static final GraphQLTelemetry TELEMETRY =
2528
GraphQLTelemetry.builder(GlobalOpenTelemetry.get())
29+
.setCaptureQuery(CAPTURE_QUERY)
2630
.setSanitizeQuery(QUERY_SANITIZATION_ENABLED)
2731
.setAddOperationNameToSpanName(ADD_OPERATION_NAME_TO_SPAN_NAME)
2832
.build();

instrumentation/graphql-java/graphql-java-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/graphql/v20_0/GraphqlSingletons.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
public final class GraphqlSingletons {
1515

16+
private static final boolean CAPTURE_QUERY =
17+
AgentInstrumentationConfig.get()
18+
.getBoolean("otel.instrumentation.graphql.capture-query", true);
1619
private static final boolean QUERY_SANITIZATION_ENABLED =
1720
AgentInstrumentationConfig.get()
1821
.getBoolean("otel.instrumentation.graphql.query-sanitizer.enabled", true);
@@ -29,6 +32,7 @@ public final class GraphqlSingletons {
2932

3033
private static final GraphQLTelemetry TELEMETRY =
3134
GraphQLTelemetry.builder(GlobalOpenTelemetry.get())
35+
.setCaptureQuery(CAPTURE_QUERY)
3236
.setSanitizeQuery(QUERY_SANITIZATION_ENABLED)
3337
.setDataFetcherInstrumentationEnabled(DATA_FETCHER_ENABLED)
3438
.setTrivialDataFetcherInstrumentationEnabled(TRIVIAL_DATA_FETCHER_ENABLED)

0 commit comments

Comments
 (0)