Skip to content

Commit 87b362d

Browse files
committed
chore: traces documentation
1 parent c3d3f23 commit 87b362d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,32 @@ SpannerOptions options = SpannerOptions.newBuilder()
421421

422422
Spanner spanner = options.getService();
423423
```
424+
#### OpenTelemetry SQL Statement Tracing
425+
The OpenTelemetry traces that are generated by the Java client include any request and transaction
426+
tags that have been set. The traces can also include the SQL statements that are executed. Enable
427+
this with the `enableExtendedTracing` option:
428+
429+
```
430+
SpannerOptions options = SpannerOptions.newBuilder()
431+
.setOpenTelemetry(openTelemetry)
432+
.setEnableExtendedTracing(true)
433+
.build();
434+
```
435+
436+
This option can also be enabled by setting the environment variable
437+
`SPANNER_ENABLE_EXTENDED_TRACING=true`.
438+
439+
#### OpenTelemetry API Tracing
440+
You can enable tracing of each API call that the Spanner client executes with the `enableApiTracing`
441+
option. These traces also include any retry attempts for an API call:
442+
443+
```
444+
SpannerOptions options = SpannerOptions.newBuilder()
445+
.setOpenTelemetry(openTelemetry)
446+
.setEnableApiTracing(true)
447+
.build();
448+
```
449+
424450

425451
## Migrate from OpenCensus to OpenTelemetry
426452

0 commit comments

Comments
 (0)