node_exporter/collector/fixtures/ethtool/eth0/statistics
Benjamin Drung d85cbaa17c
ethtool: Prevent duplicate metric names (#2187)
Sanitizing the metric names can lead to duplicate metric names:

```
caller=level.go:63 level=error caller="error gathering metrics: [from Gatherer #2] collected metric \"node_ethtool_giant_hdr\" { label:<name:\"device\" value:\"ens192\" > untyped:<value:0" msg=" > } was collected before with the same name and label values"
```

Generate a map from the sanitized metric names to the metric names from
ethtool. In case of duplicate sanitized metric names drop both metrics,
because it is unknown which one to take.

Fixes: https://github.com/prometheus/node_exporter/issues/2185
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
2021-11-15 11:22:36 +01:00

18 lines
380 B
Plaintext

# ethtool -S eth0
NIC statistics:
tx_packets: 961500
rx_packets: 1260062
tx_errors: 0
rx_errors: 0
rx_missed: 401
align_errors: 0
tx_single_collisions: 0
tx_multi_collisions: 0
rx_unicast: 1230297
rx_broadcast: 5792
rx_multicast: 23973
tx_aborted: 0
tx_underrun: 0
duplicate metric: 1
duplicate_metric: 2