Skip to content

Commit e43d741

Browse files
committed
Merge branch 'main' into nats-instrumentation
2 parents dd00a7f + 729f559 commit e43d741

File tree

42 files changed

+223
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+223
-102
lines changed

docs/instrumentation-list.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,6 +3014,7 @@ libraries:
30143014
attributes: []
30153015
graphql:
30163016
- name: graphql-java-12.0
3017+
description: This instrumentation enables spans for GraphQL Java operations.
30173018
source_path: instrumentation/graphql-java/graphql-java-12.0
30183019
scope:
30193020
name: io.opentelemetry.graphql-java-12.0
@@ -3022,7 +3023,30 @@ libraries:
30223023
- com.graphql-java:graphql-java:[12,20)
30233024
library:
30243025
- com.graphql-java:graphql-java:[12.0,19.+)
3026+
configurations:
3027+
- name: otel.instrumentation.graphql.query-sanitizer.enabled
3028+
description: Enables sanitization of sensitive information from queries so they
3029+
aren't added as span attributes.
3030+
type: boolean
3031+
default: true
3032+
- name: otel.instrumentation.graphql.add-operation-name-to-span-name.enabled
3033+
description: |
3034+
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.
3035+
type: boolean
3036+
default: false
3037+
telemetry:
3038+
- when: default
3039+
spans:
3040+
- span_kind: INTERNAL
3041+
attributes:
3042+
- name: graphql.document
3043+
type: STRING
3044+
- name: graphql.operation.name
3045+
type: STRING
3046+
- name: graphql.operation.type
3047+
type: STRING
30253048
- name: graphql-java-20.0
3049+
description: This instrumentation enables spans for GraphQL Java operations.
30263050
source_path: instrumentation/graphql-java/graphql-java-20.0
30273051
minimum_java_version: 11
30283052
scope:
@@ -3032,6 +3056,51 @@ libraries:
30323056
- com.graphql-java:graphql-java:[20,)
30333057
library:
30343058
- com.graphql-java:graphql-java:20.0
3059+
configurations:
3060+
- name: otel.instrumentation.graphql.query-sanitizer.enabled
3061+
description: Enables sanitization of sensitive information from queries so they
3062+
aren't added as span attributes.
3063+
type: boolean
3064+
default: true
3065+
- name: otel.instrumentation.graphql.add-operation-name-to-span-name.enabled
3066+
description: |
3067+
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.
3068+
type: boolean
3069+
default: false
3070+
- name: otel.instrumentation.graphql.data-fetcher.enabled
3071+
description: Enables span generation for data fetchers.
3072+
type: boolean
3073+
default: false
3074+
- name: otel.instrumentation.graphql.trivial-data-fetcher.enabled
3075+
description: Whether to create spans for trivial data fetchers. A trivial data
3076+
fetcher is one that simply maps data from an object to a field.
3077+
type: boolean
3078+
default: false
3079+
telemetry:
3080+
- when: default
3081+
spans:
3082+
- span_kind: INTERNAL
3083+
attributes:
3084+
- name: graphql.document
3085+
type: STRING
3086+
- name: graphql.operation.name
3087+
type: STRING
3088+
- name: graphql.operation.type
3089+
type: STRING
3090+
- when: otel.instrumentation.graphql.data-fetcher.enabled=true
3091+
spans:
3092+
- span_kind: INTERNAL
3093+
attributes:
3094+
- name: graphql.document
3095+
type: STRING
3096+
- name: graphql.field.name
3097+
type: STRING
3098+
- name: graphql.field.path
3099+
type: STRING
3100+
- name: graphql.operation.name
3101+
type: STRING
3102+
- name: graphql.operation.type
3103+
type: STRING
30353104
grizzly:
30363105
- name: grizzly-2.3
30373106
description: This instrumentation enables HTTP SERVER spans and metrics for Grizzly

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/CapturedMessageHeadersUtil.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,21 @@
55

