Skip to content

feat(router): observe subscription delivery outcomes - #2

Draft
mwisner wants to merge 1 commit into
mwisner/fix/kafka-consumer-client-leakfrom
mwisner/feat/subscription-delivery-observability
Draft

feat(router): observe subscription delivery outcomes#2
mwisner wants to merge 1 commit into
mwisner/fix/kafka-consumer-client-leakfrom
mwisner/feat/subscription-delivery-observability

Conversation

@mwisner

@mwisner mwisner commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • add unsampled stream-processing counters for messages dispatched or removed by pre-dispatch hooks
  • add subscription resolution-error counters with finite reason tags
  • add WebSocket frame outcome counters that distinguish data, partial/error payloads, terminal errors, completion, success, and failure
  • promote WebSocket write failures to structured warning logs

Why

router.engine.messages.sent combines successful data updates, resolver error paths, and heartbeats. It cannot show whether an update was data or an error, and several resolver-error paths increment it without knowing whether the error frame reached the WebSocket. A failed normal data flush is also not represented by that counter.

The new router.engine.websocket.frames counter records the actual protocol write result. This distinguishes, for example:

  • successful data delivery: frame_type:data, result:success
  • a resolver error successfully reported to the client: resolution error plus an errors_only frame with result:success
  • a resolver error whose error frame could not be written: resolution error plus result:failure
  • successful resolution followed by a disconnected/broken client: data frame with result:failure

A successful WebSocket write is server-side delivery, not proof that the client application processed the frame.

Branch relationship

This is a stacked PR based on mwisner/fix/kafka-consumer-client-leak, the head branch for wundergraph#3133. The branch therefore retains the merged-context Kafka poller and deferred consumer-client cleanup. This PR must not be merged into the leak-fix branch; after wundergraph#3133 merges, it should be retargeted/rebased onto upstream main.

No StockX custom-module code or custom-module observability interface is involved.

Metrics

  • router.streams.processed.messages
    • wg.stream.processing.result: dispatched or dropped
    • wg.stream.processing.reason: hook error, timeout, panic, removal, or none
    • provider, destination, and GraphQL root-field attributes
  • router.engine.subscription.resolution.errors
    • wg.subscription.reason
  • router.engine.websocket.frames
    • frame type, payload type, result, and failure reason

Validation

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/mwisner/cosmo/router:sha-8a3547f7fa667a70e7d1e66c224ea4ef0a57762d

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant