Compare commits
2 Commits
87f0cbac01
...
3af1cc40a5
Author | SHA1 | Date | |
---|---|---|---|
3af1cc40a5 | |||
4ff684abe3 |
2
TODO.md
2
TODO.md
@ -1,10 +1,12 @@
|
||||
# TODO
|
||||
- [ ] Configuration for app
|
||||
- [ ] Configurable metric prefix
|
||||
- [ ] Helm Chart
|
||||
- [ ] Update README
|
||||
- [ ] Add Grafana dashboard
|
||||
- [ ] Add device name field with ID/Key mappings
|
||||
- [ ] Add device type field with ID/Key mappings
|
||||
- [ ] Move EVERYTHING to pointers to support nil
|
||||
|
||||
## Done
|
||||
- [x] Consolidate battery status into one metric with device label
|
||||
|
@ -43,6 +43,8 @@ type WeatherMetrics struct {
|
||||
meter metric.Meter
|
||||
}
|
||||
|
||||
var MetricPrefix = "weather"
|
||||
|
||||
func MustInitMetrics(appCtx context.Context) *WeatherMetrics {
|
||||
wm := &WeatherMetrics{
|
||||
appCtx: appCtx,
|
||||
@ -52,55 +54,55 @@ func MustInitMetrics(appCtx context.Context) *WeatherMetrics {
|
||||
wm.meter = otel.GetMeter(appCtx, "weather", "metrics")
|
||||
|
||||
// Weather Metrics
|
||||
wm.TempOutdoorF, _ = wm.meter.Float64Gauge("weather_temp_outdoor_f",
|
||||
wm.TempOutdoorF, _ = wm.meter.Float64Gauge(MetricPrefix+"_temp_outdoor_f",
|
||||
metric.WithDescription("Outdoor Temperature in Faherenheit"))
|
||||
wm.TempIndoorF, _ = wm.meter.Float64Gauge("weather_temp_indoor_f",
|
||||
wm.TempIndoorF, _ = wm.meter.Float64Gauge(MetricPrefix+"_temp_indoor_f",
|
||||
metric.WithDescription("Indoor Temperature in Faherenheit"))
|
||||
wm.HumidityOudoor, _ = wm.meter.Int64Gauge("weather_humidity_outdoor",
|
||||
wm.HumidityOudoor, _ = wm.meter.Int64Gauge(MetricPrefix+"_humidity_outdoor",
|
||||
metric.WithDescription("Outdoor Humidity %"))
|
||||
wm.HumidityIndoor, _ = wm.meter.Int64Gauge("weather_humidity_indoor",
|
||||
wm.HumidityIndoor, _ = wm.meter.Int64Gauge(MetricPrefix+"_humidity_indoor",
|
||||
metric.WithDescription("Indoor Humidity %"))
|
||||
wm.WindSpeedMPH, _ = wm.meter.Float64Gauge("weather_wind_speed_mph",
|
||||
wm.WindSpeedMPH, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_speed_mph",
|
||||
metric.WithDescription("Wind Speed in MPH"))
|
||||
wm.WindGustMPH, _ = wm.meter.Float64Gauge("weather_wind_gust_mph",
|
||||
wm.WindGustMPH, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_gust_mph",
|
||||
metric.WithDescription("Wind Gust in MPH"))
|
||||
wm.MaxDailyGust, _ = wm.meter.Float64Gauge("weather_max_daily_gust",
|
||||
wm.MaxDailyGust, _ = wm.meter.Float64Gauge(MetricPrefix+"_max_daily_gust",
|
||||
metric.WithDescription("Max Daily Wind Gust"))
|
||||
wm.WindDir, _ = wm.meter.Int64Gauge("weather_wind_dir",
|
||||
wm.WindDir, _ = wm.meter.Int64Gauge(MetricPrefix+"_wind_dir",
|
||||
metric.WithDescription("Wind Direction in Degrees"))
|
||||
wm.WindDirAvg10m, _ = wm.meter.Int64Gauge("weather_wind_dir_avg_10m",
|
||||
wm.WindDirAvg10m, _ = wm.meter.Int64Gauge(MetricPrefix+"_wind_dir_avg_10m",
|
||||
metric.WithDescription("Wind Direction 10m Average"))
|
||||
wm.UV, _ = wm.meter.Int64Gauge("weather_uv",
|
||||
wm.UV, _ = wm.meter.Int64Gauge(MetricPrefix+"_uv",
|
||||
metric.WithDescription("UV Index"))
|
||||
wm.SolarRadiation, _ = wm.meter.Float64Gauge("weather_solar_radiation",
|
||||
wm.SolarRadiation, _ = wm.meter.Float64Gauge(MetricPrefix+"_solar_radiation",
|
||||
metric.WithDescription("Solar Radiation in W/㎡"))
|
||||
wm.HourlyRainIn, _ = wm.meter.Float64Gauge("weather_hourly_rain_in",
|
||||
wm.HourlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_hourly_rain_in",
|
||||
metric.WithDescription("Hourly Rain in Inches"))
|
||||
wm.EventRainIn, _ = wm.meter.Float64Gauge("weather_event_rain_in",
|
||||
wm.EventRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_event_rain_in",
|
||||
metric.WithDescription("Event Rain in Inches"))
|
||||
wm.DailyRainIn, _ = wm.meter.Float64Gauge("weather_daily_rain_in",
|
||||
wm.DailyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_daily_rain_in",
|
||||
metric.WithDescription("Daily Rain in Inches"))
|
||||
wm.WeeklyRainIn, _ = wm.meter.Float64Gauge("weather_weekly_rain_in",
|
||||
wm.WeeklyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_weekly_rain_in",
|
||||
metric.WithDescription("Weekly Rain in Inches"))
|
||||
wm.MonthlyRainIn, _ = wm.meter.Float64Gauge("weather_monthly_rain_in",
|
||||
wm.MonthlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_monthly_rain_in",
|
||||
metric.WithDescription("Monthly Rain in Inches"))
|
||||
wm.YearlyRainIn, _ = wm.meter.Float64Gauge("weather_yearly_rain_in",
|
||||
wm.YearlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_yearly_rain_in",
|
||||
metric.WithDescription("Yearly Rain in Inches"))
|
||||
wm.TotalRainIn, _ = wm.meter.Float64Gauge("weather_total_rain_in",
|
||||
wm.TotalRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_total_rain_in",
|
||||
metric.WithDescription("Total Rain in Inches"))
|
||||
wm.BatteryStatus, _ = wm.meter.Int64Gauge("battery_status",
|
||||
wm.BatteryStatus, _ = wm.meter.Int64Gauge(MetricPrefix+"_battery_status",
|
||||
metric.WithDescription("Per-component battery status"))
|
||||
wm.BaromRelativeIn, _ = wm.meter.Float64Gauge("weather_barometric_pressure_relative_in",
|
||||
wm.BaromRelativeIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_barometric_pressure_relative_in",
|
||||
metric.WithDescription("Relative Pressure in Inches of Mercury"))
|
||||
wm.BaromAbsoluteIn, _ = wm.meter.Float64Gauge("weather_barometric_pressure_absolute_in",
|
||||
wm.BaromAbsoluteIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_barometric_pressure_absolute_in",
|
||||
metric.WithDescription("Absolute Pressure in Inches of Mercury"))
|
||||
wm.DewPointF, _ = wm.meter.Float64Gauge("weather_dew_point_f",
|
||||
wm.DewPointF, _ = wm.meter.Float64Gauge(MetricPrefix+"_dew_point_f",
|
||||
metric.WithDescription("Dew Point in Faherenheit"))
|
||||
wm.WindChillF, _ = wm.meter.Float64Gauge("weather_wind_chill_f",
|
||||
wm.WindChillF, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_chill_f",
|
||||
metric.WithDescription("Wind Chill in Faherenheit"))
|
||||
|
||||
// Internal Telemetry
|
||||
wm.UpdatesReceived, _ = wm.meter.Int64Counter("weather_updates_received",
|
||||
wm.UpdatesReceived, _ = wm.meter.Int64Counter(MetricPrefix+"_updates_received",
|
||||
metric.WithDescription("Metric Updates Processed by Exporter"))
|
||||
|
||||
return wm
|
||||
|
Loading…
Reference in New Issue
Block a user