You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which gives insight into the client internals and aids in debugging/troubleshooting
92
+
production issues. OpenTelemetry metrics will provide you with enough data to enable you to
93
+
spot, and investigate the cause of any unusual deviations from normal behavior.
94
+
95
+
All Cloud Spanner Metrics are prefixed with `spanner/` and uses `cloud.google.com/java` as [Instrumentation Scope](https://opentelemetry.io/docs/concepts/instrumentation-scope/). The
96
+
metrics will be tagged with:
97
+
* `database`: the target database name.
98
+
* `instance_id`: the instance id of the target Spanner instance.
99
+
* `client_id`: the user defined database client id.
100
+
101
+
By default, the functionality is disabled. You need to add OpenTelemetry dependencies, enable OpenTelemetry metrics and must configure the OpenTelemetry with appropriate exporters at the startup of your application:
102
+
103
+
#### OpenTelemetry Dependencies
104
+
If you are using Maven, add this to your pom.xml file
Cloud Spanner client supports OpenTelemetry Traces, which gives insight into the client internals and aids in debugging/troubleshooting production issues.
230
+
231
+
By default, the functionality is disabled. You need to add OpenTelemetry dependencies, enable OpenTelemetry traces and must configure the OpenTelemetry with appropriate exporters at the startup of your application.
232
+
233
+
#### OpenTelemetry Dependencies
234
+
235
+
If you are using Maven, add this to your pom.xml file
// Inject OpenTelemetry object via Spanner Options or register OpenTelmetry object as Global
281
+
.setOpenTelemetry(openTelemetry)
282
+
.build();
283
+
284
+
Spanner spanner = options.getService();
285
+
```
286
+
287
+
## Migrate from OpenCensus to OpenTelemetry
288
+
289
+
> Using the [OpenTelemetry OpenCensus Bridge](https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-opencensus-shim), you can immediately begin exporting your metrics and traces with OpenTelemetry
290
+
291
+
#### Disable OpenCensus metrics
292
+
Disable OpenCensus metrics for Spanner by including the following code if you still possess OpenCensus dependencies and exporter.
293
+
294
+
```java
295
+
SpannerOptions.disableOpenCensusMetrics();
296
+
```
297
+
298
+
#### Disable OpenCensus traces
299
+
Enabling OpenTelemetry traces for Spanner will automatically disable OpenCensus traces.
300
+
301
+
```java
302
+
SpannerOptions.enableOpenTelemetryTraces();
303
+
```
304
+
305
+
#### Remove OpenCensus Dependencies and Code
306
+
Remove any OpenCensus-related code and dependencies from your codebase if all your dependencies are ready to move to OpenTelemetry.
307
+
308
+
* Remove the OpenCensus Exporters which were configured [here](#configure-the-opencensus-exporter)
309
+
* Remove SpannerRPCViews reference which were configured [here](#enable-rpc-views)
310
+
* Remove the OpenCensus dependencies which were added [here](#opencensus-dependencies)
311
+
312
+
#### Update your Dashboards and Alerts
138
313
314
+
Update your dashboards and alerts to reflect below changes
315
+
* **Metrics name** : `cloud.google.com/java` prefix has been removed from OpenTelemery metrics and instead has been added as Instrumenation Scope.
316
+
* **Metrics namespace** : OpenTelmetry exporters uses `workload.googleapis.com` namespace opposed to `custom.googleapis.com` with OpenCensus.
0 commit comments