Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update end to end tracing documentation #2212

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion OBSERVABILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ const spanner = new Spanner({

In addition to client-side tracing, you can opt in for end-to-end tracing. End-to-end tracing helps you understand and debug latency issues that are specific to Spanner. Refer [here](https://cloud.google.com/spanner/docs/tracing-overview) for more information.

You can opt-in by either:
To configure end-to-end tracing.

1. Opt in for end-to-end tracing. You can opt-in by either:
* Setting the environment variable `SPANNER_ENABLE_END_TO_END_TRACING=true` before your application is started
* In code, setting `enableEndToEndTracing: true` in your SpannerOptions before creating the Cloud Spanner client

Expand All @@ -103,6 +104,13 @@ const spanner = new Spanner({
}),
```

2. Set the trace context propagation in OpenTelemetry.
```javascript
const {propagation} = require('@opentelemetry/api');
const {W3CTraceContextPropagator} = require('@opentelemetry/core');
propagation.setGlobalPropagator(new W3CTraceContextPropagator());
```

#### OpenTelemetry gRPC instrumentation

Optionally, you can enable OpenTelemetry gRPC instrumentation which produces traces of executed remote procedure calls (RPCs)
Expand Down
5 changes: 5 additions & 0 deletions samples/observability-traces.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
});
provider.addSpanProcessor(new BatchSpanProcessor(exporter));

// Set global propagator to propogate the trace context for end to end tracing.
const {propagation} = require('@opentelemetry/api');

Check failure on line 45 in samples/observability-traces.js

View workflow job for this annotation

GitHub Actions / lint

"@opentelemetry/api" is extraneous
const {W3CTraceContextPropagator} = require('@opentelemetry/core');

Check failure on line 46 in samples/observability-traces.js

View workflow job for this annotation

GitHub Actions / lint

"@opentelemetry/core" is extraneous
propagation.setGlobalPropagator(new W3CTraceContextPropagator());

// Uncomment following line to register global tracerProvider instead
// of passing it into SpannerOptions.observabilityOptions.
// provider.register();
Expand Down
Loading