Commit 57a0207
authored
feat(bqjdbc): extend OpenTelemetry instrumentation for metadata and pagination (#12918)
b/491245568
### Key Changes
#### Core Instrumentation Logic
* **Database Metadata Tracing**: Added OTel spans to key methods in
`BigQueryDatabaseMetaData.java` (`getCatalogs`, `getSchemas`,
`getTables`, `getColumns`) to capture underlying API calls.
* **Pagination Span Links**: Captured the parent span context at the
start of `fetchNextPages` in `BigQueryStatement.java` and linked
background pagination spans back to it, avoiding timeline anomalies.
* **Cross-Thread Context Propagation**: Stored the `SpanContext` in
`BigQueryBaseResultSet.java` at creation time and made it current during
`next()` in `BigQueryJsonResultSet.java` and
`BigQueryArrowResultSet.java` to survive thread hops.
* **Tracer Reuse**: Extracted `getSafeTracer` to
`BigQueryJdbcOpenTelemetry.java` as a static utility to ensure
consistent fallback behavior across the driver.
* **Lambda Extraction**: Extracted the large lambda function in
`populateArrowBufferedQueue` in `BigQueryStatement.java` to its own
private method `processArrowStream` to improve readability and
maintainability.1 parent c7131f9 commit 57a0207
6 files changed
Lines changed: 471 additions & 362 deletions
File tree
- java-bigquery/google-cloud-bigquery-jdbc/src
- main/java/com/google/cloud/bigquery/jdbc
- test/java/com/google/cloud/bigquery/jdbc
Lines changed: 23 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
249 | 255 | | |
250 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
251 | 262 | | |
252 | | - | |
| 263 | + | |
253 | 264 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | 265 | | |
263 | 266 | | |
264 | 267 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
69 | 79 | | |
70 | 80 | | |
71 | 81 | | |
| |||
0 commit comments