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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use crate::dto::prelude::*;
//
// Metrics DTOs
//
//
// MetricsKind
//
// Metric family selector.
//
#[derive(CandidType, Clone, Copy, Deserialize)]
#[remain::sorted]
pub enum MetricsKind {
Access,
Auth,
CanisterOps,
Cascade,
CyclesFunding,
CyclesTopup,
DelegatedAuth,
Directory,
Http,
Intent,
InterCanisterCall,
Lifecycle,
ManagementCall,
Perf,
PlatformCall,
Pool,
Provisioning,
Replay,
RootCapability,
Scaling,
#[cfg(feature = "sharding")]
Sharding,
System,
Timer,
WasmStore,
}
//
// MetricEntry
//
// Unified metrics row.
//
#[derive(CandidType, Deserialize)]
pub struct MetricEntry {
// Ordered labels.
pub labels: Vec<String>,
// Optional principal dimension.
pub principal: Option<Principal>,
// Metric payload.
pub value: MetricValue,
}
//
// MetricValue
//
#[derive(CandidType, Deserialize)]
pub enum MetricValue {
Count(u64),
CountAndU64 { count: u64, value_u64: u64 },
U128(u128),
}
//
// QueryPerfSample
//
// Same-call query performance sample.
//
#[derive(CandidType, Deserialize)]
pub struct QueryPerfSample<T> {
// Query result returned by the probe.
pub value: T,
// Local instruction counter observed in the same query call context.
pub local_instructions: u64,
}