diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index ab45de2f1fd7..6286267959ad 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -3562,6 +3562,8 @@ libraries: - org.hibernate.reactive:hibernate-reactive-core:(,) hikaricp: - name: hikaricp-3.0 + description: | + This instrumentation provides database client metrics for HikariCP 3.0+ connection pools. It reports metrics like connection timeouts, creation time, wait time, and usage time, along with connection pool statistics such as the number of active, idle, and pending connections. source_path: instrumentation/hikaricp-3.0 scope: name: io.opentelemetry.hikaricp-3.0 @@ -3700,12 +3702,42 @@ libraries: type: STRING http: - name: http-url-connection + description: | + This instrumentation enables the generation of HTTP client spans and HTTP client metrics for requests made using `java.net.HttpURLConnection`. source_path: instrumentation/http-url-connection scope: name: io.opentelemetry.http-url-connection target_versions: javaagent: - Java 8+ + 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: @@ -3774,14 +3806,67 @@ libraries: type: STRING influxdb: - name: influxdb-2.4 + description: This instrumentation enables the generation of database client spans + and metrics for the InfluxDB Java client. source_path: instrumentation/influxdb-2.4 scope: name: io.opentelemetry.influxdb-2.4 target_versions: javaagent: - org.influxdb:influxdb-java:[2.4,) + telemetry: + - when: default + spans: + - span_kind: CLIENT + attributes: + - name: db.name + type: STRING + - name: db.operation + type: STRING + - name: db.statement + type: STRING + - name: db.system + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - when: otel.semconv-stability.opt-in=database + metrics: + - name: db.client.operation.duration + description: Duration of database client operations. + type: HISTOGRAM + unit: s + attributes: + - name: db.namespace + type: STRING + - name: db.operation.name + type: STRING + - name: db.system.name + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + spans: + - span_kind: CLIENT + attributes: + - name: db.namespace + type: STRING + - name: db.operation.name + type: STRING + - name: db.query.text + type: STRING + - name: db.system.name + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG java: - name: java-http-client + description: This instrumentation enables HTTP client spans and HTTP client metrics + for requests made using the Java HTTP client. source_path: instrumentation/java-http-client minimum_java_version: 11 scope: @@ -3789,6 +3874,34 @@ libraries: target_versions: javaagent: - Java 11+ + 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: @@ -3827,14 +3940,91 @@ libraries: - name: url.full type: STRING - name: java-http-server + description: This instrumentation enables HTTP server spans and HTTP server metrics + for the Java HTTP server. source_path: instrumentation/java-http-server scope: name: io.opentelemetry.java-http-server target_versions: javaagent: - Java 8+ + 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.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.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.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.body.size` and `http.server.response.body.size` metrics. + type: boolean + default: false + telemetry: + - when: default + 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: SERVER + attributes: + - name: client.address + type: STRING + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.peer.address + type: STRING + - name: network.peer.port + 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 javalin: - name: javalin-5.0 + description: This instrumentation enriches existing HTTP server spans with route information, + it does not emit any telemetry on its own. source_path: instrumentation/javalin-5.0 minimum_java_version: 11 scope: diff --git a/instrumentation-docs/instrumentations.sh b/instrumentation-docs/instrumentations.sh index cf1dae35db16..d6cfa2d5bb7e 100755 --- a/instrumentation-docs/instrumentations.sh +++ b/instrumentation-docs/instrumentations.sh @@ -153,6 +153,9 @@ readonly INSTRUMENTATIONS=( "hibernate:hibernate-procedure-call-4.3:javaagent:testExperimental" "hystrix-1.4:javaagent:test" "hystrix-1.4:javaagent:testExperimental" + "influxdb-2.4:javaagent:test" + "influxdb-2.4:javaagent:testStableSemconv" + "java-http-server:javaagent:test" ) # Some instrumentation test suites don't run ARM, so we use colima to run them in an x86_64 diff --git a/instrumentation/hikaricp-3.0/metadata.yaml b/instrumentation/hikaricp-3.0/metadata.yaml new file mode 100644 index 000000000000..59cdb7f5812f --- /dev/null +++ b/instrumentation/hikaricp-3.0/metadata.yaml @@ -0,0 +1,4 @@ +description: > + This instrumentation provides database client metrics for HikariCP 3.0+ connection pools. It + reports metrics like connection timeouts, creation time, wait time, and usage time, along with + connection pool statistics such as the number of active, idle, and pending connections. diff --git a/instrumentation/http-url-connection/metadata.yaml b/instrumentation/http-url-connection/metadata.yaml new file mode 100644 index 000000000000..3d2ea9234050 --- /dev/null +++ b/instrumentation/http-url-connection/metadata.yaml @@ -0,0 +1,33 @@ +description: > + This instrumentation enables the generation of HTTP client spans and HTTP client metrics for + requests made using `java.net.HttpURLConnection`. +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/influxdb-2.4/javaagent/build.gradle.kts b/instrumentation/influxdb-2.4/javaagent/build.gradle.kts index 7274caea651d..6143eb0fd014 100644 --- a/instrumentation/influxdb-2.4/javaagent/build.gradle.kts +++ b/instrumentation/influxdb-2.4/javaagent/build.gradle.kts @@ -41,6 +41,7 @@ tasks { // from the okhttp instrumentation we need OkHttp3IgnoredTypesConfigurer to fix context leaks jvmArgs("-Dotel.instrumentation.okhttp.enabled=false") usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") } if (!(findProperty("testLatestDeps") as Boolean)) { @@ -53,6 +54,7 @@ tasks { testClassesDirs = sourceSets.test.get().output.classesDirs classpath = sourceSets.test.get().runtimeClasspath + systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database") jvmArgs("-Dotel.semconv-stability.opt-in=database") } diff --git a/instrumentation/influxdb-2.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbClientTest.java b/instrumentation/influxdb-2.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbClientTest.java index c3650f6fa05f..19adf74b6ce4 100644 --- a/instrumentation/influxdb-2.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbClientTest.java +++ b/instrumentation/influxdb-2.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbClientTest.java @@ -5,14 +5,18 @@ package io.opentelemetry.javaagent.instrumentation.influxdb.v2_4; +import static io.opentelemetry.instrumentation.testing.junit.db.DbClientMetricsTestUtil.assertDurationMetric; import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS; import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT; import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_NAME; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_NAMESPACE; import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION_NAME; import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_STATEMENT; import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM; +import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM_NAME; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; @@ -150,6 +154,15 @@ void testQueryWithTwoArguments() { "SELECT * FROM cpu_load where test1 = ?", "SELECT", databaseName)))); + + assertDurationMetric( + testing, + "io.opentelemetry.influxdb-2.4", + DB_SYSTEM_NAME, + DB_NAMESPACE, + DB_OPERATION_NAME, + SERVER_ADDRESS, + SERVER_PORT); } @Test diff --git a/instrumentation/influxdb-2.4/metadata.yaml b/instrumentation/influxdb-2.4/metadata.yaml new file mode 100644 index 000000000000..fc4040fb3abb --- /dev/null +++ b/instrumentation/influxdb-2.4/metadata.yaml @@ -0,0 +1 @@ +description: This instrumentation enables the generation of database client spans and metrics for the InfluxDB Java client. diff --git a/instrumentation/java-http-client/metadata.yaml b/instrumentation/java-http-client/metadata.yaml new file mode 100644 index 000000000000..f7463c9e0171 --- /dev/null +++ b/instrumentation/java-http-client/metadata.yaml @@ -0,0 +1,31 @@ +description: This instrumentation enables HTTP client spans and HTTP client metrics for requests made using the Java HTTP client. +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/java-http-server/javaagent/build.gradle.kts b/instrumentation/java-http-server/javaagent/build.gradle.kts index 1c8be721a562..537a9539f9ed 100644 --- a/instrumentation/java-http-server/javaagent/build.gradle.kts +++ b/instrumentation/java-http-server/javaagent/build.gradle.kts @@ -12,3 +12,7 @@ dependencies { implementation(project(":instrumentation:java-http-server:library")) testImplementation(project(":instrumentation:java-http-server:testing")) } + +tasks.test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") +} diff --git a/instrumentation/java-http-server/metadata.yaml b/instrumentation/java-http-server/metadata.yaml new file mode 100644 index 000000000000..e85c9b40e740 --- /dev/null +++ b/instrumentation/java-http-server/metadata.yaml @@ -0,0 +1,27 @@ +description: This instrumentation enables HTTP server spans and HTTP server metrics for the Java HTTP server. +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.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.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.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.body.size` + and `http.server.response.body.size` metrics. + type: boolean + default: false diff --git a/instrumentation/javalin-5.0/metadata.yaml b/instrumentation/javalin-5.0/metadata.yaml new file mode 100644 index 000000000000..828e20314bdc --- /dev/null +++ b/instrumentation/javalin-5.0/metadata.yaml @@ -0,0 +1 @@ +description: This instrumentation enriches existing HTTP server spans with route information, it does not emit any telemetry on its own.