atm0s_reverse_proxy_relayer/
metrics.rs

1use metrics::{describe_counter, describe_gauge, describe_histogram};
2
3// this is for online agent counting
4pub const METRICS_AGENT_LIVE: &str = "atm0s_agent_live";
5pub const METRICS_AGENT_HISTOGRAM: &str = "atm0s_agent_histogram";
6pub const METRICS_AGENT_COUNT: &str = "atm0s_agent_count";
7
8// this is for proxy from agent counting (incoming)
9pub const METRICS_PROXY_AGENT_LIVE: &str = "atm0s_proxy_agent_live";
10pub const METRICS_PROXY_AGENT_COUNT: &str = "atm0s_proxy_agent_count";
11pub const METRICS_PROXY_AGENT_HISTOGRAM: &str = "atm0s_proxy_agent_histogram";
12pub const METRICS_PROXY_AGENT_ERROR_COUNT: &str = "atm0s_proxy_agent_error_count";
13
14// this is for http proxy counting (incoming)
15pub const METRICS_PROXY_HTTP_LIVE: &str = "atm0s_proxy_http_live";
16pub const METRICS_PROXY_HTTP_COUNT: &str = "atm0s_proxy_http_count";
17pub const METRICS_PROXY_HTTP_ERROR_COUNT: &str = "atm0s_proxy_http_error_count";
18
19// this is for cluster proxy (incoming)
20pub const METRICS_PROXY_CLUSTER_LIVE: &str = "atm0s_proxy_cluster_live";
21pub const METRICS_PROXY_CLUSTER_COUNT: &str = "atm0s_proxy_cluster_count";
22pub const METRICS_PROXY_CLUSTER_ERROR_COUNT: &str = "atm0s_proxy_cluster_error_count";
23
24// this is for tunnel from local node to other node (outgoing)
25pub const METRICS_TUNNEL_CLUSTER_LIVE: &str = "atm0s_tunnel_cluster_live";
26pub const METRICS_TUNNEL_CLUSTER_COUNT: &str = "atm0s_tunnel_cluster_count";
27pub const METRICS_TUNNEL_CLUSTER_HISTOGRAM: &str = "atm0s_tunnel_cluster_histogram";
28pub const METRICS_TUNNEL_CLUSTER_ERROR_COUNT: &str = "atm0s_tunnel_cluster_error_count";
29
30// this is for tunnel from local node to agent  (outgoing)
31pub const METRICS_TUNNEL_AGENT_LIVE: &str = "atm0s_tunnel_agent_live";
32pub const METRICS_TUNNEL_AGENT_COUNT: &str = "atm0s_tunnel_agent_count";
33pub const METRICS_TUNNEL_AGENT_HISTOGRAM: &str = "atm0s_tunnel_agent_histogram";
34pub const METRICS_TUNNEL_AGENT_ERROR_COUNT: &str = "atm0s_tunnel_agent_error_count";
35
36pub fn describe_metrics() {
37    // this is for online agent counting
38    describe_gauge!(METRICS_AGENT_LIVE, "Live agent count");
39    describe_histogram!(METRICS_AGENT_HISTOGRAM, "Incoming agent connection accept time histogram");
40    describe_counter!(METRICS_AGENT_COUNT, "Number of connected agents");
41
42    // this is for proxy from agent counting (incoming)
43    describe_gauge!(METRICS_PROXY_AGENT_LIVE, "Live incoming proxy from agent to cluster");
44    describe_counter!(METRICS_PROXY_AGENT_COUNT, "Number of incoming proxy from agent to cluster");
45    describe_histogram!(METRICS_PROXY_AGENT_HISTOGRAM, "Incoming proxy from agent to cluster latency histogram");
46    describe_counter!(METRICS_PROXY_AGENT_ERROR_COUNT, "Number of incoming proxy error from agent to cluster");
47
48    // this is for http proxy counting (incoming)
49    describe_gauge!(METRICS_PROXY_HTTP_LIVE, "Live incoming http proxy");
50    describe_counter!(METRICS_PROXY_HTTP_COUNT, "Number of incoming http proxy");
51    describe_counter!(METRICS_PROXY_HTTP_ERROR_COUNT, "Number of incoming http proxy error");
52
53    // this is for cluster proxy (incoming)
54    describe_gauge!(METRICS_PROXY_CLUSTER_LIVE, "Live incoming cluster proxy");
55    describe_counter!(METRICS_PROXY_CLUSTER_COUNT, "Number of incoming cluster proxy");
56    describe_counter!(METRICS_PROXY_CLUSTER_ERROR_COUNT, "Number of incoming cluster proxy error");
57
58    // this is for tunnel from local node to other node (outgoing)
59    describe_gauge!(METRICS_TUNNEL_CLUSTER_LIVE, "Live outgoing tunnel to cluster");
60    describe_counter!(METRICS_TUNNEL_CLUSTER_COUNT, "Number of outgoing tunnel to cluster");
61    describe_histogram!(METRICS_TUNNEL_CLUSTER_HISTOGRAM, "Outgoing tunnel to cluster latency histogram");
62    describe_counter!(METRICS_TUNNEL_CLUSTER_ERROR_COUNT, "Number of outgoing tunnel to cluster error");
63
64    // this is for tunnel from local node to agent  (outgoing)
65    describe_gauge!(METRICS_TUNNEL_AGENT_LIVE, "Live outgoing tunnel to agent");
66    describe_counter!(METRICS_TUNNEL_AGENT_COUNT, "Number of outgoing tunnel to agent");
67    describe_counter!(METRICS_TUNNEL_AGENT_HISTOGRAM, "Outgoing tunnel to agent latency histogram");
68    describe_counter!(METRICS_TUNNEL_AGENT_ERROR_COUNT, "Number of outgoing tunnel to agent error");
69}