Skip to content

Commit 1f6c53c

Browse files
committed
jedis, jdbc
1 parent 25471f9 commit 1f6c53c

File tree

12 files changed

+370
-9
lines changed

12 files changed

+370
-9
lines changed

docs/instrumentation-list.yaml

Lines changed: 283 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5779,8 +5779,10 @@ libraries:
57795779
jdbc:
57805780
- name: jdbc
57815781
description: |
5782-
The JDBC instrumentation provides database client spans and metrics. Each call produces a span named after the SQL verb, enriched with standard DB client attributes (system, database, operation, sanitized statement, peer address) and error details if an exception occurs.
5783-
There is also a "jdbc-datasource" instrumentation that creates spans for datasource connections, but is disabled by default due to the volume of telemetry produced.
5782+
This instrumentation enables database client spans and database client metrics for JDBC database operations. There is also a "jdbc-datasource" instrumentation that creates spans for datasource connections, but is disabled by default due to the volume of telemetry produced.
5783+
semantic_conventions:
5784+
- DATABASE_CLIENT_SPANS
5785+
- DATABASE_CLIENT_METRICS
57845786
library_link: https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html
57855787
source_path: instrumentation/jdbc
57865788
scope:
@@ -5822,28 +5824,307 @@ libraries:
58225824
description: Enables instrumentation of JDBC datasource connections.
58235825
type: boolean
58245826
default: false
5827+
telemetry:
5828+
- when: default
5829+
spans:
5830+
- span_kind: CLIENT
5831+
attributes:
5832+
- name: db.connection_string
5833+
type: STRING
5834+
- name: db.name
5835+
type: STRING
5836+
- name: db.operation
5837+
type: STRING
5838+
- name: db.sql.table
5839+
type: STRING
5840+
- name: db.statement
5841+
type: STRING
5842+
- name: db.system
5843+
type: STRING
5844+
- name: db.user
5845+
type: STRING
5846+
- name: peer.service
5847+
type: STRING
5848+
- name: server.address
5849+
type: STRING
5850+
- span_kind: INTERNAL
5851+
attributes:
5852+
- name: code.function
5853+
type: STRING
5854+
- name: code.namespace
5855+
type: STRING
5856+
- name: db.connection_string
5857+
type: STRING
5858+
- name: db.name
5859+
type: STRING
5860+
- name: db.system
5861+
type: STRING
5862+
- name: db.user
5863+
type: STRING
5864+
- when: otel.semconv-stability.opt-in=database
5865+
metrics:
5866+
- name: db.client.operation.duration
5867+
description: Duration of database client operations.
5868+
type: HISTOGRAM
5869+
unit: s
5870+
attributes:
5871+
- name: db.namespace
5872+
type: STRING
5873+
- name: db.operation.name
5874+
type: STRING
5875+
- name: db.system.name
5876+
type: STRING
5877+
spans:
5878+
- span_kind: CLIENT
5879+
attributes:
5880+
- name: db.collection.name
5881+
type: STRING
5882+
- name: db.namespace
5883+
type: STRING
5884+
- name: db.operation.batch.size
5885+
type: LONG
5886+
- name: db.operation.name
5887+
type: STRING
5888+
- name: db.query.text
5889+
type: STRING
5890+
- name: db.system.name
5891+
type: STRING
5892+
- name: peer.service
5893+
type: STRING
5894+
- name: server.address
5895+
type: STRING
5896+
- span_kind: INTERNAL
5897+
attributes:
5898+
- name: code.function
5899+
type: STRING
5900+
- name: code.namespace
5901+
type: STRING
5902+
- name: db.namespace
5903+
type: STRING
5904+
- name: db.system.name
5905+
type: STRING
58255906
jedis:
58265907
- name: jedis-1.4
5908+
description: This instrumentation enables database client spans and database client
5909+
metrics for Jedis Redis operations.
5910+
semantic_conventions:
5911+
- DATABASE_CLIENT_SPANS
5912+
- DATABASE_CLIENT_METRICS
5913+
library_link: https://github.com/redis/jedis
58275914
source_path: instrumentation/jedis/jedis-1.4
58285915
scope:
58295916
name: io.opentelemetry.jedis-1.4
58305917
target_versions:
58315918
javaagent:
58325919
- redis.clients:jedis:[1.4.0,3.0.0)
5920+
configurations:
5921+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
5922+
description: Enables statement sanitization for database queries.
5923+
type: boolean
5924+
default: true
5925+
- name: otel.instrumentation.common.peer-service-mapping
5926+
description: Used to specify a mapping from host names or IP addresses to peer
5927+
services.
5928+
type: map
5929+
default: ''
5930+
telemetry:
5931+
- when: default
5932+
spans:
5933+
- span_kind: CLIENT
5934+
attributes:
5935+
- name: db.operation
5936+
type: STRING
5937+
- name: db.statement
5938+
type: STRING
5939+
- name: db.system
5940+
type: STRING
5941+
- name: peer.service
5942+
type: STRING
5943+
- name: server.address
5944+
type: STRING
5945+
- name: server.port
5946+
type: LONG
5947+
- when: otel.semconv-stability.opt-in=database
5948+
metrics:
5949+
- name: db.client.operation.duration
5950+
description: Duration of database client operations.
5951+
type: HISTOGRAM
5952+
unit: s
5953+
attributes:
5954+
- name: db.operation.name
5955+
type: STRING
5956+
- name: db.system.name
5957+
type: STRING
5958+
- name: server.address
5959+
type: STRING
5960+
- name: server.port
5961+
type: LONG
5962+
spans:
5963+
- span_kind: CLIENT
5964+
attributes:
5965+
- name: db.operation.name
5966+
type: STRING
5967+
- name: db.query.text
5968+
type: STRING
5969+
- name: db.system.name
5970+
type: STRING
5971+
- name: peer.service
5972+
type: STRING
5973+
- name: server.address
5974+
type: STRING
5975+
- name: server.port
5976+
type: LONG
58335977
- name: jedis-3.0
5978+
description: This instrumentation enables database client spans and database client
5979+
metrics for Jedis Redis operations.
5980+
semantic_conventions:
5981+
- DATABASE_CLIENT_SPANS
5982+
- DATABASE_CLIENT_METRICS
5983+
library_link: https://github.com/redis/jedis
58345984
source_path: instrumentation/jedis/jedis-3.0
58355985
scope:
58365986
name: io.opentelemetry.jedis-3.0
58375987
target_versions:
58385988
javaagent:
58395989
- redis.clients:jedis:[3.0.0,4)
5990+
configurations:
5991+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
5992+
description: Enables statement sanitization for database queries.
5993+
type: boolean
5994+
default: true
5995+
- name: otel.instrumentation.common.peer-service-mapping
5996+
description: Used to specify a mapping from host names or IP addresses to peer
5997+
services.
5998+
type: map
5999+
default: ''
6000+
telemetry:
6001+
- when: default
6002+
spans:
6003+
- span_kind: CLIENT
6004+
attributes:
6005+
- name: db.operation
6006+
type: STRING
6007+
- name: db.statement
6008+
type: STRING
6009+
- name: db.system
6010+
type: STRING
6011+
- name: network.peer.address
6012+
type: STRING
6013+
- name: network.peer.port
6014+
type: LONG
6015+
- name: network.type
6016+
type: STRING
6017+
- name: peer.service
6018+
type: STRING
6019+
- name: server.address
6020+
type: STRING
6021+
- name: server.port
6022+
type: LONG
6023+
- when: otel.semconv-stability.opt-in=database
6024+
metrics:
6025+
- name: db.client.operation.duration
6026+
description: Duration of database client operations.
6027+
type: HISTOGRAM
6028+
unit: s
6029+
attributes:
6030+
- name: db.operation.name
6031+
type: STRING
6032+
- name: db.system.name
6033+
type: STRING
6034+
- name: network.peer.address
6035+
type: STRING
6036+
- name: network.peer.port
6037+
type: LONG
6038+
- name: server.address
6039+
type: STRING
6040+
- name: server.port
6041+
type: LONG
6042+
spans:
6043+
- span_kind: CLIENT
6044+
attributes:
6045+
- name: db.operation.name
6046+
type: STRING
6047+
- name: db.query.text
6048+
type: STRING
6049+
- name: db.system.name
6050+
type: STRING
6051+
- name: network.peer.address
6052+
type: STRING
6053+
- name: network.peer.port
6054+
type: LONG
6055+
- name: network.type
6056+
type: STRING
6057+
- name: peer.service
6058+
type: STRING
6059+
- name: server.address
6060+
type: STRING
6061+
- name: server.port
6062+
type: LONG
58406063
- name: jedis-4.0
6064+
description: This instrumentation enables database client spans and database client
6065+
metrics for Jedis Redis operations.
6066+
semantic_conventions:
6067+
- DATABASE_CLIENT_SPANS
6068+
- DATABASE_CLIENT_METRICS
6069+
library_link: https://github.com/redis/jedis
58416070
source_path: instrumentation/jedis/jedis-4.0
58426071
scope:
58436072
name: io.opentelemetry.jedis-4.0
58446073
target_versions:
58456074
javaagent:
58466075
- redis.clients:jedis:[4.0.0-beta1,)
6076+
configurations:
6077+
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
6078+
description: Enables statement sanitization for database queries.
6079+
type: boolean
6080+
default: true
6081+
telemetry:
6082+
- when: default
6083+
spans:
6084+
- span_kind: CLIENT
6085+
attributes:
6086+
- name: db.operation
6087+
type: STRING
6088+
- name: db.statement
6089+
type: STRING
6090+
- name: db.system
6091+
type: STRING
6092+
- name: network.peer.address
6093+
type: STRING
6094+
- name: network.peer.port
6095+
type: LONG
6096+
- name: network.type
6097+
type: STRING
6098+
- when: otel.semconv-stability.opt-in=database
6099+
metrics:
6100+
- name: db.client.operation.duration
6101+
description: Duration of database client operations.
6102+
type: HISTOGRAM
6103+
unit: s
6104+
attributes:
6105+
- name: db.operation.name
6106+
type: STRING
6107+
- name: db.system.name
6108+
type: STRING
6109+
- name: network.peer.address
6110+
type: STRING
6111+
- name: network.peer.port
6112+
type: LONG
6113+
spans:
6114+
- span_kind: CLIENT
6115+
attributes:
6116+
- name: db.operation.name
6117+
type: STRING
6118+
- name: db.query.text
6119+
type: STRING
6120+
- name: db.system.name
6121+
type: STRING
6122+
- name: network.peer.address
6123+
type: STRING
6124+
- name: network.peer.port
6125+
type: LONG
6126+
- name: network.type
6127+
type: STRING
58476128
jetty:
58486129
- name: jetty-11.0
58496130
source_path: instrumentation/jetty/jetty-11.0

instrumentation-docs/instrumentations.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ readonly INSTRUMENTATIONS=(
127127
"jaxws:jaxws-2.0-axis2-1.6:javaagent:test"
128128
"jaxws:jaxws-cxf-3.0:javaagent:test"
129129
"jaxws:jaxws-jws-api-1.1:javaagent:test"
130+
"jdbc:javaagent:test"
131+
"jdbc:javaagent:testStableSemconv"
132+
"jedis:jedis-1.4:javaagent:test"
133+
"jedis:jedis-1.4:javaagent:testStableSemconv"
134+
"jedis:jedis-3.0:javaagent:test"
135+
"jedis:jedis-3.0:javaagent:testStableSemconv"
136+
"jedis:jedis-4.0:javaagent:test"
137+
"jedis:jedis-4.0:javaagent:testStableSemconv"
130138
"jetty-httpclient:jetty-httpclient-12.0:javaagent:test"
131139
"jetty-httpclient:jetty-httpclient-9.2:javaagent:test"
132140
"jodd-http-4.2:javaagent:test"

instrumentation/jdbc/javaagent/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ dependencies {
4141
testImplementation("com.typesafe.slick:slick_2.11:3.2.0")
4242
}
4343

44+
val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false"
45+
4446
sourceSets {
4547
main {
4648
val shadedDep = project(":instrumentation:jdbc:library")
@@ -81,6 +83,8 @@ tasks {
8183
}
8284
jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true")
8385
jvmArgs("-Dotel.semconv-stability.opt-in=database")
86+
systemProperty("collectMetadata", collectMetadata)
87+
systemProperty("metadataConfig", "otel.semconv-stability.opt-in=database")
8488
}
8589

8690
val testSlickStableSemconv by registering(Test::class) {
@@ -111,6 +115,7 @@ tasks {
111115
excludeTestsMatching("PreparedStatementParametersTest")
112116
}
113117
jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true")
118+
systemProperty("collectMetadata", collectMetadata)
114119
}
115120

116121
check {
@@ -125,6 +130,6 @@ tasks {
125130
tasks {
126131
withType<Test>().configureEach {
127132
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
128-
jvmArgs("-Dotel.instrumentation.jdbc.experimental.transaction.enabled=true")
133+
// jvmArgs("-Dotel.instrumentation.jdbc.experimental.transaction.enabled=true")
129134
}
130135
}

instrumentation/jdbc/metadata.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
description: >
2-
The JDBC instrumentation provides database client spans and metrics. Each call produces a span
3-
named after the SQL verb, enriched with standard DB client attributes (system, database,
4-
operation, sanitized statement, peer address) and error details if an exception occurs.
5-
6-
There is also a "jdbc-datasource" instrumentation that creates spans for datasource connections,
7-
but is disabled by default due to the volume of telemetry produced.
2+
This instrumentation enables database client spans and database client metrics for JDBC
3+
database operations. There is also a "jdbc-datasource" instrumentation that creates spans
4+
for datasource connections, but is disabled by default due to the volume of telemetry
5+
produced.
6+
semantic_conventions:
7+
- DATABASE_CLIENT_SPANS
8+
- DATABASE_CLIENT_METRICS
89
library_link: https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html
910
configurations:
1011
- name: otel.instrumentation.jdbc.statement-sanitizer.enabled

0 commit comments

Comments
 (0)