Coverage Report

Created: 2026-02-14 06:16

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ztunnel/src/inpod/metrics.rs
Line
Count
Source
1
// Copyright Istio Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
use prometheus_client::metrics::counter::Counter;
16
use prometheus_client::metrics::gauge::Gauge;
17
use prometheus_client::registry::Registry;
18
19
#[derive(Default)]
20
pub struct Metrics {
21
    pub(super) active_proxy_count: Gauge,
22
    pub(super) pending_proxy_count: Gauge,
23
    pub(super) proxies_started: Counter,
24
    pub(super) proxies_stopped: Counter,
25
}
26
27
impl Metrics {
28
0
    pub fn new(registry: &mut Registry) -> Self {
29
0
        let m = Self::default();
30
0
        registry.register(
31
            "active_proxy_count",
32
            "The total number current workloads with active proxies (unstable)",
33
0
            m.active_proxy_count.clone(),
34
        );
35
0
        registry.register(
36
            "pending_proxy_count",
37
            "The total number current workloads with pending proxies (unstable)",
38
0
            m.pending_proxy_count.clone(),
39
        );
40
0
        registry.register(
41
            "proxies_started",
42
            "The total number of proxies that were started (unstable)",
43
0
            m.proxies_started.clone(),
44
        );
45
0
        registry.register(
46
            "proxies_stopped",
47
            "The total number of proxies that were stopped (unstable)",
48
0
            m.proxies_stopped.clone(),
49
        );
50
0
        m
51
0
    }
52
}