Skip to content

Commit 98eb920

Browse files
committed
Fix clickhouse v2 tests and add metadata
1 parent 3372ba6 commit 98eb920

File tree

6 files changed

+94
-17
lines changed

6 files changed

+94
-17
lines changed

docs/instrumentation-list.yaml

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,13 +2097,13 @@ libraries:
20972097
- name: server.port
20982098
type: LONG
20992099
clickhouse:
2100-
- name: clickhouse-client-0.5
2101-
description: Instruments the V1 ClickHouseClient, providing database client spans
2102-
and metrics.
2100+
- name: clickhouse-client-v1-0.5
2101+
description: This instrumentation enables database client spans and metrics for
2102+
the V1 ClickHouse client.
21032103
library_link: https://github.com/ClickHouse/clickhouse-java
2104-
source_path: instrumentation/clickhouse-client-0.5
2104+
source_path: instrumentation/clickhouse/clickhouse-client-v1-0.5
21052105
scope:
2106-
name: io.opentelemetry.clickhouse-client-0.5
2106+
name: io.opentelemetry.clickhouse-client-v1-0.5
21072107
target_versions:
21082108
javaagent:
21092109
- com.clickhouse.client:clickhouse-client:[0.5.0,)
@@ -2165,6 +2165,74 @@ libraries:
21652165
type: STRING
21662166
- name: server.port
21672167
type: LONG
2168+
- name: clickhouse-client-v2-0.8
2169+
description: This instrumentation enables database client spans and metrics for
2170+
the V2 ClickHouse client.
2171+
library_link: https://github.com/ClickHouse/clickhouse-java
2172+
source_path: instrumentation/clickhouse/clickhouse-client-v2-0.8
2173+
scope:
2174+
name: io.opentelemetry.clickhouse-client-v2-0.8
2175+
target_versions:
2176+
javaagent:
2177+
- com.clickhouse:client-v2:[0.6.4,)
2178+
configurations:
2179+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
2180+
description: Enables statement sanitization for database queries.
2181+
type: boolean
2182+
default: true
2183+
telemetry:
2184+
- when: default
2185+
spans:
2186+
- span_kind: CLIENT
2187+
attributes:
2188+
- name: db.name
2189+
type: STRING
2190+
- name: db.operation
2191+
type: STRING
2192+
- name: db.statement
2193+
type: STRING
2194+
- name: db.system
2195+
type: STRING
2196+
- name: server.address
2197+
type: STRING
2198+
- name: server.port
2199+
type: LONG
2200+
- when: otel.semconv-stability.opt-in=database
2201+
metrics:
2202+
- name: db.client.operation.duration
2203+
description: Duration of database client operations.
2204+
type: HISTOGRAM
2205+
unit: s
2206+
attributes:
2207+
- name: db.namespace
2208+
type: STRING
2209+
- name: db.operation.name
2210+
type: STRING
2211+
- name: db.system.name
2212+
type: STRING
2213+
- name: server.address
2214+
type: STRING
2215+
- name: server.port
2216+
type: LONG
2217+
spans:
2218+
- span_kind: CLIENT
2219+
attributes:
2220+
- name: db.namespace
2221+
type: STRING
2222+
- name: db.operation.name
2223+
type: STRING
2224+
- name: db.query.text
2225+
type: STRING
2226+
- name: db.response.status_code
2227+
type: STRING
2228+
- name: db.system.name
2229+
type: STRING
2230+
- name: error.type
2231+
type: STRING
2232+
- name: server.address
2233+
type: STRING
2234+
- name: server.port
2235+
type: LONG
21682236
couchbase:
21692237
- name: couchbase-2.0
21702238
description: |
@@ -4072,8 +4140,8 @@ libraries:
40724140
type: STRING
40734141
javalin:
40744142
- name: javalin-5.0
4075-
description: This instrumentation enriches existing HTTP server spans with route information,
4076-
it does not emit any telemetry on its own.
4143+
description: This instrumentation enriches existing HTTP server spans with route
4144+
information, it does not emit any telemetry on its own.
40774145
source_path: instrumentation/javalin-5.0
40784146
minimum_java_version: 11
40794147
scope:
@@ -6550,6 +6618,7 @@ libraries:
65506618
description: This instrumentation enriches HTTP server spans and metrics with
65516619
route information.
65526620
source_path: instrumentation/spring/spring-web/spring-web-6.0
6621+
minimum_java_version: 17
65536622
scope:
65546623
name: io.opentelemetry.spring-web-6.0
65556624
target_versions:

instrumentation-docs/instrumentations.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ readonly INSTRUMENTATIONS=(
2222
"apache-dubbo-2.7:javaagent:testDubbo"
2323
"c3p0-0.9:javaagent:test"
2424
"c3p0-0.9:javaagent:testStableSemconv"
25-
"clickhouse-client-0.5:javaagent:test"
26-
"clickhouse-client-0.5:javaagent:testStableSemconv"
25+
"clickhouse:clickhouse-client-v1-0.5:javaagent:test"
26+
"clickhouse:clickhouse-client-v1-0.5:javaagent:testStableSemconv"
27+
"clickhouse:clickhouse-client-v2-0.8:javaagent:test"
28+
"clickhouse:clickhouse-client-v2-0.8:javaagent:testStableSemconv"
2729
"aws-sdk:aws-sdk-1.11:javaagent:test"
2830
"google-http-client-1.19:javaagent:test"
2931
"http-url-connection:javaagent:test"

instrumentation/clickhouse/clickhouse-client-v1-0.5/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
description: Instruments the V1 ClickHouseClient, providing database client spans and metrics.
1+
description: This instrumentation enables database client spans and metrics for the V1 ClickHouse client.
22
library_link: https://github.com/ClickHouse/clickhouse-java
33
configurations:
44
- name: otel.instrumentation.common.db-statement-sanitizer.enabled

instrumentation/clickhouse/clickhouse-client-v2-0.8/javaagent/build.gradle.kts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@ dependencies {
1616
library("com.clickhouse:client-v2:0.8.0")
1717
}
1818

19-
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
20-
2119
tasks {
22-
test {
20+
withType<Test>().configureEach {
2321
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
24-
systemProperty("collectMetadata", collectMetadata)
22+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
2523
}
2624

2725
val testStableSemconv by registering(Test::class) {
28-
jvmArgs("-Dotel.semconv-stability.opt-in=database")
26+
testClassesDirs = sourceSets.test.get().output.classesDirs
27+
classpath = sourceSets.test.get().runtimeClasspath
2928

29+
jvmArgs("-Dotel.semconv-stability.opt-in=database")
3030
systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database")
31-
systemProperty("collectMetadata", collectMetadata)
3231
}
3332

3433
check {

instrumentation/clickhouse/clickhouse-client-v2-0.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/clickhouse/clientv2/v0_8/ClickHouseClientV2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void testConnectionStringWithoutDatabaseSpecifiedStillGeneratesSpans() throws Ex
126126

127127
assertDurationMetric(
128128
testing,
129-
"io.opentelemetry.clickhouse-clientv2-0.8",
129+
"io.opentelemetry.clickhouse-client-v2-0.8",
130130
DB_SYSTEM_NAME,
131131
DB_OPERATION_NAME,
132132
DB_NAMESPACE,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
description: This instrumentation enables database client spans and metrics for the V2 ClickHouse client.
2+
library_link: https://github.com/ClickHouse/clickhouse-java
3+
configurations:
4+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
5+
description: Enables statement sanitization for database queries.
6+
type: boolean
7+
default: true

0 commit comments

Comments
 (0)