Skip to content

feat(metrics): emit per-request metrics on the pass-through path - #77

Merged
rennf93 merged 2 commits into
masterfrom
feat/request-metrics
Oct 15, 2026
Merged

rennf93 merged 2 commits into
masterfrom
feat/request-metrics

Conversation

@rennf93

@rennf93 rennf93 commented Oct 15, 2026

Copy link
Copy Markdown
Member

Closes #76

  • feat(metrics): GuardLayer::with_metrics(MetricsCollector). A response the wrapped service produces for a request the guard let through emits the reference collect_request_metrics samples: request_count, response_time (from the request reaching the guard until the response head is back, like the reference stopping at response start) and error_rate for a >= 400 status, tagged with the path and method. Guard blocks and exclude_paths bypasses emit nothing. The collector owns the agent_enable_metrics gate and the transport, and the layer owns no agent slot, so the caller supplies the collector. axum-guard-rs re-exports this layer and gets the method with its next tower-guard-rs bump.
  • fix(config): the DetectionExclusionConfig literal in from_security_config now spreads ..DetectionExclusionConfig::default(). The open guard-core-rs PR fix(detection): port the verified guard-core reference fixes (passive log reason, semantic header opt-out, Cookie pair scan) guard-core-rs#137 adds a field to that struct, and this keeps the adapter compiling against both the current engine and the new one.

Add GuardLayer::with_metrics(MetricsCollector). A response the wrapped service produces for a request the guard let through now emits the reference collect_request_metrics samples: request_count, response_time (stopping when the response head is back, like the reference stopping at response start) and error_rate for a >= 400 status. Guard blocks and exclude_paths bypasses emit nothing.
…syntax

The guard-core-rs engine is adding fields to DetectionExclusionConfig. The spread keeps this literal compiling against both the current engine and the one with the new field.
@github-actions github-actions Bot added the area: lib Touches src/ (tower::Layer / tower::Service adapter — currently a single-file lib stub) label Oct 15, 2026
@rennf93
rennf93 merged commit 1808b51 into master Oct 15, 2026
11 checks passed
@rennf93
rennf93 deleted the feat/request-metrics branch October 15, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: lib Touches src/ (tower::Layer / tower::Service adapter — currently a single-file lib stub)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(metrics): emit per-request metrics on the pass-through path

1 participant