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
46
47
48
49
50
use MetricsErrorKind;
/// Trait for recording metrics from `JwtSource`.
///
/// Implement this trait to integrate with your metrics system (e.g., Prometheus, `StatsD`).
/// Prefer stable, low-cardinality labels when recording metrics.
///
/// # Example
///
/// ```no_run
/// use spiffe::jwt_source::{MetricsErrorKind, MetricsRecorder};
/// use std::sync::Arc;
///
/// struct MyMetrics;
///
/// impl MetricsRecorder for MyMetrics {
/// fn record_update(&self) {
/// // Record update metric
/// }
///
/// fn record_reconnect(&self) {
/// // Record reconnect metric
/// }
///
/// fn record_error(&self, kind: MetricsErrorKind) {
/// // Record error metric with kind label
/// println!("Error: {}", kind.as_str());
/// }
/// }
///
/// let metrics = Arc::new(MyMetrics);
/// // Use with JwtSourceBuilder::metrics()
/// ```