@@ -183,6 +183,7 @@ custom_content: |
183
183
184
184
> Note: The attribute keys that are used for additional information about retry attempts and the number of requests might change in a future release.
185
185
186
+
186
187
### Instrument with OpenCensus
187
188
188
189
> Note: OpenCensus project is deprecated. See [Sunsetting OpenCensus](https://opentelemetry.io/blog/2023/sunsetting-opencensus/).
@@ -315,6 +316,38 @@ custom_content: |
315
316
316
317
Spanner spanner = options.getService();
317
318
```
319
+
320
+ #### OpenTelemetry SQL Statement Tracing
321
+ The OpenTelemetry traces that are generated by the Java client include any request and transaction
322
+ tags that have been set. The traces can also include the SQL statements that are executed and the
323
+ name of the thread that executes the statement. Enable this with the `enableExtendedTracing`
324
+ option:
325
+
326
+ ```
327
+ SpannerOptions options = SpannerOptions.newBuilder()
328
+ .setOpenTelemetry(openTelemetry)
329
+ .setEnableExtendedTracing(true)
330
+ .build();
331
+ ```
332
+
333
+ This option can also be enabled by setting the environment variable
334
+ `SPANNER_ENABLE_EXTENDED_TRACING=true`.
335
+
336
+ #### OpenTelemetry API Tracing
337
+ You can enable tracing of each API call that the Spanner client executes with the `enableApiTracing`
338
+ option. These traces also include any retry attempts for an API call:
339
+
340
+ ```
341
+ SpannerOptions options = SpannerOptions.newBuilder()
342
+ .setOpenTelemetry(openTelemetry)
343
+ .setEnableApiTracing(true)
344
+ .build();
345
+ ```
346
+
347
+ This option can also be enabled by setting the environment variable
348
+ `SPANNER_ENABLE_API_TRACING=true`.
349
+
350
+ > Note: The attribute keys that are used for additional information about retry attempts and the number of requests might change in a future release.
318
351
319
352
## Migrate from OpenCensus to OpenTelemetry
320
353
0 commit comments