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
feat(spanner): implement custom tracer_provider injection for opentelemetry traces (#1229)
* all: implement custom tracer_provider injection An important feature for observability is to allow the injection of a custom tracer_provider instead of always using the global tracer_provider by sending in observability_options=dict( tracer_provider=tracer_provider, enable_extended_tracing=True, ) * Address review feedback by attaching observability_options to Client only * Attach observability_options directly before trace_call * More reverts for formatting * Plumb observability_options into _restart_on_unavailable * completely decouple observability_options from session * apply SPANNER_ENABLE_EXTENDED_TRACING but in inverse due to compatibility * Document SPANNER_ENABLE_EXTENDED_TRACING in environment * Revert a vestige of mock * tests: add unit test for propagating TracerProvider * Add preliminary end-to-end test to check for injection of observability_options * Document default enable_extended_tracing value * Carve out observability_options test * Ensure that observability_options test sets up and deletes database * Ensure instance.create() is invoked in system tests * Use getattr for mock _Client * Update with code review suggestions * Deal with mock.Mock false positives failing tests * Address review feedback
To get more fine-grained traces from gRPC, you can enable the gRPC instrumentation by the following
@@ -52,3 +61,13 @@ Generated spanner traces should now be available on `Cloud Trace <https://consol
52
61
53
62
Tracing is most effective when many libraries are instrumented to provide insight over the entire lifespan of a request.
54
63
For a list of libraries that can be instrumented, see the `OpenTelemetry Integrations` section of the `OpenTelemetry Python docs <https://opentelemetry-python.readthedocs.io/en/stable/>`_
64
+
65
+
Annotating spans with SQL
66
+
~~~~~~~~~~~~~~~~~~~~~~~~~
67
+
68
+
By default your spans will be annotated with SQL statements where appropriate, but that can be a PII (Personally Identifiable Information)
69
+
leak. Sadly due to legacy behavior, we cannot simply turn off this behavior by default. However you can control this behavior by setting
70
+
71
+
SPANNER_ENABLE_EXTENDED_TRACING=false
72
+
73
+
to turn it off globally or when creating each SpannerClient, please set `observability_options.enable_extended_tracing=false`
0 commit comments