mz_catalog/durable/
metrics.rs1use mz_ore::metric;
13use mz_ore::metrics::{IntCounter, MetricsRegistry};
14use prometheus::{Counter, IntGaugeVec};
15
16#[derive(Debug, Clone)]
17pub struct Metrics {
18 pub transactions_started: IntCounter,
19 pub transaction_commits: IntCounter,
20 pub transaction_commit_latency_seconds: Counter,
21 pub snapshots_taken: IntCounter,
22 pub snapshot_latency_seconds: Counter,
23 pub syncs: IntCounter,
24 pub sync_latency_seconds: Counter,
25 pub collection_entries: IntGaugeVec,
26}
27
28impl Metrics {
29 pub fn new(registry: &MetricsRegistry) -> Self {
31 Self {
32 transactions_started: registry.register(metric!(
33 name: "mz_catalog_transactions_started",
34 help: "Total number of started transactions.",
35 )),
36 transaction_commits: registry.register(metric!(
37 name: "mz_catalog_transaction_commits",
38 help: "Count of transaction commits.",
39 )),
40 transaction_commit_latency_seconds: registry.register(metric!(
41 name: "mz_catalog_transaction_commit_latency_seconds",
42 help: "Total latency for committing a durable catalog transactions.",
43 )),
44 snapshots_taken: registry.register(metric!(
45 name: "mz_catalog_snapshots_taken",
46 help: "Count of snapshots taken.",
47 )),
48 snapshot_latency_seconds: registry.register(metric!(
49 name: "mz_catalog_snapshot_latency_seconds",
50 help: "Total latency for fetching a snapshot of the durable catalog.",
51 )),
52 syncs: registry.register(metric!(
53 name: "mz_catalog_syncs",
54 help: "Count of catalog syncs.",
55 )),
56 sync_latency_seconds: registry.register(metric!(
57 name: "mz_catalog_sync_latency_seconds",
58 help: "Total latency for syncing the in-memory state of the durable catalog with the persisted contents.",
59 )),
60 collection_entries: registry.register(metric!(
61 name: "mz_catalog_collection_entries",
62 help: "Total number of entries, after consolidation, per catalog collection.",
63 var_labels: ["collection"],
64 )),
65 }
66 }
67}