Skip to content
Closed
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 @@ -52,4 +52,11 @@ tasks.withType<ShadowJar>().configureEach {

// this is for instrumentation on java.util.logging (since java.util.logging itself is shaded above)
relocate("application.java.util.logging", "java.util.logging")

// Rename SPI service files to match relocated class names
eachFile {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dis some AI com up with this? If so I'd suggest you to give up on #15513

if (path.startsWith("META-INF/services/io.opentelemetry.instrumentation")) {
path = path.replace("io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ tasks.withType<ShadowJar>().configureEach {

// this is for instrumentation on java.util.logging (since java.util.logging itself is shaded above)
relocate("application.java.util.logging", "java.util.logging")

// Rename SPI service files to match relocated class names
eachFile {
if (path.startsWith("META-INF/services/io.opentelemetry.instrumentation")) {
path = path.replace("io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation")
}
}
}

val compileMuzzle by tasks.registering {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ void testRocketmqProduceAndConsume() throws Exception {

@Test
void testRocketmqProduceAndBatchConsume() throws Exception {
// context propagation doesn't work for batch messages in 5.3.4
Assumptions.assumeFalse(Boolean.getBoolean("testLatestDeps"));

consumer.setConsumeMessageBatchMaxSize(2);
// This test assumes that messages are sent and received as a batch. Occasionally it happens
// that the messages are not received as a batch, but one by one. This doesn't match what the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ public void onSuccess(ReceiveMessageResult receiveMessageResult) {
null,
timer.startTime(),
timer.now());
// For batch messages, each message should have its own context that properly
// links to the individual producer spans through context propagation
for (MessageView messageView : messageViews) {
VirtualFieldStore.setContextByMessage(messageView, context);
// Extract context from individual message properties (trace headers)
Context messageContext = RocketMqSingletons.propagators()
.getTextMapPropagator()
.extract(context, messageView, MessageMapGetter.INSTANCE);
VirtualFieldStore.setContextByMessage(messageView, messageContext);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ DefaultKafkaProducerFactoryCustomizer otelKafkaProducerFactoryCustomizer(
static SpringKafkaTelemetry getTelemetry(
ObjectProvider<OpenTelemetry> openTelemetryProvider,
ObjectProvider<InstrumentationConfig> configProvider) {
InstrumentationConfig config = configProvider.getObject();
return SpringKafkaTelemetry.builder(openTelemetryProvider.getObject())
.setCaptureExperimentalSpanAttributes(
configProvider
.getObject()
.getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false))
config.getBoolean("otel.instrumentation.kafka.experimental-span-attributes", false))
.setMessagingReceiveInstrumentationEnabled(
config.getBoolean("otel.instrumentation.messaging.experimental.receive-telemetry.enabled", false))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.opentelemetry.javaagent.tooling.instrumentation.http.RegexUrlTemplateCustomizer
Loading