Skip to content

System traffic no longer counts as application message metrics (CritterWatch GH-907) - #3759

Merged
jeremydmiller merged 2 commits into
mainfrom
gh-cw907/silence-system-traffic-metrics
Aug 1, 2026
Merged

System traffic no longer counts as application message metrics (CritterWatch GH-907)#3759
jeremydmiller merged 2 commits into
mainfrom
gh-cw907/silence-system-traffic-metrics

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Fixes the Wolverine half of CritterWatch #907: an idle Wolverine app with CritterWatch applied reported ~150 messages/minute of nothing but its own machinery — agent commands on the control queues, acks, and CritterWatch's monitoring messages, the last of which fed back on itself (accumulator exports are published to CritterWatch as messages that were themselves counted).

The three gaps

  1. Meter counters were unconditional. wolverine-messages-sent incremented for every send regardless of what the traffic was (the TelemetryEnabled flag gated spans, never metrics). Sending agents, local queues, and listening pipelines now resolve their tracker via MessageTrackingFor(endpoint) — a System-role endpoint or one with TelemetryEnabled = false gets a new metrics-silent SystemTrafficMessageTracker that keeps debug logging, tracked-session bookkeeping, and wire taps, but records nothing.
  2. The executor factory excluded only IAgentCommand, and only in the CritterWatch modes. It now excludes the full system-message surface via the existing IsSystemMessageType() predicate (IInternalMessage, IAgentCommand, INotToBeRouted — which covers ICritterWatchMessage and acknowledgements — and opted-out assemblies), in every metrics mode, and consults the endpoint role too.
  3. UseTcpForControlEndpoint never stamped the System role on the endpoint it promoted, unlike the database/shared-memory control endpoints that are born with it. The NodeControlEndpoint setter stamps it now.

Design constraints honored (from the issue)

  • No per-envelope branching: every decision is resolved once at construction (per endpoint agent, per executor) — the sendWithTracing/sendWithOutTracing pattern.
  • EndpointRole, not string matching, is the classification the system relies on; the old IsSystemEndpoint string match stays only as defense in depth on the accumulator paths.

Behavior change to be aware of

Endpoint.TelemetryEnabled = false now silences metrics as well as traces for that endpoint, and system message types no longer appear in any message-level instrument in any mode. The metrics docs gained a callout.

Testing

  • New system_traffic_metrics_silencing suite in CoreTests (9 tests): tracker selection per role/flag/message type, control-endpoint promotion, and MeterListener-verified silence vs. counting.
  • Full CoreTests: 2176 passed. MetricsTests: 25 passed — including the pump tests that prove application traffic is still counted in CritterWatch/Hybrid modes.

Companion change

Wolverine.CritterWatch will mark its own outbound/inbound endpoints System-role in a CritterWatch-repo PR (InternalsVisibleTo already covers it); end-to-end idle-app verification lands there per the issue.

🤖 Generated with Claude Code

https://claude.ai/code/session_013eR4GL278688VhyhrGcttJ

jeremydmiller and others added 2 commits August 1, 2026 07:15
…erWatch GH-907)

An idle Wolverine app with CritterWatch applied reported ~150 messages a
minute of nothing but its own machinery: agent commands on the node control
queues, acknowledgements, and CritterWatch's monitoring messages — the last
of which fed back on itself, since the accumulator's exports are published
to CritterWatch as messages that were themselves counted.

Three gaps closed, all resolved ONCE at construction time (per endpoint,
per executor) with no per-envelope branching, following the same shape as
InlineSendingAgent's sendWithTracing/sendWithOutTracing split:

- The meter counters in WolverineRuntime.Tracking were unconditional — every
  send incremented wolverine-messages-sent no matter what the traffic was.
  Sending agents, local queues, and listening pipelines now resolve their
  tracker through MessageTrackingFor(endpoint): a System-role endpoint or
  one with TelemetryEnabled = false gets the new metrics-silent
  SystemTrafficMessageTracker, which keeps the debug logging,
  tracked-session bookkeeping, and wire taps but records nothing.
- The executor factory excluded only IAgentCommand, and only in the
  CritterWatch publishing modes. It now excludes the full system-message
  surface (IInternalMessage, IAgentCommand, INotToBeRouted — which covers
  ICritterWatchMessage and acknowledgements — and opted-out assemblies) in
  EVERY metrics mode, and consults the endpoint's role as well.
- An endpoint promoted to node control duty (UseTcpForControlEndpoint) never
  received the System role, unlike the database and shared-memory control
  endpoints that are born with it. The NodeControlEndpoint setter stamps it
  now.

The old IsSystemEndpoint string match stays as defense in depth for the
accumulator paths, but the classification the system actually relies on is
EndpointRole, per the GH-907 acceptance criteria.

Wolverine.CritterWatch's own endpoints get marked System-role in a matching
CritterWatch-repo change (InternalsVisibleTo already covers it).

Full CoreTests (2176) and MetricsTests (25, including the pump tests that
prove application traffic is still counted in CritterWatch/Hybrid modes)
pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013eR4GL278688VhyhrGcttJ
@jeremydmiller
jeremydmiller merged commit 3fac0fe into main Aug 1, 2026
32 checks passed
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