Skip to content

Commit 56e5c97

Browse files
implement OpenTelemetry stable semantic conventions
1 parent 4679521 commit 56e5c97

File tree

4 files changed

+726
-73
lines changed

4 files changed

+726
-73
lines changed

ojdbc-provider-opentelemetry/README.md

Lines changed: 106 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,104 @@ Open Telemetry.
66
This provider implements the TraceEventListener interface provided by the JDBC
77
driver which will be notified whenever events are generated in the driver and
88
will publish these events into Open Telemetry. These events include:
9-
* roundtrips to the database server
9+
* Roundtrips to the database server
1010
* AC begin and sucess
1111
* VIP down event
1212

13-
The following attributes are added the the traces for each event:
14-
* **Roundtrips**
15-
* Connection ID
16-
* Database Operation
17-
* Database User
18-
* Database Tenant
19-
* SQL ID
20-
* Original SQL Text *(only present if sensitive data is enabled)*
21-
* Actual SQL Text *(only present if sensitive data is enabled)*
22-
* **AC begin and success**
23-
* Error Message
24-
* Error code
25-
* SQL state
26-
* Current replay retry count
27-
* **VIP down event**
28-
* Error message
29-
* VIP address
30-
* Protocol *(only present if sensitive data is enabled)*
31-
* Host *(only present if sensitive data is enabled)*
32-
* Port *(only present if sensitive data is enabled)*
33-
* Service name *(only present if sensitive data is enabled)*
34-
* SID *(only present if sensitive data is enabled)*
35-
* Connection data *(only present if sensitive data is enabled)*
13+
## Semantic Conventions
14+
15+
This provider supports both **stable** and **experimental** (legacy) OpenTelemetry
16+
semantic conventions for Oracle Database instrumentation.
17+
18+
### Semantic Convention Migration
19+
20+
The provider supports three modes controlled by the `OTEL_SEMCONV_STABILITY_OPT_IN`
21+
environment variable:
22+
23+
* **Empty/Not Set (default)** - Emits only experimental (legacy) conventions for backward compatibility
24+
* **`database`** - Emits only the new stable Oracle Database semantic conventions
25+
* **`database/dup`** - Emits both old and new conventions (dual mode for migration)
26+
27+
See the [OpenTelemetry Oracle Database Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/database/database-metrics/)
28+
for details on the stable conventions.
29+
30+
### Roundtrip Events (Stable Conventions)
31+
32+
When `OTEL_SEMCONV_STABILITY_OPT_IN=database` or `database/dup`:
33+
34+
* **Required/Recommended Attributes**
35+
* `db.system.name` - Always set to "oracle.db"
36+
* `db.namespace` - Format: `{instance_name}|{database_name}|{service_name}`
37+
* `db.operation.name` - Database operation being executed (e.g., "SELECT", "INSERT")
38+
* `db.query.summary` - Low cardinality query summary
39+
* `server.address` - Database server hostname
40+
* `server.port` - Database server port (if non-default)
41+
* `oracle.db.query.sql.id` - Oracle SQL_ID
42+
* `oracle.db.session.id` - Oracle session ID
43+
* `oracle.db.server.pid` - Oracle server process ID
44+
* `oracle.db.shard.name` - Oracle shard name (if applicable)
45+
* `thread.id` - Current thread ID
46+
* `thread.name` - Current thread name
47+
48+
* **Opt-In Attributes** *(only present if sensitive data is enabled)*
49+
* `db.user` - Database user name
50+
* `db.query.text` - Actual SQL query text
51+
* `db.response.returned_rows` - Number of rows returned
52+
53+
* **Error Attributes** *(only present on errors)*
54+
* `error.type` - Exception class name
55+
* `db.response.status_code` - Oracle error code (format: "ORA-XXXXX")
56+
57+
### Roundtrip Events (Legacy Conventions)
58+
59+
When `OTEL_SEMCONV_STABILITY_OPT_IN` is empty/not set or `database/dup`:
60+
61+
* `Connection ID`
62+
* `Database Operation`
63+
* `Database User`
64+
* `Database Tenant`
65+
* `SQL ID`
66+
* `Original SQL Text` *(only present if sensitive data is enabled)*
67+
* `Actual SQL Text` *(only present if sensitive data is enabled)*
68+
69+
### Application Continuity (AC) Replay Events
70+
71+
**Stable Conventions** (`database` or `database/dup`):
72+
* `db.system.name` - Always set to "oracle.db"
73+
* `error.type` - Error message that triggered replay
74+
* `db.response.status_code` - Oracle error code (format: "ORA-XXXXX")
75+
* `db.operation.batch.size` - Current replay retry count
76+
77+
**Legacy Conventions** (default or `database/dup`):
78+
* `Error Message`
79+
* `Error code`
80+
* `SQL state`
81+
* `Current replay retry count`
82+
83+
### VIP Retry Events (RAC Failover)
84+
85+
**Stable Conventions** (`database` or `database/dup`):
86+
* `db.system.name` - Always set to "oracle.db"
87+
* `error.type` - Error message that triggered VIP retry
88+
* `server.address` - VIP address being retried
89+
90+
**Opt-In VIP Debug Attributes** *(only present if sensitive data is enabled)*:
91+
* `server.port` - Server port number
92+
* `oracle.db.vip.protocol` - Connection protocol
93+
* `oracle.db.vip.failed_host` - Host that failed during VIP retry
94+
* `oracle.db.vip.service_name` - Oracle service name
95+
* `oracle.db.vip.sid` - Oracle System Identifier (SID)
96+
* `oracle.db.vip.connection_descriptor` - Full connection descriptor
97+
98+
**Legacy Conventions** (default or `database/dup`):
99+
* `Error message`
100+
* `VIP Address`
101+
* `Protocol` *(only present if sensitive data is enabled)*
102+
* `Host` *(only present if sensitive data is enabled)*
103+
* `Port` *(only present if sensitive data is enabled)*
104+
* `Service name` *(only present if sensitive data is enabled)*
105+
* `SID` *(only present if sensitive data is enabled)*
106+
* `Connection data` *(only present if sensitive data is enabled)*
36107

37108
## Installation
38109

@@ -57,6 +128,17 @@ application's classpath and set the following connection property :
57128
oracle.jdbc.provider.traceEventListener=open-telemetry-trace-event-listener-provider
58129
```
59130

131+
### Enabling Stable Semantic Conventions
132+
133+
To use the new stable OpenTelemetry semantic conventions, set the environment variable:
134+
```bash
135+
# Use only stable conventions
136+
export OTEL_SEMCONV_STABILITY_OPT_IN=database
137+
138+
# OR use both old and new conventions (dual mode for migration)
139+
export OTEL_SEMCONV_STABILITY_OPT_IN=database/dup
140+
```
141+
60142
## Configuration
61143

62144
The Oracle JDBC provider for Open Telemetry can be configured using system properties

0 commit comments

Comments
 (0)