Skip to content
Merged
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
31 changes: 30 additions & 1 deletion docs/instrumentation-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5536,6 +5536,35 @@ libraries:
Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace.
type: boolean
default: false
- name: kafka-connect-2.6
description: This instrumentation enables messaging spans for Kafka Connect sink
tasks.
semantic_conventions:
- MESSAGING_SPANS
library_link: https://kafka.apache.org/documentation/#connect
source_path: instrumentation/kafka/kafka-connect-2.6
scope:
name: io.opentelemetry.kafka-connect-2.6
target_versions:
javaagent:
- org.apache.kafka:connect-api:[2.6.0,)
telemetry:
- when: default
spans:
- span_kind: CONSUMER
attributes:
- name: messaging.batch.message_count
type: LONG
- name: messaging.destination.name
type: STRING
- name: messaging.operation
type: STRING
- name: messaging.system
type: STRING
- name: thread.id
type: LONG
- name: thread.name
type: STRING
- name: kafka-streams-0.11
library_link: https://kafka.apache.org/documentation/streams/
source_path: instrumentation/kafka/kafka-streams-0.11
Expand Down Expand Up @@ -7663,9 +7692,9 @@ libraries:
- org.springframework.security:spring-security-config:[6.0.0,]
library:
- io.projectreactor:reactor-core:3.5.0
- jakarta.servlet:jakarta.servlet-api:[6.0.0,6.1.0)
- org.springframework.security:spring-security-config:6.0.0
- org.springframework:spring-web:6.0.0
- jakarta.servlet:jakarta.servlet-api:6.0.0
- org.springframework.security:spring-security-web:6.0.0
configurations:
- name: otel.instrumentation.common.enduser.id.enabled
Expand Down
1 change: 1 addition & 0 deletions instrumentation-docs/instrumentations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ readonly INSTRUMENTATIONS=(
"jetty-httpclient:jetty-httpclient-12.0:javaagent:test"
"jetty-httpclient:jetty-httpclient-9.2:javaagent:test"
"jodd-http-4.2:javaagent:test"
"kafka:kafka-connect-2.6:testing:test"
"nats:nats-2.17:javaagent:test"
"nats:nats-2.17:javaagent:testExperimental"
"netty:netty-3.8:javaagent:test"
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/kafka/kafka-connect-2.6/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
description: "This instrumentation enables messaging spans for Kafka Connect sink tasks."
semantic_conventions:
- MESSAGING_SPANS
library_link: https://kafka.apache.org/documentation/#connect
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ dependencies {
tasks.withType<Test>().configureEach {
dependsOn(agentShadowJar)
systemProperty("io.opentelemetry.smoketest.agent.shadowJar.path", agentShadowJar.get().archiveFile.get().toString())
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
}
Copy link
Member

Choose a reason for hiding this comment

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

how are you thinking to use the telemetry emitted from the smoke tests?

Copy link
Member Author

@jaydeluca jaydeluca Oct 18, 2025

Choose a reason for hiding this comment

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

kafka connect only runs smoke tests, so this was the only way to get that telemetry. I don't think there will be too many other instrumentations this is needed for

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.testing.InstrumentationTestRunner;
import io.opentelemetry.instrumentation.testing.internal.MetaDataCollector;
import io.opentelemetry.sdk.logs.data.LogRecordData;
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.trace.data.SpanData;
import java.io.File;
import java.io.IOException;
import java.util.List;

/**
Expand Down Expand Up @@ -38,7 +41,15 @@ void setTelemetryRetriever(TelemetryRetriever telemetryRetriever) {
public void beforeTestClass() {}

@Override
public void afterTestClass() {}
public void afterTestClass() throws IOException {
// Generates files in a `.telemetry` directory within the instrumentation module with all
// captured emitted metadata to be used by the instrumentation-docs Doc generator.
if (Boolean.getBoolean("collectMetadata")) {
String path = new File("").getAbsolutePath();

MetaDataCollector.writeTelemetryToFiles(path, metricsByScope, tracesByScope);
}
}

@Override
public void clearAllExportedData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
import io.opentelemetry.sdk.logs.data.LogRecordData;
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.trace.data.SpanData;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.List;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -67,11 +66,7 @@ public void afterTestClass() throws IOException {
// Generates files in a `.telemetry` directory within the instrumentation module with all
// captured emitted metadata to be used by the instrumentation-docs Doc generator.
if (Boolean.getBoolean("collectMetadata")) {
URL resource = this.getClass().getClassLoader().getResource("");
if (resource == null) {
return;
}
String path = Paths.get(resource.getPath()).toString();
String path = new File("").getAbsolutePath();

MetaDataCollector.writeTelemetryToFiles(path, metricsByScope, tracesByScope);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
import io.opentelemetry.sdk.trace.SpanProcessor;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -133,11 +132,7 @@ public void afterTestClass() throws IOException {
// Generates files in a `.telemetry` directory within the instrumentation module with all
// captured emitted metadata to be used by the instrumentation-docs Doc generator.
if (Boolean.getBoolean("collectMetadata")) {
URL resource = this.getClass().getClassLoader().getResource("");
if (resource == null) {
return;
}
String path = Paths.get(resource.getPath()).toString();
String path = new File("").getAbsolutePath();

MetaDataCollector.writeTelemetryToFiles(path, metricsByScope, tracesByScope);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class MetaDataCollector {

private static final String TMP_DIR = ".telemetry";
private static final Pattern MODULE_PATTERN =
Pattern.compile("(.*?/instrumentation/.*?)(/javaagent/|/library/)");
Pattern.compile("(.*?/instrumentation/.*?)(/javaagent|/library|/testing)");
Copy link
Member

Choose a reason for hiding this comment

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

or was remove the trailing / intentional?

Suggested change
Pattern.compile("(.*?/instrumentation/.*?)(/javaagent|/library|/testing)");
Pattern.compile("(.*?/instrumentation/.*?)(/javaagent/|/library/|/testing/)");

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, with the change in the way we are now getting the path, the result is different now


public static void writeTelemetryToFiles(
String path,
Expand Down
Loading