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
OpenTelemetry metrics support via vendor-neutral ydb.observability
Add client-side metrics on the ydb.observability layer, symmetric with tracing,
with the metric machinery kept out of the query-service code.
- ydb/observability/metrics.py: the vendor-neutral MetricsProvider Protocol
(record / add / observe_gauge — one method per instrument kind), a Noop default,
and the facades that hide all bookkeeping — SessionMetrics, QuerySessionPoolMetrics
(with conditional timing context managers), and the observe_retry_metrics decorator.
The asynchronous-gauge state (open sessions per pool, pool size) is owned here, so
backends only implement three generic methods. Enabling metrics adds a
ydb-sdk-metrics/0.1.0 token via the sdk_build_info_tokens aggregator.
- ydb/observability/tracing.py: create_ydb_span returns a span-compatible composite
that drives tracing and metrics for one operation (zero overhead when both off).
- ydb/opentelemetry/metrics_plugin.py: OtelMetricsProvider installed through the
observability layer; ydb.opentelemetry.enable_metrics(meter_provider=None)
convenience and a lazily-exposed OtelMetricsProvider. The SDK core never imports
opentelemetry.
- Pool/session/retry code carries only clean facade calls — no time.monotonic,
attribute dicts, or record_* scattered inline. QuerySessionPool gains an optional
name for the pool metric label.
- Consolidate observability tests under tests/observability/; document metrics and a
custom-backend example on the observability + opentelemetry pages; extend the OTel
example. Fix a concurrent patch.object leak in the async tracing tests and allow the
example scripts into the Docker build context (.dockerignore).
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
* Introduce `ydb.observability` — vendor-neutral tracing entrypoint with a `TracingProvider` interface; `enable_tracing(provider)` accepts any implementation (custom or OpenTelemetry) and replaces the previously installed one. The SDK core no longer imports `opentelemetry`, so tracing can be enabled without the OpenTelemetry packages by supplying a custom provider
2
2
* When tracing is enabled the SDK appends a `ydb-sdk-tracing/0.1.0` token to the `x-ydb-sdk-build-info` header, so the server can distinguish requests from tracing-enabled clients
3
+
* Add client-side metrics through the same vendor-neutral `ydb.observability` layer: `enable_metrics(provider)` / `disable_metrics()`, with `ydb.opentelemetry.enable_metrics(meter_provider=None)` as the OpenTelemetry convenience. Instruments cover client operation duration/failures, retry duration/attempts, and query session pool state. `QuerySessionPool` gains an optional `name` argument for the pool metric label. When metrics are enabled the SDK appends a `ydb-sdk-metrics/0.1.0` token to the `x-ydb-sdk-build-info` header
3
4
4
5
## 3.30.0 ##
5
6
* Query session attach stream handles `NodeShutdown` and `SessionShutdown` session hints: on `NodeShutdown` the session's node connection is pessimized and the session is retired, on `SessionShutdown` the session is retired without touching the node
0 commit comments