1
0
Эх сурвалжийг харах

Group all metrics for a given sensor

These values are provided via labels and it's much easier when handling Prometheus
data to filter via a label than to merge data from two different metrics.
This allows a dashboard to be generic enough to work for different machines.
Henrique Gemignani Passos Lima 6 жил өмнө
parent
commit
6b8859885e

+ 1 - 5
OhmGraphite/PrometheusCollection.cs

@@ -30,11 +30,7 @@ namespace OhmGraphite
             foreach (var sensor in _collector.ReadAllSensors())
             {
                 _metrics.CreateGauge(
-                        sensor.Identifier.Substring(1)
-                            .Replace('/', '_')
-                            .Replace("{", null)
-                            .Replace("}", null)
-                            .Replace('-', '_'),
+                        "ohm_" + sensor.SensorType.ToString().ToLower(),
                         "Metric reported by open hardware sensor",
                         "host", "app", "hardware", "hardware_type", "sensor", "sensor_index")
                     .WithLabels(_localHost, "ohm", sensor.Hardware,