@@ -10,16 +10,14 @@ import (
10
10
)
11
11
12
12
type PrometheusProcessMetrics struct {
13
- previousMetrics * ProcessMetrics
14
- cpuGauge prometheus.Gauge
15
- ramGauge prometheus.Gauge
16
- swapGauge prometheus.Gauge
17
- diskReadBytesGauge prometheus.Gauge
18
- diskWriteBytesGauge prometheus.Gauge
19
- diskReadCountGauge prometheus.Gauge
20
- diskWriteCountGauge prometheus.Gauge
21
- networkInBytesGauge prometheus.Gauge
22
- networkOutBytesGauge prometheus.Gauge
13
+ previousMetrics * ProcessMetrics
14
+ cpuGauge prometheus.Gauge
15
+ ramGauge prometheus.Gauge
16
+ swapGauge prometheus.Gauge
17
+ diskReadBytesGauge prometheus.Gauge
18
+ diskWriteBytesGauge prometheus.Gauge
19
+ diskReadCountGauge prometheus.Gauge
20
+ diskWriteCountGauge prometheus.Gauge
23
21
}
24
22
25
23
func newPrometheusProcessMetrics (proc ps.Process , descriptiveName , metricNamespace string ) (processMetrics * PrometheusProcessMetrics ) {
@@ -28,7 +26,6 @@ func newPrometheusProcessMetrics(proc ps.Process, descriptiveName, metricNamespa
28
26
pid := fmt .Sprintf ("%d" , proc .Pid ())
29
27
processMetrics .makeGauges (metricNamespace , pid , binaryName , descriptiveName )
30
28
processMetrics .makeDiskGauges (metricNamespace , pid , binaryName , descriptiveName )
31
- processMetrics .makeNetworkGauges (metricNamespace , pid , binaryName , descriptiveName )
32
29
return processMetrics
33
30
}
34
31
@@ -80,21 +77,6 @@ func (pm *PrometheusProcessMetrics) makeDiskGauges(metricNamespace, pid, binaryN
80
77
})
81
78
}
82
79
83
- func (pm * PrometheusProcessMetrics ) makeNetworkGauges (metricNamespace , pid , binaryName , descriptiveName string ) {
84
- pm .networkInBytesGauge = prometheus .NewGauge (prometheus.GaugeOpts {
85
- Namespace : metricNamespace ,
86
- Name : "net_read_bytes" ,
87
- Help : "Total read from disk (bytes)" ,
88
- ConstLabels : prometheus.Labels {"pid" : pid , "bin" : binaryName , "name" : descriptiveName },
89
- })
90
- pm .networkOutBytesGauge = prometheus .NewGauge (prometheus.GaugeOpts {
91
- Namespace : metricNamespace ,
92
- Name : "net_write_bytes" ,
93
- Help : "Total written to disk (bytes)" ,
94
- ConstLabels : prometheus.Labels {"pid" : pid , "bin" : binaryName , "name" : descriptiveName },
95
- })
96
- }
97
-
98
80
func (pm * PrometheusProcessMetrics ) Register () error {
99
81
registeredCollectors := make ([]prometheus.Collector , 0 )
100
82
var err error
@@ -106,8 +88,6 @@ func (pm *PrometheusProcessMetrics) Register() error {
106
88
pm .diskWriteBytesGauge ,
107
89
pm .diskReadCountGauge ,
108
90
pm .diskWriteCountGauge ,
109
- pm .networkInBytesGauge ,
110
- pm .networkOutBytesGauge ,
111
91
} {
112
92
err = prometheus .Register (collector )
113
93
if err != nil {
@@ -146,7 +126,5 @@ func (pm *PrometheusProcessMetrics) Set(processMetrics *ProcessMetrics) {
146
126
pm .diskWriteBytesGauge .Set (float64 (processMetrics .diskWriteBytes ))
147
127
pm .diskReadCountGauge .Set (float64 (processMetrics .diskReadCount ))
148
128
pm .diskWriteCountGauge .Set (float64 (processMetrics .diskWriteCount ))
149
- pm .networkInBytesGauge .Set (float64 (processMetrics .networkInBytes ))
150
- pm .networkOutBytesGauge .Set (float64 (processMetrics .networkOutBytes ))
151
129
pm .previousMetrics = processMetrics
152
130
}
0 commit comments