66
package io.opentelemetry.instrumentation.api.incubator.semconv.messaging;
77

8-
import static java.util.Collections.unmodifiableList;
9-
108
import io.opentelemetry.api.common.AttributeKey;
119
import java.util.List;
12-
import java.util.Locale;
1310
import java.util.concurrent.ConcurrentHashMap;
1411
import java.util.concurrent.ConcurrentMap;
15-
import java.util.stream.Collectors;
1612

1713
final class CapturedMessageHeadersUtil {
1814

1915
private static final ConcurrentMap<String, AttributeKey<List<String>>> attributeKeysCache =
2016
new ConcurrentHashMap<>();
2117

22-
static List<String> lowercase(List<String> names) {
23-
return unmodifiableList(
24-
names.stream().map(s -> s.toLowerCase(Locale.ROOT)).collect(Collectors.toList()));
25-
}
26-
2718
static AttributeKey<List<String>> attributeKey(String headerName) {
2819
return attributeKeysCache.computeIfAbsent(headerName, n -> createKey(n));
2920
}
3021

3122
private static AttributeKey<List<String>> createKey(String headerName) {
32-
// headerName is always lowercase, see MessagingAttributesExtractor
3323
String key = "messaging.header." + headerName.replace('-', '_');
3424
return AttributeKey.stringArrayKey(key);
3525
}

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingAttributesExtractor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
1414
import io.opentelemetry.instrumentation.api.internal.SpanKey;
1515
import io.opentelemetry.instrumentation.api.internal.SpanKeyProvider;
16+
import java.util.ArrayList;
1617
import java.util.List;
1718
import javax.annotation.Nullable;
1819

@@ -85,7 +86,7 @@ public static <REQUEST, RESPONSE> MessagingAttributesExtractorBuilder<REQUEST, R
8586
List<String> capturedHeaders) {
8687
this.getter = getter;
8788
this.operation = operation;
88-
this.capturedHeaders = CapturedMessageHeadersUtil.lowercase(capturedHeaders);
89+
this.capturedHeaders = new ArrayList<>(capturedHeaders);
8990
}
9091

