1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Praxis Contributors
//! Per-filter execution timing metrics.
use histogram;
// -----------------------------------------------------------------------------
// Constants
// -----------------------------------------------------------------------------
/// Histogram for filter hook execution duration in seconds.
const FILTER_DURATION_SECONDS: &str = "praxis_filter_duration_seconds";
/// Request direction label value.
pub const PHASE_REQUEST: &str = "request";
/// Response direction label value.
pub const PHASE_RESPONSE: &str = "response";
/// Header hook label value (`on_request`, `on_response`).
pub const STREAM_HEADERS: &str = "headers";
/// Body hook label value (`on_request_body`, `on_response_body`).
pub const STREAM_BODY: &str = "body";
// -----------------------------------------------------------------------------
// Metric Recording
// -----------------------------------------------------------------------------
/// Record wall-clock duration for a single filter hook invocation.
pub