master
go 113 lines 3.34 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package k8s_kubelet
4
5 import (
6 mtx "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/oldmetrix"
7 )
8
9 func newMetrics() *metrics {
10 var mx metrics
11 mx.RESTClient.Requests.ByStatusCode = make(map[string]mtx.Gauge)
12 mx.RESTClient.Requests.ByMethod = make(map[string]mtx.Gauge)
13 mx.Kubelet.Runtime.Operations = make(map[string]mtx.Gauge)
14 mx.Kubelet.Runtime.OperationsErrors = make(map[string]mtx.Gauge)
15 mx.Kubelet.Docker.Operations = make(map[string]mtx.Gauge)
16 mx.Kubelet.Docker.OperationsErrors = make(map[string]mtx.Gauge)
17 mx.Kubelet.PodLogFileSystemUsage = make(map[string]mtx.Gauge)
18
19 return &mx
20 }
21
22 type metrics struct {
23 Token tokenMetrics `stm:"token"`
24 RESTClient restClientMetrics `stm:"rest_client"`
25 APIServer apiServerMetrics `stm:"apiserver"`
26 Kubelet kubeletMetrics `stm:"kubelet"`
27 VolumeManager volumeManagerMetrics `stm:"volume_manager"`
28 }
29
30 type tokenMetrics struct {
31 Count mtx.Gauge `stm:"count"`
32 FailCount mtx.Gauge `stm:"fail_count"`
33 }
34
35 type restClientMetrics struct {
36 Requests struct {
37 ByStatusCode map[string]mtx.Gauge `stm:""`
38 ByMethod map[string]mtx.Gauge `stm:""`
39 } `stm:"requests"`
40 }
41
42 type apiServerMetrics struct {
43 Audit struct {
44 Requests struct {
45 Rejected mtx.Gauge `stm:"rejected_total"`
46 } `stm:"requests"`
47 } `stm:"audit"`
48 Storage struct {
49 EnvelopeTransformation struct {
50 CacheMisses mtx.Gauge `stm:"cache_misses_total"`
51 } `stm:"envelope_transformation"`
52 DataKeyGeneration struct {
53 Failures mtx.Gauge `stm:"failures_total"`
54 Latencies struct {
55 LE5 mtx.Gauge `stm:"5"`
56 LE10 mtx.Gauge `stm:"10"`
57 LE20 mtx.Gauge `stm:"20"`
58 LE40 mtx.Gauge `stm:"40"`
59 LE80 mtx.Gauge `stm:"80"`
60 LE160 mtx.Gauge `stm:"160"`
61 LE320 mtx.Gauge `stm:"320"`
62 LE640 mtx.Gauge `stm:"640"`
63 LE1280 mtx.Gauge `stm:"1280"`
64 LE2560 mtx.Gauge `stm:"2560"`
65 LE5120 mtx.Gauge `stm:"5120"`
66 LE10240 mtx.Gauge `stm:"10240"`
67 LE20480 mtx.Gauge `stm:"20480"`
68 LE40960 mtx.Gauge `stm:"40960"`
69 LEInf mtx.Gauge `stm:"+Inf"`
70 } `stm:"bucket"`
71 } `stm:"data_key_generation"`
72 } `stm:"storage"`
73 }
74
75 type kubeletMetrics struct {
76 NodeConfigError mtx.Gauge `stm:"node_config_error"`
77 RunningContainerCount mtx.Gauge `stm:"running_container"`
78 RunningPodCount mtx.Gauge `stm:"running_pod"`
79 PLEG struct {
80 Relist struct {
81 Interval struct {
82 Quantile05 mtx.Gauge `stm:"05"`
83 Quantile09 mtx.Gauge `stm:"09"`
84 Quantile099 mtx.Gauge `stm:"099"`
85 } `stm:"interval"`
86 Latency struct {
87 Quantile05 mtx.Gauge `stm:"05"`
88 Quantile09 mtx.Gauge `stm:"09"`
89 Quantile099 mtx.Gauge `stm:"099"`
90 } `stm:"latency"`
91 } `stm:"relist"`
92 } `stm:"pleg"`
93 Runtime struct {
94 Operations map[string]mtx.Gauge `stm:"operations"`
95 OperationsErrors map[string]mtx.Gauge `stm:"operations_errors"`
96 } `stm:"runtime"`
97 Docker struct {
98 Operations map[string]mtx.Gauge `stm:"operations"`
99 OperationsErrors map[string]mtx.Gauge `stm:"operations_errors"`
100 } `stm:"docker"`
101 PodLogFileSystemUsage map[string]mtx.Gauge `stm:"log_file_system_usage"`
102 }
103
104 type volumeManagerMetrics struct {
105 Plugins map[string]*volumeManagerPlugin `stm:"plugin"`
106 }
107
108 type volumeManagerPlugin struct {
109 State struct {
110 Actual mtx.Gauge `stm:"actual"`
111 Desired mtx.Gauge `stm:"desired"`
112 } `stm:"state"`
113 }