Commit b6d8f63
test(bigquery-jdbc): add e2e otel test and code refinements (#13226)
b/499079838
### Changes
#### 1. BigQueryJdbcOpenTelemetry.java
* **Feature**: Added safe, generous default attribute value length
limits of **`60KB (61,440 characters)`** to the autoconfigured
OpenTelemetry instance properties.
* **Why**: Prevents GCP Cloud Trace from silently rejecting and dropping
span batches when we log massive `BigQueryException` stack traces or
Arrow schema payloads exceeding the hard 64KB Cloud Trace backend
limits.
* **Design**: If the user explicitly configures their own limits the
driver automatically skips the defaults and respects their overrides.
#### 2. OpenTelemetryJulHandler.java
* **Fix**: Configured the handler level to `Level.ALL` in the
constructor.
* **Why**: Bypasses a standard Java Logging (JUL) constraint where
handlers default to `Level.INFO` and silently drop `FINE`/`DEBUG`
queries. Delegates log filtering exclusively to the Connection loggers.
#### 3. BigQueryConnection.java
* **Visibility**: Exposed the visibility of the connection session
identifier by changing `getConnectionId()` from package-private to
`public`.
* **Why**: Allows automated E2E tests to retrieve the UUID and harvest
specific logs/traces accurately.
#### 4. ITOpenTelemetryTest.java
* **Feature**: Implemented a new standalone E2E integration test suite
verifying the live GCP OTel egress.
* **Test 1 (`testExecute_withOpenTelemetryGcpExporter`)**: Natively
resolves target project via `ServiceOptions.getDefaultProjectId()`. Runs
an optimized in-memory array query and iterates results to trigger
small-page JSON pagination. Queries Cloud Trace E2E to strictly assert
that async pagination child spans are parented perfectly under the root
JDBC span.
* **Test 2 (`testExecute_withErrorCorrelation`)**: Triggers database
failures, captures `SQLException`, harvests Trace IDs from standard
logs, and verifies failed span ingestion in Cloud Trace.
#### 5. BigQueryConnectionTest.java
* **Feature**: Added a new unit test
(`testConnect_withCustomOpenTelemetry_usesCustomInstance`) verifying the
custom OTel injection pipeline.
* **What it does**: Leverages `OpenTelemetryExtension` to mock an OTel
provider locally. Injecting the custom SDK via properties, it validates
that `BigQueryConnection` resolves the instance and routes spans
exclusively to the custom provider
#### 6. pom.xml
* **Dependencies**: Added `google-cloud-trace` test-scoped dependency to
query Cloud Trace v1 API programmatically during E2E validation.
---------
Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
Co-authored-by: Kirill Logachev <kirl@google.com>1 parent a0312c7 commit b6d8f63
11 files changed
Lines changed: 549 additions & 47 deletions
File tree
- java-bigquery-jdbc
- src
- main/java/com/google/cloud/bigquery/jdbc
- test/java/com/google/cloud/bigquery/jdbc
- it
- suites
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
427 | 433 | | |
428 | 434 | | |
429 | 435 | | |
| |||
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| 219 | + | |
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| |||
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
| 371 | + | |
369 | 372 | | |
370 | 373 | | |
371 | 374 | | |
| |||
438 | 441 | | |
439 | 442 | | |
440 | 443 | | |
441 | | - | |
| 444 | + | |
| 445 | + | |
442 | 446 | | |
443 | 447 | | |
444 | 448 | | |
| |||
1036 | 1040 | | |
1037 | 1041 | | |
1038 | 1042 | | |
1039 | | - | |
1040 | 1043 | | |
1041 | 1044 | | |
1042 | 1045 | | |
| |||
1046 | 1049 | | |
1047 | 1050 | | |
1048 | 1051 | | |
| 1052 | + | |
1049 | 1053 | | |
1050 | 1054 | | |
1051 | 1055 | | |
1052 | 1056 | | |
1053 | 1057 | | |
1054 | 1058 | | |
| 1059 | + | |
1055 | 1060 | | |
1056 | | - | |
| 1061 | + | |
1057 | 1062 | | |
1058 | 1063 | | |
1059 | 1064 | | |
1060 | 1065 | | |
1061 | 1066 | | |
1062 | | - | |
| 1067 | + | |
1063 | 1068 | | |
1064 | | - | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1065 | 1073 | | |
1066 | 1074 | | |
1067 | 1075 | | |
| |||
1126 | 1134 | | |
1127 | 1135 | | |
1128 | 1136 | | |
1129 | | - | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
1130 | 1140 | | |
1131 | 1141 | | |
1132 | 1142 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
| 249 | + | |
243 | 250 | | |
244 | 251 | | |
245 | 252 | | |
| |||
250 | 257 | | |
251 | 258 | | |
252 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
253 | 264 | | |
254 | 265 | | |
255 | 266 | | |
| |||
290 | 301 | | |
291 | 302 | | |
292 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
293 | 315 | | |
294 | 316 | | |
295 | 317 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
| |||
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
641 | 649 | | |
642 | 650 | | |
643 | 651 | | |
| |||
Lines changed: 10 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
929 | 920 | | |
930 | 921 | | |
931 | 922 | | |
| |||
1683 | 1674 | | |
1684 | 1675 | | |
1685 | 1676 | | |
1686 | | - | |
1687 | | - | |
1688 | | - | |
1689 | | - | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
1700 | 1682 | | |
1701 | 1683 | | |
1702 | 1684 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
358 | 359 | | |
359 | 360 | | |
360 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
361 | 368 | | |
362 | 369 | | |
363 | 370 | | |
| |||
675 | 682 | | |
676 | 683 | | |
677 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
678 | 690 | | |
679 | 691 | | |
680 | 692 | | |
| |||
832 | 844 | | |
833 | 845 | | |
834 | 846 | | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
835 | 855 | | |
836 | 856 | | |
837 | 857 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
0 commit comments