9192
@Override

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessagingAttributesExtractorBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public final class MessagingAttributesExtractorBuilder<REQUEST, RESPONSE> {
3030
* Configures the messaging headers that will be captured as span attributes.
3131
*
3232
* <p>The messaging header values will be captured under the {@code messaging.header.<name>}
33-
* attribute key. The {@code <name>} part in the attribute key is the normalized header name:
34-
* lowercase, with dashes replaced by underscores.
33+
* attribute key. The {@code <name>} part in the attribute key is the header name with dashes
34+
* replaced by underscores.
3535
*
3636
* @param capturedHeaders A list of messaging header names.
3737
*/

instrumentation-docs/instrumentations.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ readonly INSTRUMENTATIONS=(
137137
"grails-3.0:javaagent:test"
138138
"grizzly-2.3:javaagent:test"
139139
"gwt-2.0:javaagent:test"
140+
"graphql-java:graphql-java-12.0:javaagent:test"
141+
"graphql-java:graphql-java-20.0:javaagent:test"
142+
"graphql-java:graphql-java-20.0:javaagent:testDataFetcher"
140143
"nats:nats-2.21:javaagent:test"
141144
"nats:nats-2.21:javaagent:testExperimental"
142145
)

instrumentation/aws-sdk/aws-sdk-1.11/library-autoconfigure/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626
tasks {
2727
withType<Test>().configureEach {
2828
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", "true")
29-
systemProperty("otel.instrumentation.messaging.experimental.capture-headers", "test-message-header")
29+
systemProperty("otel.instrumentation.messaging.experimental.capture-headers", "Test-Message-Header")
3030
}
3131

3232
val testReceiveSpansDisabled by registering(Test::class) {

instrumentation/aws-sdk/aws-sdk-1.11/library/src/test/java/io/opentelemetry/instrumentation/awssdk/v1_11/SqsTracingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public AmazonSQSAsyncClientBuilder configureClient(AmazonSQSAsyncClientBuilder c
2828
AwsSdkTelemetry.builder(testing().getOpenTelemetry())
2929
.setCaptureExperimentalSpanAttributes(true)
3030
.setMessagingReceiveInstrumentationEnabled(true)
31-
.setCapturedHeaders(singletonList("test-message-header"))
31+
.setCapturedHeaders(singletonList("Test-Message-Header"))
3232
.build()
3333
.newRequestHandler());
3434
}

instrumentation/aws-sdk/aws-sdk-1.11/testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AbstractSqsTracingTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead
106106

107107
if (testCaptureHeaders) {
108108
sendMessageRequest.addMessageAttributesEntry(
109-
"test-message-header",
109+
"Test-Message-Header",
110110
new MessageAttributeValue().withDataType("String").withStringValue("test"));
111111
}
112112
sqsClient.sendMessage(sendMessageRequest);
113113

114114
ReceiveMessageRequest receiveMessageRequest =
115115
new ReceiveMessageRequest("http://localhost:" + sqsPort + "/000000000000/testSdkSqs");
116116
if (testCaptureHeaders) {
117-
receiveMessageRequest.withMessageAttributeNames("test-message-header");
117+
receiveMessageRequest.withMessageAttributeNames("Test-Message-Header");
118118
}
119119
ReceiveMessageResult receiveMessageResult = sqsClient.receiveMessage(receiveMessageRequest);
120120

@@ -182,7 +182,7 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead
182182
if (testCaptureHeaders) {
183183
attributes.add(
184184
satisfies(
185-
stringArrayKey("messaging.header.test_message_header"),
185+
stringArrayKey("messaging.header.Test_Message_Header"),
186186
val -> val.isEqualTo(singletonList("test"))));
187187
}
188188

@@ -222,7 +222,7 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead
222222
if (testCaptureHeaders) {
223223
attributes.add(
224224
satisfies(
225-
stringArrayKey("messaging.header.test_message_header"),
225+
stringArrayKey("messaging.header.Test_Message_Header"),
226226
val -> val.isEqualTo(singletonList("test"))));
227227
}
228228

@@ -261,7 +261,7 @@ void testSimpleSqsProducerConsumerServicesCaptureHeaders(boolean testCaptureHead
261261
if (testCaptureHeaders) {
262262
attributes.add(
263263
satisfies(
264-
stringArrayKey("messaging.header.test_message_header"),
264+
stringArrayKey("messaging.header.Test_Message_Header"),
265265
val -> val.isEqualTo(singletonList("test"))));
266266
}
267267
span.hasName("testSdkSqs process")

instrumentation/aws-sdk/aws-sdk-2.2/library-autoconfigure/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tasks {
2828
withType<Test>().configureEach {
2929
systemProperty("otel.instrumentation.aws-sdk.experimental-span-attributes", true)
3030
systemProperty("otel.instrumentation.aws-sdk.experimental-record-individual-http-error", true)
31-
systemProperty("otel.instrumentation.messaging.experimental.capture-headers", "test-message-header")
31+
systemProperty("otel.instrumentation.messaging.experimental.capture-headers", "Test-Message-Header")
3232
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
3333
}
3434

instrumentation/aws-sdk/aws-sdk-2.2/library/src/test/java/io/opentelemetry/instrumentation/awssdk/v2_2/Aws2SqsTracingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void setup() {
3333
AwsSdkTelemetry.builder(getTesting().getOpenTelemetry())
3434
.setCaptureExperimentalSpanAttributes(true)
3535
.setMessagingReceiveInstrumentationEnabled(true)
36-
.setCapturedHeaders(singletonList("test-message-header"));
36+
.setCapturedHeaders(singletonList("Test-Message-Header"));
3737

3838
configure(telemetryBuilder);
3939
telemetry = telemetryBuilder.build();

0 commit comments

Comments
 (0)