Repository navigation
Commit 2801fbd
authored
feat(bigquery-jdbc): add otel trace and span IDs to local logs (#13935)
b/538631816
This PR integrates OpenTelemetry tracing context into the JDBC driver's
local file logging system, bringing it to parity with the existing
Google Cloud Logging export integration.
**Key Changes:**
* **`BigQueryJdbcRootLogger.java`**: Updated the root formatter to
extract the active `TraceId` and `SpanId` from the current OpenTelemetry
thread context. When a valid trace is active, local logs will now
automatically include a `[trace_id=... span_id=...]` block.
* **`BigQueryJdbcRootLoggerTest.java`**: Added
`testFormatterWithOpenTelemetrySpan` to verify the formatter correctly
extracts and formats IDs when a span is active.1 parent 0faedf3 commit 2801fbd
2 files changed
Lines changed: 44 additions & 7 deletions
File tree
- java-bigquery-jdbc/src
- main/java/com/google/cloud/bigquery/jdbc
- test/java/com/google/cloud/bigquery/jdbc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
87 | 102 | | |
88 | 103 | | |
89 | 104 | | |
| |||
114 | 129 | | |
115 | 130 | | |
116 | 131 | | |
117 | | - | |
118 | | - | |
| 132 | + | |
| 133 | + | |
119 | 134 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
125 | 138 | | |
126 | 139 | | |
127 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
74 | 98 | | |
0 commit comments