From 16101ccbd5e8372e2e3347474fb2c13a5d814d75 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 13 Nov 2025 20:00:59 -0500 Subject: [PATCH 1/5] Kotlin and ktor metadata --- docs/instrumentation-list.yaml | 271 ++++++++++++++++++ instrumentation-docs/instrumentations.sh | 3 + .../kotlinx-coroutines-1.0/metadata.yaml | 13 + .../kotlinx-coroutines-flow-1.3/metadata.yaml | 5 + .../ktor/ktor-1.0/library/build.gradle.kts | 3 + instrumentation/ktor/ktor-1.0/metadata.yaml | 7 + .../ktor/ktor-2.0/javaagent/build.gradle.kts | 4 + instrumentation/ktor/ktor-2.0/metadata.yaml | 39 +++ .../ktor/ktor-3.0/javaagent/build.gradle.kts | 4 + instrumentation/ktor/ktor-3.0/metadata.yaml | 39 +++ 10 files changed, 388 insertions(+) create mode 100644 instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml create mode 100644 instrumentation/kotlinx-coroutines/kotlinx-coroutines-flow-1.3/metadata.yaml create mode 100644 instrumentation/ktor/ktor-1.0/metadata.yaml create mode 100644 instrumentation/ktor/ktor-2.0/metadata.yaml create mode 100644 instrumentation/ktor/ktor-3.0/metadata.yaml diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index 06c8e7b977ae..a95f8974b0ef 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -6865,6 +6865,23 @@ libraries: target_versions: javaagent: - org.apache.tomcat:tomcat-jasper:[7.0.19,10) + telemetry: + - when: otel.instrumentation.common.experimental.view-telemetry.enabled=true + spans: + - span_kind: INTERNAL + attributes: [] + - when: otel.instrumentation.common.experimental.view-telemetry.enabled=true,otel.instrumentation.jsp.experimental-span-attributes=true + spans: + - span_kind: INTERNAL + attributes: + - name: jsp.classFQCN + type: STRING + - name: jsp.compiler + type: STRING + - name: jsp.forwardOrigin + type: STRING + - name: jsp.requestURL + type: STRING kafka: - name: kafka-clients-0.11 display_name: Apache Kafka Client @@ -8280,6 +8297,12 @@ libraries: type: STRING kotlinx: - name: kotlinx-coroutines-1.0 + display_name: Kotlin Coroutines + description: | + This instrumentation enables context propagation for Kotlin coroutines and adds support for @WithSpan annotations on Kotlin suspend functions, it does not emit any telemetry on its own. + library_link: https://github.com/Kotlin/kotlinx.coroutines + features: + - CONTEXT_PROPAGATION source_path: instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0 scope: name: io.opentelemetry.kotlinx-coroutines-1.0 @@ -8287,7 +8310,17 @@ libraries: javaagent: - org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:[1.3.9,) - org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.0.0,1.3.8) + configurations: + - name: otel.instrumentation.kotlinx-coroutines.check-class + description: | + Enables bytecode verification with ASM CheckClassAdapter for debugging transformed classes. + type: boolean + default: false - name: kotlinx-coroutines-flow-1.3 + display_name: Kotlin Coroutines Flow + description: | + This instrumentation adds support for @WithSpan annotations on methods that return Kotlin Flow, it does not emit any telemetry on its own. + library_link: https://github.com/Kotlin/kotlinx.coroutines source_path: instrumentation/kotlinx-coroutines/kotlinx-coroutines-flow-1.3 scope: name: io.opentelemetry.kotlinx-coroutines-flow-1.3 @@ -8297,16 +8330,107 @@ libraries: - org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:[1.3.9,) ktor: - name: ktor-1.0 + description: This instrumentation enables HTTP server spans and HTTP server metrics + for the Ktor server. + semantic_conventions: + - HTTP_SERVER_SPANS + - HTTP_SERVER_METRICS + library_link: https://ktor.io/ + features: + - HTTP_ROUTE source_path: instrumentation/ktor/ktor-1.0 scope: name: io.opentelemetry.ktor-1.0 + schema_url: https://opentelemetry.io/schemas/1.37.0 target_versions: library: - io.ktor:ktor-server-core:[1.0.0,1.+) + telemetry: + - when: otel.instrumentation.common.experimental.controller-telemetry.enabled=true + metrics: + - name: http.server.request.duration + description: Duration of HTTP server requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.protocol.version + type: STRING + - name: url.scheme + type: STRING + spans: + - span_kind: CONSUMER + attributes: + - name: client.address + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: network.peer.address + type: STRING + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING + - span_kind: SERVER + attributes: + - name: client.address + type: STRING + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.request.method_original + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.peer.address + type: STRING + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING - name: ktor-2.0 + description: | + This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP client, and enriches HTTP server spans with route information for the Ktor server. + semantic_conventions: + - HTTP_CLIENT_SPANS + - HTTP_CLIENT_METRICS + library_link: https://ktor.io/ + features: + - HTTP_ROUTE source_path: instrumentation/ktor/ktor-2.0 scope: name: io.opentelemetry.ktor-2.0 + schema_url: https://opentelemetry.io/schemas/1.37.0 target_versions: javaagent: - io.ktor:ktor-client-core:[2.0.0,3.0.0) @@ -8314,10 +8438,88 @@ libraries: library: - io.ktor:ktor-client-core:[2.0.0,2.+) - io.ktor:ktor-server-core:[2.0.0,2.+) + configurations: + - name: otel.instrumentation.http.known-methods + description: | + Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as `_OTHER`. + type: list + default: CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE + - name: otel.instrumentation.http.client.capture-request-headers + description: List of HTTP request headers to capture in HTTP client telemetry. + type: list + default: '' + - name: otel.instrumentation.http.client.capture-response-headers + description: List of HTTP response headers to capture in HTTP client telemetry. + type: list + default: '' + - name: otel.instrumentation.common.peer-service-mapping + description: Used to specify a mapping from host names or IP addresses to peer + services. + type: map + default: '' + - name: otel.instrumentation.http.client.emit-experimental-telemetry + description: | + Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size` and `http.response.body.size` attributes to spans, and records `http.client.request.size` and `http.client.response.size` metrics. + type: boolean + default: false + - name: otel.instrumentation.http.client.experimental.redact-query-parameters + description: Redact sensitive URL parameters. See https://opentelemetry.io/docs/specs/semconv/http/http-spans. + type: boolean + default: true + telemetry: + - when: default + metrics: + - name: http.client.request.duration + description: Duration of HTTP client requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + spans: + - span_kind: CLIENT + attributes: + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.request.method_original + type: STRING + - name: http.request.resend_count + type: LONG + - name: http.response.status_code + type: LONG + - name: network.protocol.version + type: STRING + - name: peer.service + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.full + type: STRING - name: ktor-3.0 + description: | + This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP client, and enriches HTTP server spans with route information for the Ktor server. + semantic_conventions: + - HTTP_CLIENT_SPANS + - HTTP_CLIENT_METRICS + library_link: https://ktor.io/ + features: + - HTTP_ROUTE source_path: instrumentation/ktor/ktor-3.0 scope: name: io.opentelemetry.ktor-3.0 + schema_url: https://opentelemetry.io/schemas/1.37.0 target_versions: javaagent: - io.ktor:ktor-server-core:[3.0.0,) @@ -8325,6 +8527,75 @@ libraries: library: - io.ktor:ktor-server-core:3.0.0 - io.ktor:ktor-client-core:3.0.0 + configurations: + - name: otel.instrumentation.http.known-methods + description: | + Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as `_OTHER`. + type: list + default: CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE + - name: otel.instrumentation.http.client.capture-request-headers + description: List of HTTP request headers to capture in HTTP client telemetry. + type: list + default: '' + - name: otel.instrumentation.http.client.capture-response-headers + description: List of HTTP response headers to capture in HTTP client telemetry. + type: list + default: '' + - name: otel.instrumentation.common.peer-service-mapping + description: Used to specify a mapping from host names or IP addresses to peer + services. + type: map + default: '' + - name: otel.instrumentation.http.client.emit-experimental-telemetry + description: | + Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size` and `http.response.body.size` attributes to spans, and records `http.client.request.size` and `http.client.response.size` metrics. + type: boolean + default: false + - name: otel.instrumentation.http.client.experimental.redact-query-parameters + description: Redact sensitive URL parameters. See https://opentelemetry.io/docs/specs/semconv/http/http-spans. + type: boolean + default: true + telemetry: + - when: default + metrics: + - name: http.client.request.duration + description: Duration of HTTP client requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + spans: + - span_kind: CLIENT + attributes: + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.request.method_original + type: STRING + - name: http.request.resend_count + type: LONG + - name: http.response.status_code + type: LONG + - name: network.protocol.version + type: STRING + - name: peer.service + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.full + type: STRING kubernetes: - name: kubernetes-client-7.0 source_path: instrumentation/kubernetes-client-7.0 diff --git a/instrumentation-docs/instrumentations.sh b/instrumentation-docs/instrumentations.sh index 0ee9ec03592d..7b3cfacf7130 100755 --- a/instrumentation-docs/instrumentations.sh +++ b/instrumentation-docs/instrumentations.sh @@ -148,6 +148,9 @@ readonly INSTRUMENTATIONS=( "jsf:jsf-myfaces-3.0:javaagent:test" "kafka:kafka-clients:kafka-clients-2.6:library:test" "kafka:kafka-connect-2.6:testing:test" + "ktor:ktor-1.0:library:test" + "ktor:ktor-2.0:javaagent:test" + "ktor:ktor-3.0:javaagent:test" "nats:nats-2.17:javaagent:test" "nats:nats-2.17:javaagent:testExperimental" "netty:netty-3.8:javaagent:test" diff --git a/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml new file mode 100644 index 000000000000..227c20c2ade8 --- /dev/null +++ b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml @@ -0,0 +1,13 @@ +description: > + This instrumentation enables context propagation for Kotlin coroutines and adds support for + @WithSpan annotations on Kotlin suspend functions, it does not emit any telemetry on its own. +display_name: Kotlin Coroutines +features: + - CONTEXT_PROPAGATION +library_link: https://github.com/Kotlin/kotlinx.coroutines +configurations: + - name: otel.instrumentation.kotlinx-coroutines.check-class + description: > + Enables bytecode verification with ASM CheckClassAdapter for debugging transformed classes. + type: boolean + default: false \ No newline at end of file diff --git a/instrumentation/kotlinx-coroutines/kotlinx-coroutines-flow-1.3/metadata.yaml b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-flow-1.3/metadata.yaml new file mode 100644 index 000000000000..cdd8778457a3 --- /dev/null +++ b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-flow-1.3/metadata.yaml @@ -0,0 +1,5 @@ +description: > + This instrumentation adds support for @WithSpan annotations on methods that return Kotlin Flow, + it does not emit any telemetry on its own. +display_name: Kotlin Coroutines Flow +library_link: https://github.com/Kotlin/kotlinx.coroutines \ No newline at end of file diff --git a/instrumentation/ktor/ktor-1.0/library/build.gradle.kts b/instrumentation/ktor/ktor-1.0/library/build.gradle.kts index d3c7b299c4e0..2ab388e186b6 100644 --- a/instrumentation/ktor/ktor-1.0/library/build.gradle.kts +++ b/instrumentation/ktor/ktor-1.0/library/build.gradle.kts @@ -33,4 +33,7 @@ kotlin { tasks.withType().configureEach { jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") + + systemProperty("metadataConfig", "otel.instrumentation.common.experimental.controller-telemetry.enabled=true") + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } diff --git a/instrumentation/ktor/ktor-1.0/metadata.yaml b/instrumentation/ktor/ktor-1.0/metadata.yaml new file mode 100644 index 000000000000..b901b69f7751 --- /dev/null +++ b/instrumentation/ktor/ktor-1.0/metadata.yaml @@ -0,0 +1,7 @@ +description: This instrumentation enables HTTP server spans and HTTP server metrics for the Ktor server. +semantic_conventions: + - HTTP_SERVER_SPANS + - HTTP_SERVER_METRICS +features: + - HTTP_ROUTE +library_link: https://ktor.io/ diff --git a/instrumentation/ktor/ktor-2.0/javaagent/build.gradle.kts b/instrumentation/ktor/ktor-2.0/javaagent/build.gradle.kts index d2a8b8880ad7..e58f1115b8d2 100644 --- a/instrumentation/ktor/ktor-2.0/javaagent/build.gradle.kts +++ b/instrumentation/ktor/ktor-2.0/javaagent/build.gradle.kts @@ -59,3 +59,7 @@ kotlin { javaParameters = true } } + +tasks.test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") +} diff --git a/instrumentation/ktor/ktor-2.0/metadata.yaml b/instrumentation/ktor/ktor-2.0/metadata.yaml new file mode 100644 index 000000000000..5fbddcc5f233 --- /dev/null +++ b/instrumentation/ktor/ktor-2.0/metadata.yaml @@ -0,0 +1,39 @@ +description: > + This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP + client, and enriches HTTP server spans with route information for the Ktor server. +semantic_conventions: + - HTTP_CLIENT_SPANS + - HTTP_CLIENT_METRICS +features: + - HTTP_ROUTE +library_link: https://ktor.io/ +configurations: + - name: otel.instrumentation.http.known-methods + description: > + Configures the instrumentation to recognize an alternative set of HTTP request methods. All + other methods will be treated as `_OTHER`. + type: list + default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE" + - name: otel.instrumentation.http.client.capture-request-headers + description: List of HTTP request headers to capture in HTTP client telemetry. + type: list + default: "" + - name: otel.instrumentation.http.client.capture-response-headers + description: List of HTTP response headers to capture in HTTP client telemetry. + type: list + default: "" + - name: otel.instrumentation.common.peer-service-mapping + description: Used to specify a mapping from host names or IP addresses to peer services. + type: map + default: "" + - name: otel.instrumentation.http.client.emit-experimental-telemetry + description: > + Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size` + and `http.response.body.size` attributes to spans, and records `http.client.request.size` and + `http.client.response.size` metrics. + type: boolean + default: false + - name: otel.instrumentation.http.client.experimental.redact-query-parameters + description: Redact sensitive URL parameters. See https://opentelemetry.io/docs/specs/semconv/http/http-spans. + type: boolean + default: true diff --git a/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts b/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts index 7f2aa66d5dcc..2aa9631ff447 100644 --- a/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts +++ b/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts @@ -54,3 +54,7 @@ kotlin { javaParameters = true } } + +tasks.test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") +} diff --git a/instrumentation/ktor/ktor-3.0/metadata.yaml b/instrumentation/ktor/ktor-3.0/metadata.yaml new file mode 100644 index 000000000000..5fbddcc5f233 --- /dev/null +++ b/instrumentation/ktor/ktor-3.0/metadata.yaml @@ -0,0 +1,39 @@ +description: > + This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP + client, and enriches HTTP server spans with route information for the Ktor server. +semantic_conventions: + - HTTP_CLIENT_SPANS + - HTTP_CLIENT_METRICS +features: + - HTTP_ROUTE +library_link: https://ktor.io/ +configurations: + - name: otel.instrumentation.http.known-methods + description: > + Configures the instrumentation to recognize an alternative set of HTTP request methods. All + other methods will be treated as `_OTHER`. + type: list + default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE" + - name: otel.instrumentation.http.client.capture-request-headers + description: List of HTTP request headers to capture in HTTP client telemetry. + type: list + default: "" + - name: otel.instrumentation.http.client.capture-response-headers + description: List of HTTP response headers to capture in HTTP client telemetry. + type: list + default: "" + - name: otel.instrumentation.common.peer-service-mapping + description: Used to specify a mapping from host names or IP addresses to peer services. + type: map + default: "" + - name: otel.instrumentation.http.client.emit-experimental-telemetry + description: > + Enable the capture of experimental HTTP client telemetry. Adds the `http.request.body.size` + and `http.response.body.size` attributes to spans, and records `http.client.request.size` and + `http.client.response.size` metrics. + type: boolean + default: false + - name: otel.instrumentation.http.client.experimental.redact-query-parameters + description: Redact sensitive URL parameters. See https://opentelemetry.io/docs/specs/semconv/http/http-spans. + type: boolean + default: true From 16e30adedfd725bd31e72a9b416a122c118058f4 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 13 Nov 2025 20:05:35 -0500 Subject: [PATCH 2/5] remove unneeded config --- docs/instrumentation-list.yaml | 19 +------------------ .../ktor/ktor-1.0/library/build.gradle.kts | 5 +---- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index a95f8974b0ef..8b61769f2025 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -6865,23 +6865,6 @@ libraries: target_versions: javaagent: - org.apache.tomcat:tomcat-jasper:[7.0.19,10) - telemetry: - - when: otel.instrumentation.common.experimental.view-telemetry.enabled=true - spans: - - span_kind: INTERNAL - attributes: [] - - when: otel.instrumentation.common.experimental.view-telemetry.enabled=true,otel.instrumentation.jsp.experimental-span-attributes=true - spans: - - span_kind: INTERNAL - attributes: - - name: jsp.classFQCN - type: STRING - - name: jsp.compiler - type: STRING - - name: jsp.forwardOrigin - type: STRING - - name: jsp.requestURL - type: STRING kafka: - name: kafka-clients-0.11 display_name: Apache Kafka Client @@ -8346,7 +8329,7 @@ libraries: library: - io.ktor:ktor-server-core:[1.0.0,1.+) telemetry: - - when: otel.instrumentation.common.experimental.controller-telemetry.enabled=true + - when: default metrics: - name: http.server.request.duration description: Duration of HTTP server requests. diff --git a/instrumentation/ktor/ktor-1.0/library/build.gradle.kts b/instrumentation/ktor/ktor-1.0/library/build.gradle.kts index 2ab388e186b6..401b8f02a893 100644 --- a/instrumentation/ktor/ktor-1.0/library/build.gradle.kts +++ b/instrumentation/ktor/ktor-1.0/library/build.gradle.kts @@ -31,9 +31,6 @@ kotlin { } } -tasks.withType().configureEach { - jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") - - systemProperty("metadataConfig", "otel.instrumentation.common.experimental.controller-telemetry.enabled=true") +tasks.test { systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } From a468e8392470998e139ebd7bb52160c997047fdd Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Thu, 13 Nov 2025 20:13:23 -0500 Subject: [PATCH 3/5] fix --- docs/instrumentation-list.yaml | 4 ++-- instrumentation/ktor/ktor-1.0/metadata.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index 8b61769f2025..3d483187d8be 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -8313,8 +8313,8 @@ libraries: - org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:[1.3.9,) ktor: - name: ktor-1.0 - description: This instrumentation enables HTTP server spans and HTTP server metrics - for the Ktor server. + description: This standalone instrumentation enables HTTP server spans and HTTP + server metrics for the Ktor server. semantic_conventions: - HTTP_SERVER_SPANS - HTTP_SERVER_METRICS diff --git a/instrumentation/ktor/ktor-1.0/metadata.yaml b/instrumentation/ktor/ktor-1.0/metadata.yaml index b901b69f7751..413525d795e5 100644 --- a/instrumentation/ktor/ktor-1.0/metadata.yaml +++ b/instrumentation/ktor/ktor-1.0/metadata.yaml @@ -1,4 +1,4 @@ -description: This instrumentation enables HTTP server spans and HTTP server metrics for the Ktor server. +description: This standalone instrumentation enables HTTP server spans and HTTP server metrics for the Ktor server. semantic_conventions: - HTTP_SERVER_SPANS - HTTP_SERVER_METRICS From ce7699ba2a806f79c542cdc9196f66befa6c6f9e Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Fri, 14 Nov 2025 06:50:10 -0500 Subject: [PATCH 4/5] use library instead --- docs/instrumentation-list.yaml | 146 +++++++++++++++++- instrumentation-docs/instrumentations.sh | 4 +- .../ktor/ktor-2.0/library/build.gradle.kts | 4 + instrumentation/ktor/ktor-2.0/metadata.yaml | 21 ++- .../ktor/ktor-3.0/javaagent/build.gradle.kts | 4 - .../ktor/ktor-3.0/library/build.gradle.kts | 4 + instrumentation/ktor/ktor-3.0/metadata.yaml | 21 ++- 7 files changed, 188 insertions(+), 16 deletions(-) diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index 3d483187d8be..1f6237e40711 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -8403,8 +8403,10 @@ libraries: type: STRING - name: ktor-2.0 description: | - This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP client, and enriches HTTP server spans with route information for the Ktor server. + This instrumentation provides HTTP server spans and HTTP server metrics for the Ktor server, and HTTP client spans and HTTP client metrics for the Ktor HTTP client. semantic_conventions: + - HTTP_SERVER_SPANS + - HTTP_SERVER_METRICS - HTTP_CLIENT_SPANS - HTTP_CLIENT_METRICS library_link: https://ktor.io/ @@ -8427,6 +8429,19 @@ libraries: Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as `_OTHER`. type: list default: CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE + - name: otel.instrumentation.http.server.capture-request-headers + description: List of HTTP request headers to capture in HTTP server telemetry. + type: list + default: '' + - name: otel.instrumentation.http.server.capture-response-headers + description: List of HTTP response headers to capture in HTTP server telemetry. + type: list + default: '' + - name: otel.instrumentation.http.server.emit-experimental-telemetry + description: | + Enable the capture of experimental HTTP server telemetry. Adds the `http.request.body.size` and `http.response.body.size` attributes to spans, and records `http.server.request.size` and `http.server.response.size` metrics. + type: boolean + default: false - name: otel.instrumentation.http.client.capture-request-headers description: List of HTTP request headers to capture in HTTP client telemetry. type: list @@ -8467,6 +8482,21 @@ libraries: type: STRING - name: server.port type: LONG + - name: http.server.request.duration + description: Duration of HTTP server requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.protocol.version + type: STRING + - name: url.scheme + type: STRING spans: - span_kind: CLIENT attributes: @@ -8482,18 +8512,68 @@ libraries: type: LONG - name: network.protocol.version type: STRING - - name: peer.service - type: STRING - name: server.address type: STRING - name: server.port type: LONG - name: url.full type: STRING + - span_kind: CONSUMER + attributes: + - name: client.address + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING + - span_kind: SERVER + attributes: + - name: client.address + type: STRING + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.request.method_original + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING - name: ktor-3.0 description: | - This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP client, and enriches HTTP server spans with route information for the Ktor server. + This instrumentation provides HTTP server spans and HTTP server metrics for the Ktor server, and HTTP client spans and HTTP client metrics for the Ktor HTTP client. semantic_conventions: + - HTTP_SERVER_SPANS + - HTTP_SERVER_METRICS - HTTP_CLIENT_SPANS - HTTP_CLIENT_METRICS library_link: https://ktor.io/ @@ -8516,6 +8596,19 @@ libraries: Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as `_OTHER`. type: list default: CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE + - name: otel.instrumentation.http.server.capture-request-headers + description: List of HTTP request headers to capture in HTTP server telemetry. + type: list + default: '' + - name: otel.instrumentation.http.server.capture-response-headers + description: List of HTTP response headers to capture in HTTP server telemetry. + type: list + default: '' + - name: otel.instrumentation.http.server.emit-experimental-telemetry + description: | + Enable the capture of experimental HTTP server telemetry. Adds the `http.request.body.size` and `http.response.body.size` attributes to spans, and records `http.server.request.size` and `http.server.response.size` metrics. + type: boolean + default: false - name: otel.instrumentation.http.client.capture-request-headers description: List of HTTP request headers to capture in HTTP client telemetry. type: list @@ -8556,6 +8649,21 @@ libraries: type: STRING - name: server.port type: LONG + - name: http.server.request.duration + description: Duration of HTTP server requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.protocol.version + type: STRING + - name: url.scheme + type: STRING spans: - span_kind: CLIENT attributes: @@ -8571,14 +8679,40 @@ libraries: type: LONG - name: network.protocol.version type: STRING - - name: peer.service - type: STRING - name: server.address type: STRING - name: server.port type: LONG - name: url.full type: STRING + - span_kind: SERVER + attributes: + - name: client.address + type: STRING + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.request.method_original + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING kubernetes: - name: kubernetes-client-7.0 source_path: instrumentation/kubernetes-client-7.0 diff --git a/instrumentation-docs/instrumentations.sh b/instrumentation-docs/instrumentations.sh index 7b3cfacf7130..b5ead6f77761 100755 --- a/instrumentation-docs/instrumentations.sh +++ b/instrumentation-docs/instrumentations.sh @@ -149,8 +149,8 @@ readonly INSTRUMENTATIONS=( "kafka:kafka-clients:kafka-clients-2.6:library:test" "kafka:kafka-connect-2.6:testing:test" "ktor:ktor-1.0:library:test" - "ktor:ktor-2.0:javaagent:test" - "ktor:ktor-3.0:javaagent:test" + "ktor:ktor-2.0:library:test" + "ktor:ktor-3.0:library:test" "nats:nats-2.17:javaagent:test" "nats:nats-2.17:javaagent:testExperimental" "netty:netty-3.8:javaagent:test" diff --git a/instrumentation/ktor/ktor-2.0/library/build.gradle.kts b/instrumentation/ktor/ktor-2.0/library/build.gradle.kts index 84605f1c34fd..e25aa104ca4a 100644 --- a/instrumentation/ktor/ktor-2.0/library/build.gradle.kts +++ b/instrumentation/ktor/ktor-2.0/library/build.gradle.kts @@ -37,3 +37,7 @@ kotlin { languageVersion.set(KotlinVersion.KOTLIN_1_8) } } + +tasks.test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") +} diff --git a/instrumentation/ktor/ktor-2.0/metadata.yaml b/instrumentation/ktor/ktor-2.0/metadata.yaml index 5fbddcc5f233..39f924089fd1 100644 --- a/instrumentation/ktor/ktor-2.0/metadata.yaml +++ b/instrumentation/ktor/ktor-2.0/metadata.yaml @@ -1,7 +1,9 @@ description: > - This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP - client, and enriches HTTP server spans with route information for the Ktor server. + This instrumentation provides HTTP server spans and HTTP server metrics for the Ktor server, + and HTTP client spans and HTTP client metrics for the Ktor HTTP client. semantic_conventions: + - HTTP_SERVER_SPANS + - HTTP_SERVER_METRICS - HTTP_CLIENT_SPANS - HTTP_CLIENT_METRICS features: @@ -14,6 +16,21 @@ configurations: other methods will be treated as `_OTHER`. type: list default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE" + - name: otel.instrumentation.http.server.capture-request-headers + description: List of HTTP request headers to capture in HTTP server telemetry. + type: list + default: "" + - name: otel.instrumentation.http.server.capture-response-headers + description: List of HTTP response headers to capture in HTTP server telemetry. + type: list + default: "" + - name: otel.instrumentation.http.server.emit-experimental-telemetry + description: > + Enable the capture of experimental HTTP server telemetry. Adds the `http.request.body.size` + and `http.response.body.size` attributes to spans, and records `http.server.request.size` and + `http.server.response.size` metrics. + type: boolean + default: false - name: otel.instrumentation.http.client.capture-request-headers description: List of HTTP request headers to capture in HTTP client telemetry. type: list diff --git a/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts b/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts index 2aa9631ff447..7f2aa66d5dcc 100644 --- a/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts +++ b/instrumentation/ktor/ktor-3.0/javaagent/build.gradle.kts @@ -54,7 +54,3 @@ kotlin { javaParameters = true } } - -tasks.test { - systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") -} diff --git a/instrumentation/ktor/ktor-3.0/library/build.gradle.kts b/instrumentation/ktor/ktor-3.0/library/build.gradle.kts index e440675c154d..cd21bb77c707 100644 --- a/instrumentation/ktor/ktor-3.0/library/build.gradle.kts +++ b/instrumentation/ktor/ktor-3.0/library/build.gradle.kts @@ -32,3 +32,7 @@ kotlin { languageVersion.set(KotlinVersion.KOTLIN_1_8) } } + +tasks.test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") +} diff --git a/instrumentation/ktor/ktor-3.0/metadata.yaml b/instrumentation/ktor/ktor-3.0/metadata.yaml index 5fbddcc5f233..39f924089fd1 100644 --- a/instrumentation/ktor/ktor-3.0/metadata.yaml +++ b/instrumentation/ktor/ktor-3.0/metadata.yaml @@ -1,7 +1,9 @@ description: > - This instrumentation enables HTTP client spans and HTTP client metrics for the Ktor HTTP - client, and enriches HTTP server spans with route information for the Ktor server. + This instrumentation provides HTTP server spans and HTTP server metrics for the Ktor server, + and HTTP client spans and HTTP client metrics for the Ktor HTTP client. semantic_conventions: + - HTTP_SERVER_SPANS + - HTTP_SERVER_METRICS - HTTP_CLIENT_SPANS - HTTP_CLIENT_METRICS features: @@ -14,6 +16,21 @@ configurations: other methods will be treated as `_OTHER`. type: list default: "CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE" + - name: otel.instrumentation.http.server.capture-request-headers + description: List of HTTP request headers to capture in HTTP server telemetry. + type: list + default: "" + - name: otel.instrumentation.http.server.capture-response-headers + description: List of HTTP response headers to capture in HTTP server telemetry. + type: list + default: "" + - name: otel.instrumentation.http.server.emit-experimental-telemetry + description: > + Enable the capture of experimental HTTP server telemetry. Adds the `http.request.body.size` + and `http.response.body.size` attributes to spans, and records `http.server.request.size` and + `http.server.response.size` metrics. + type: boolean + default: false - name: otel.instrumentation.http.client.capture-request-headers description: List of HTTP request headers to capture in HTTP client telemetry. type: list From d4989a38ad01160bed27df851144094df9c74d38 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Sat, 15 Nov 2025 10:30:14 -0500 Subject: [PATCH 5/5] remove unneeded config --- docs/instrumentation-list.yaml | 6 ------ .../kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index 1f6237e40711..a3e4645d51b9 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -8293,12 +8293,6 @@ libraries: javaagent: - org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:[1.3.9,) - org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.0.0,1.3.8) - configurations: - - name: otel.instrumentation.kotlinx-coroutines.check-class - description: | - Enables bytecode verification with ASM CheckClassAdapter for debugging transformed classes. - type: boolean - default: false - name: kotlinx-coroutines-flow-1.3 display_name: Kotlin Coroutines Flow description: | diff --git a/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml index 227c20c2ade8..72eccb28b607 100644 --- a/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml +++ b/instrumentation/kotlinx-coroutines/kotlinx-coroutines-1.0/metadata.yaml @@ -5,9 +5,3 @@ display_name: Kotlin Coroutines features: - CONTEXT_PROPAGATION library_link: https://github.com/Kotlin/kotlinx.coroutines -configurations: - - name: otel.instrumentation.kotlinx-coroutines.check-class - description: > - Enables bytecode verification with ASM CheckClassAdapter for debugging transformed classes. - type: boolean - default: false \ No newline at end of file