File tree Expand file tree Collapse file tree
internal/collector/nodeexporter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,15 +149,15 @@ func (c *NodeExporterCollector) collectSockstat() []collector.Metric {
149149 if len (fields ) < 3 {
150150 continue
151151 }
152- switch {
153- case fields [ 0 ] == "sockets:" :
152+ switch fields [ 0 ] {
153+ case "sockets:" :
154154 // "sockets: used 123"
155155 if fields [1 ] == "used" {
156156 metrics = append (metrics , collector .NewMetric (
157157 "node.sockstat.sockets_used" , parseFloat64 (fields [2 ]), collector .MetricTypeGauge ,
158158 ).WithDescription ("Total sockets in use" ))
159159 }
160- case fields [ 0 ] == "TCP:" :
160+ case "TCP:" :
161161 // "TCP: inuse 5 orphan 0 tw 3 alloc 7 mem 2"
162162 for i := 1 ; i + 1 < len (fields ); i += 2 {
163163 switch fields [i ] {
@@ -171,7 +171,7 @@ func (c *NodeExporterCollector) collectSockstat() []collector.Metric {
171171 ).WithDescription ("TCP sockets in TIME_WAIT" ))
172172 }
173173 }
174- case fields [ 0 ] == "UDP:" :
174+ case "UDP:" :
175175 for i := 1 ; i + 1 < len (fields ); i += 2 {
176176 if fields [i ] == "inuse" {
177177 metrics = append (metrics , collector .NewMetric (
You can’t perform that action at this time.
0 commit comments