Skip to content

Add adapter version to LLO bridge telemetry - #23791

Open
denis-chernov-smartcontract wants to merge 1 commit into
developfrom
Add-adapter-proto-and-version-to-the-LLO-telemetry
Open

denis-chernov-smartcontract wants to merge 1 commit into
developfrom
Add-adapter-proto-and-version-to-the-LLO-telemetry

Conversation

@denis-chernov-smartcontract

Copy link
Copy Markdown
Contributor

Summary

External-adapter (streams-adapter) version is now discovered from the adapter's
health endpoint and stamped into the meta.adapterVersion field of each live
bridge observation's telemetry copy, alongside a TTL bump for cached
observations.

Changes

Adapter version discovery (bridgeconn)

  • BridgeConnManager gains an AdapterVersion(bridge) (string) method that
    returns the version the bridge's streams-adapter last reported, or "" if it
    is not yet known. It never creates a connection.
  • eaConn now tracks the adapter version behind a dedicated versionMu, plus a
    healthURL and healthClient used for discovery.
  • On every successful stream (re)connect, eaConn asynchronously fetches
    GET <bridge URL>/health (adapterHealthURL, bounded by the new
    adapterHealthTimeout = 1s) and records the response's adapterVersion
    field via fetchAdapterVersion. Failures are best-effort: they log at debug
    and leave the previous value in place, never affecting the stream.
  • adapterHealthURL derives the health endpoint from the bridge URL, preserving
    scheme/authority and stripping query/fragment.

Version field in telemetry (task.bridge.go)

  • Live (non-cache-hit) bridge responses are stamped with the adapter version in
    the telemetry copy only, via the new adapterMetaForTelemetry helper. The
    byte slice is cloned before jsonparser.Set so the untouched body remains the
    task result, and the value persisted to the bridge cache.
  • Cache-fallback bodies are left unstamped (they were produced by an earlier
    adapter build), consistent with local_cache_hit marking those rows.

Observation cache TTL

  • observationTTL increased from 60s to 90s (bridge_conn_manager.go) to match the JS adapter behaviour.

Testing

  • TestAdapterHealthURL — health endpoint derivation from bridge URLs.
  • TestEAConn_RefreshAdapterVersion — version discovery behavior across HTTP
    statuses, missing/malformed fields, and disabled clients.
  • TestBridgeConnManager_AdapterVersion — bridge-name prefix normalization and
    unknown-bridge handling.
  • TestAdapterMetaForTelemetry — version stamping edge cases (empty version,
    non-object body, escaping, input non-mutation).
  • Reworked TestBridgeTask_UsesBridgeConnManagerCacheFallback to exercise the
    live-observation and cache-fallback telemetry paths.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@trunk-io

trunk-io Bot commented Sep 22, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@denis-chernov-smartcontract
denis-chernov-smartcontract force-pushed the Add-adapter-proto-and-version-to-the-LLO-telemetry branch from 0a634eb to efe0c56 Compare September 22, 2026 01:19
@denis-chernov-smartcontract
denis-chernov-smartcontract force-pushed the Add-adapter-proto-and-version-to-the-LLO-telemetry branch from efe0c56 to d9467c2 Compare September 22, 2026 02:16
@cl-sonarqube-production

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant