Map bridge/2DC pool topology in @ydbjs/telemetry#642
Open
polRk wants to merge 1 commit into
Open
Conversation
Wire the new @ydbjs/core bridge (2DC) diagnostics_channel events into
OTel spans and metrics, completing the mapping that previously only
carried the ydb.node.pile connection attribute.
- Traces: set ydb.discovery.self_location / ydb.discovery.primary_pile
on the Discovery span from discovery.completed; record a
ydb.driver.pile.changed span event (primary before/after) that fires
inside the discovery span.
- Metrics: observable gauges ydb.driver.pool.{routable,pessimized,nodes}
reconstructed from ydb:driver.connection.pool.stats (routing tier,
per-pile node counts), with routing mode folded in from pool.opened;
counters ydb.driver.pile.{fallbacks,changes}. All keyed by driver
identity and cleared on driver.closed. pool.stats / pile.fallback are
metrics-only (fire outside any span).
- Tests: cover the new span-event and metric-reader mappings.
- Update the telemetry changeset (bump minor — new instruments/attrs)
and README channel enumeration.
KirillKurdyukov
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wire the bridge (2DC) topology
diagnostics_channelevents that@ydbjs/corenow publishes into@ydbjs/telemetryOTel spans and metrics.Why
Core's endpoints engine gained bridge/pool observability (
8f0fc0f), but@ydbjs/telemetryonly mapped theydb.node.pileconnection attribute. The newdiscovery.completedfields (selfLocation,piles,primaryPile) and the newpool.opened/pool.stats/pile.changed/pile.fallbackchannels went unconsumed, so bridge topology and the aggregate routing snapshot were invisible in traces and metrics. This completes the mapping.Changes
channels.ts,semconv/{spans,events}.ts)ydb:driver.discovery.completedalso setsydb.discovery.self_locationandydb.discovery.primary_pileon theydb.Discoveryspan (dropped off-bridge).ydb:driver.pile.changed→ydb.driver.pile.changedspan event withydb.driver.pile.primary_before/primary_after. It fires inside the discovery span (inpublishRoundDiagnostics), so it attaches; the structured roster stays on the bus.metrics.ts,state/connection-pool.ts,semconv/metrics.ts)ydb:driver.connection.pool.stats, keyed byDriverIdentity:ydb.driver.pool.routable(tagydb.routing.tier∈ {prefer, fallback}),ydb.driver.pool.pessimized,ydb.driver.pool.nodes(per pile, taggedydb.pile.name/ydb.pile.status).ydb:driver.connection.pool.openedconfig folded into per-driver state;preferPrimaryPile/localityEnabledride theroutablegauge as tags (they define what prefer/fallback mean; one fixed value per driver → bounded cardinality).ydb.driver.pile.fallbacks(taggedydb.pile.fallback.active) andydb.driver.pile.changes. State cleared onydb:driver.closed.pool.stats/pile.fallbackfire outside any span (async consume loop) → metrics-only, never attached to a span, per the producer contract.patch → minor— new instruments/attributes are a backwards-compatible feature) and the README channel/instrument tables + cardinality budget.No breaking changes — purely additive.
Testing
packages/telemetry/src/bridge.test.ts(10 tests): span-event assertions (discovery attrs bridge + non-bridge,pile.changedevent) and metric-reader assertions (all three pool gauges, routing-mode tags present/absent, both counters, teardown ondriver.closed). Placed undersrc/(theuniproject) since they have no external deps.npx vitest --run --project uni packages/telemetry/src— 16 pass.unisuite — 1033 pass / 1 skipped (no regressions).inttelemetry suites (metrics,propagation) — 30 pass.cd packages/telemetry && npx tsc --noEmitclean;oxlint packages/telemetry/srcclean.Checklist