Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
ce0ef7d291 | |||
f2f160b112 | |||
2c29493229 |
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter
|
||||
go 1.23.4
|
||||
|
||||
require (
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.1
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.2
|
||||
github.com/go-resty/resty/v2 v2.16.5
|
||||
github.com/gorilla/schema v1.4.1
|
||||
github.com/rs/zerolog v1.33.0
|
||||
|
2
go.sum
2
go.sum
@ -2,6 +2,8 @@ gitea.libretechconsulting.com/rmcguire/go-app v0.4.0 h1:iEGuA2D15rniiKlgejykxvs0
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.0/go.mod h1:ug6g+FyEi2LguWTQfd+bZrTd1ECsot8BylxgMFEO5DM=
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.1 h1:gjDg2M/j1AdMCtkXqQnLCo6jJUSWQOj56ehfU1S6BGE=
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.1/go.mod h1:9c71S+sJb2NqvOwt3CFsW5WjE895goiRlMTdLimgwHs=
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.2 h1:LQxVLXEHruY32GaMsS5K/tMdjS5kvw6reUh25gshn40=
|
||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.2/go.mod h1:9c71S+sJb2NqvOwt3CFsW5WjE895goiRlMTdLimgwHs=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
|
||||
|
@ -51,7 +51,7 @@ func MapWUUpdate(wuUpdate *WundergroundUpdate) *weather.WeatherUpdate {
|
||||
StationType: wuUpdate.SoftwareType,
|
||||
TempOutdoorF: wuUpdate.Tempf,
|
||||
HumidityOudoor: wuUpdate.Humidity,
|
||||
WindSpeedMPH: wuUpdate.WindGustMPH,
|
||||
WindSpeedMPH: wuUpdate.WindSpeedMPH,
|
||||
WindGustMPH: wuUpdate.WindGustMPH,
|
||||
WindDir: wuUpdate.WindDir,
|
||||
UV: wuUpdate.UV,
|
||||
|
@ -15,11 +15,21 @@ func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
||||
return
|
||||
}
|
||||
|
||||
// Clear invalid measurements
|
||||
if u.BaromAbsoluteIn != nil && *u.BaromAbsoluteIn < 20 {
|
||||
u.BaromAbsoluteIn = nil
|
||||
}
|
||||
if u.BaromRelativeIn != nil && *u.BaromRelativeIn < 20 {
|
||||
u.BaromRelativeIn = nil
|
||||
}
|
||||
|
||||
// Calculate Wind Chill
|
||||
if u.WindChillF == nil && u.TempOutdoorF != nil && u.WindSpeedMPH != nil {
|
||||
wc := CalculateWindChill(*u.TempOutdoorF, *u.WindSpeedMPH)
|
||||
u.WindChillF = &wc
|
||||
}
|
||||
|
||||
// Calculate Dew Point
|
||||
if u.DewPointF == nil && (u.TempOutdoorF != nil && u.HumidityOudoor != nil) {
|
||||
if *u.TempOutdoorF != 0 || *u.HumidityOudoor != 0 {
|
||||
dp := CalculateDewPoint(*u.TempOutdoorF, float64(*u.HumidityOudoor))
|
||||
@ -27,6 +37,7 @@ func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
||||
}
|
||||
}
|
||||
|
||||
// Use relative pressure if absolute isn't provided
|
||||
if u.BaromAbsoluteIn == nil && u.BaromRelativeIn != nil {
|
||||
u.BaromAbsoluteIn = u.BaromRelativeIn
|
||||
}
|
||||
|
@ -114,6 +114,8 @@ func MustInitMetrics(appCtx context.Context) *WeatherMetrics {
|
||||
func (wm *WeatherMetrics) Update(u *WeatherUpdate) {
|
||||
attributes := []attribute.KeyValue{
|
||||
semconv.ServiceVersion(wm.cfg.Version),
|
||||
semconv.ServiceName(wm.cfg.Name),
|
||||
semconv.DeploymentEnvironment(wm.cfg.Environment),
|
||||
}
|
||||
if u.StationType != nil {
|
||||
attributes = append(attributes,
|
||||
|
Reference in New Issue
Block a user