Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
64ca321c3a | |||
3329c980a9 | |||
b4412a461f | |||
042fd221c4 | |||
29433cddd7 | |||
f98a4cf348 | |||
8b46238e49 | |||
4ed1e465d2 | |||
ea93beb6b2 |
@ -54,6 +54,7 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
- name: Run Go List
|
- name: Run Go List
|
||||||
|
continue-on-error: true
|
||||||
env:
|
env:
|
||||||
TAG_NAME: ${{ github.ref_name }} # Use the pushed tag name
|
TAG_NAME: ${{ github.ref_name }} # Use the pushed tag name
|
||||||
run: |
|
run: |
|
||||||
|
22
go.mod
22
go.mod
@ -3,13 +3,13 @@ module gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter
|
|||||||
go 1.23.4
|
go 1.23.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.5.0
|
gitea.libretechconsulting.com/rmcguire/go-app v0.5.1
|
||||||
github.com/go-resty/resty/v2 v2.16.5
|
github.com/go-resty/resty/v2 v2.16.5
|
||||||
github.com/gorilla/schema v1.4.1
|
github.com/gorilla/schema v1.4.1
|
||||||
github.com/rs/zerolog v1.33.0
|
github.com/rs/zerolog v1.33.0
|
||||||
go.opentelemetry.io/otel v1.34.0
|
go.opentelemetry.io/otel v1.34.0
|
||||||
go.opentelemetry.io/otel/metric v1.34.0
|
go.opentelemetry.io/otel/metric v1.34.0
|
||||||
golang.org/x/sys v0.29.0
|
golang.org/x/sys v0.30.0
|
||||||
k8s.io/utils v0.0.0-20241210054802-24370beab758
|
k8s.io/utils v0.0.0-20241210054802-24370beab758
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ require (
|
|||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||||
github.com/klauspost/compress v1.17.11 // indirect
|
github.com/klauspost/compress v1.18.0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/prometheus/client_golang v1.20.5 // indirect
|
github.com/prometheus/client_golang v1.21.1 // indirect
|
||||||
github.com/prometheus/client_model v0.6.1 // indirect
|
github.com/prometheus/client_model v0.6.1 // indirect
|
||||||
github.com/prometheus/common v0.62.0 // indirect
|
github.com/prometheus/common v0.62.0 // indirect
|
||||||
github.com/prometheus/procfs v0.15.1 // indirect
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
@ -43,11 +43,11 @@ require (
|
|||||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
|
go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.34.0 // indirect
|
go.opentelemetry.io/otel/trace v1.34.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
||||||
golang.org/x/net v0.34.0 // indirect
|
golang.org/x/net v0.36.0 // indirect
|
||||||
golang.org/x/text v0.21.0 // indirect
|
golang.org/x/text v0.22.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/grpc v1.70.0 // indirect
|
google.golang.org/grpc v1.71.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.4 // indirect
|
google.golang.org/protobuf v1.36.5 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
31
go.sum
31
go.sum
@ -6,6 +6,8 @@ gitea.libretechconsulting.com/rmcguire/go-app v0.4.2 h1:LQxVLXEHruY32GaMsS5K/tMd
|
|||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.4.2/go.mod h1:9c71S+sJb2NqvOwt3CFsW5WjE895goiRlMTdLimgwHs=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.4.2/go.mod h1:9c71S+sJb2NqvOwt3CFsW5WjE895goiRlMTdLimgwHs=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.5.0 h1:5yYyaXXN5KcxMIPBYLZKztvKGMlYol3+oqzUnkvHBaQ=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.5.0 h1:5yYyaXXN5KcxMIPBYLZKztvKGMlYol3+oqzUnkvHBaQ=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.5.0/go.mod h1:9c71S+sJb2NqvOwt3CFsW5WjE895goiRlMTdLimgwHs=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.5.0/go.mod h1:9c71S+sJb2NqvOwt3CFsW5WjE895goiRlMTdLimgwHs=
|
||||||
|
gitea.libretechconsulting.com/rmcguire/go-app v0.5.1 h1:ONphNgJUWMcLIAR9OqCsRa1IuEBChMbRvS1he9xRt2Y=
|
||||||
|
gitea.libretechconsulting.com/rmcguire/go-app v0.5.1/go.mod h1:QMAlmZVUYvXiEiTvYUDzJ0A5oUu7wSMLy2fM+ma21ME=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
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/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
|
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
|
||||||
@ -31,14 +33,21 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
|
|||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
|
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
|
||||||
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
|
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 h1:VD1gqscl4nYs1YxVuSdemTrSgTKrwOWDK0FVFMqm+Cg=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 h1:VD1gqscl4nYs1YxVuSdemTrSgTKrwOWDK0FVFMqm+Cg=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0/go.mod h1:4EgsQoS4TOhJizV+JTFg40qx1Ofh3XmXEQNBpgvNT40=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0/go.mod h1:4EgsQoS4TOhJizV+JTFg40qx1Ofh3XmXEQNBpgvNT40=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 h1:e9Rjr40Z98/clHv5Yg79Is0NtosR5LXRvdr7o/6NwbA=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1/go.mod h1:tIxuGz/9mpox++sgp9fJjHO0+q1X9/UOWd798aAm22M=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
@ -59,6 +68,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
||||||
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||||
|
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
|
||||||
|
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
|
||||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||||
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
|
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
|
||||||
@ -104,23 +115,43 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
|||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||||
|
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||||
|
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||||
|
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
|
||||||
|
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||||
|
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
|
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||||
|
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||||
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
|
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
|
||||||
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 h1:A2ni10G3UlplFrWdCDJTl7D7mJ7GSRm37S+PDimaKRw=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 h1:A2ni10G3UlplFrWdCDJTl7D7mJ7GSRm37S+PDimaKRw=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b h1:i+d0RZa8Hs2L/MuaOQYI+krthcxdEbEM2N+Tf3kJ4zk=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 h1:J1H9f+LEdWAfHcez/4cvaVBox7cOYT+IU6rgqj5x++8=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 h1:J1H9f+LEdWAfHcez/4cvaVBox7cOYT+IU6rgqj5x++8=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b h1:FQtJ1MxbXoIIrZHZ33M+w5+dAP9o86rgpjoKr/ZmT7k=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
|
||||||
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
|
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
|
||||||
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
|
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
|
||||||
|
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
|
||||||
|
google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
|
||||||
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
|
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
|
||||||
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
|
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||||
|
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter/pkg/ambient/config"
|
"gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter/pkg/ambient/config"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter/pkg/provider"
|
"gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter/pkg/provider"
|
||||||
@ -67,6 +68,11 @@ func (aw *AmbientWeather) GetWundergroundHandlerFunc(appCtx context.Context) fun
|
|||||||
// stable type. Enrich is called on the type to complete
|
// stable type. Enrich is called on the type to complete
|
||||||
// any missing fields as the two providers supported by Ambient
|
// any missing fields as the two providers supported by Ambient
|
||||||
// devices (awn/wunderground) produce different fields
|
// devices (awn/wunderground) produce different fields
|
||||||
|
//
|
||||||
|
// This will call Update on metrics, and will also proxy
|
||||||
|
// requests to AWN/Wunderground if enabled
|
||||||
|
// This is the main work performed when a weather station or
|
||||||
|
// weather hub sends an update
|
||||||
func (aw *AmbientWeather) handleProviderRequest(
|
func (aw *AmbientWeather) handleProviderRequest(
|
||||||
p provider.AmbientProvider,
|
p provider.AmbientProvider,
|
||||||
w http.ResponseWriter,
|
w http.ResponseWriter,
|
||||||
@ -75,9 +81,9 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
l := zerolog.Ctx(aw.appCtx)
|
l := zerolog.Ctx(aw.appCtx)
|
||||||
tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
|
tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
|
||||||
|
|
||||||
ctx, span := tracer.Start(r.Context(), p.Name()+".update")
|
ctx, updateSpan := tracer.Start(r.Context(), p.Name()+".update")
|
||||||
span.SetAttributes(attribute.String("provider", p.Name()))
|
updateSpan.SetAttributes(attribute.String("provider", p.Name()))
|
||||||
defer span.End()
|
defer updateSpan.End()
|
||||||
|
|
||||||
l.Trace().Str("p", p.Name()).
|
l.Trace().Str("p", p.Name()).
|
||||||
Any("query", r.URL.Query()).Send()
|
Any("query", r.URL.Query()).Send()
|
||||||
@ -86,8 +92,8 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
update, err := p.ReqToWeather(ctx, r)
|
update, err := p.ReqToWeather(ctx, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Err(err).Send()
|
l.Err(err).Send()
|
||||||
span.RecordError(err)
|
updateSpan.RecordError(err)
|
||||||
span.SetStatus(codes.Error,
|
updateSpan.SetStatus(codes.Error,
|
||||||
fmt.Sprintf("failed to handle %s update: %s",
|
fmt.Sprintf("failed to handle %s update: %s",
|
||||||
p.Name(), err.Error()))
|
p.Name(), err.Error()))
|
||||||
|
|
||||||
@ -96,20 +102,16 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate any fields that may be missing
|
// Perform enrichment
|
||||||
// such as dew point and wind chill
|
aw.enrichUpdate(ctx, p, update)
|
||||||
update.Enrich()
|
|
||||||
|
|
||||||
// Prepare metrics if this is the first update
|
// We may know which station this was for now
|
||||||
if aw.metrics == nil {
|
if update.StationConfig != nil {
|
||||||
aw.InitMetrics()
|
updateSpan.SetAttributes(attribute.String("stationName", update.StationConfig.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enrich station if configured
|
|
||||||
aw.enrichStation(update)
|
|
||||||
|
|
||||||
// Update metrics
|
// Update metrics
|
||||||
aw.metrics.Update(update)
|
aw.metricsUpdate(ctx, p, update)
|
||||||
|
|
||||||
l.Debug().
|
l.Debug().
|
||||||
Str("provider", p.Name()).
|
Str("provider", p.Name()).
|
||||||
@ -120,44 +122,110 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
// Proxy update to one or both services if configured to do so
|
// Proxy update to one or both services if configured to do so
|
||||||
// Uses a weather update to allow awn to publish to wunderground and
|
// Uses a weather update to allow awn to publish to wunderground and
|
||||||
// visa versa.
|
// visa versa.
|
||||||
if station := update.StationConfig; station != nil {
|
if update.StationConfig != nil {
|
||||||
// Perform proxy updates in parallel if enabled
|
aw.proxyUpdate(ctx, p, update)
|
||||||
var proxyWg sync.WaitGroup
|
|
||||||
|
|
||||||
if station.ProxyToAWN {
|
|
||||||
proxyWg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer proxyWg.Done()
|
|
||||||
err := aw.awnProvider.ProxyReq(ctx, update)
|
|
||||||
if err != nil {
|
|
||||||
zerolog.Ctx(aw.appCtx).Err(err).Msg("failed to proxy to ambient weather")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
zerolog.Ctx(aw.appCtx).Debug().
|
|
||||||
Str("station", station.Name).
|
|
||||||
Msg("proxied weather update to awn")
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
if station.ProxyToWunderground {
|
|
||||||
proxyWg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer proxyWg.Done()
|
|
||||||
err := aw.wuProvider.ProxyReq(ctx, update)
|
|
||||||
if err != nil {
|
|
||||||
zerolog.Ctx(aw.appCtx).Err(err).Msg("failed to proxy to ambient weather")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
zerolog.Ctx(aw.appCtx).Debug().
|
|
||||||
Str("station", station.Name).
|
|
||||||
Msg("proxied weather update to wunderground")
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
proxyWg.Wait()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (aw *AmbientWeather) enrichUpdate(
|
||||||
|
ctx context.Context,
|
||||||
|
p provider.AmbientProvider,
|
||||||
|
update *weather.WeatherUpdate,
|
||||||
|
) {
|
||||||
|
tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
|
||||||
|
|
||||||
|
// Calculate any fields that may be missing
|
||||||
|
// such as dew point and wind chill
|
||||||
|
_, enrichSpan := tracer.Start(ctx, p.Name()+".update.enrich")
|
||||||
|
defer enrichSpan.End()
|
||||||
|
|
||||||
|
// Metric enrichment
|
||||||
|
update.Enrich()
|
||||||
|
|
||||||
|
// Enrich station if configured
|
||||||
|
aw.enrichStation(update)
|
||||||
|
|
||||||
|
// Map sensor names
|
||||||
|
update.MapSensors()
|
||||||
|
|
||||||
|
enrichSpan.SetStatus(codes.Ok, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (aw *AmbientWeather) metricsUpdate(
|
||||||
|
ctx context.Context,
|
||||||
|
p provider.AmbientProvider,
|
||||||
|
update *weather.WeatherUpdate,
|
||||||
|
) {
|
||||||
|
tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
|
||||||
|
_, metricsSpan := tracer.Start(ctx, p.Name()+".update.metrics")
|
||||||
|
|
||||||
|
if aw.metrics == nil {
|
||||||
|
aw.InitMetrics()
|
||||||
|
}
|
||||||
|
|
||||||
|
aw.metrics.Update(update)
|
||||||
|
|
||||||
|
metricsSpan.SetStatus(codes.Ok, "")
|
||||||
|
metricsSpan.End()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (aw *AmbientWeather) proxyUpdate(
|
||||||
|
ctx context.Context,
|
||||||
|
p provider.AmbientProvider,
|
||||||
|
update *weather.WeatherUpdate,
|
||||||
|
) {
|
||||||
|
var proxyWg sync.WaitGroup
|
||||||
|
|
||||||
|
tracer := otel.GetTracer(aw.appCtx, p.Name()+".http.handler")
|
||||||
|
station := update.StationConfig
|
||||||
|
|
||||||
|
ctx, proxySpan := tracer.Start(ctx, p.Name()+".update.proxy", trace.WithAttributes(
|
||||||
|
attribute.Bool("proxyToWunderground", station.ProxyToWunderground),
|
||||||
|
attribute.Bool("proxyToAWN", station.ProxyToAWN),
|
||||||
|
))
|
||||||
|
defer proxySpan.End()
|
||||||
|
|
||||||
|
// Perform proxy updates in parallel if enabled
|
||||||
|
|
||||||
|
if station.ProxyToAWN {
|
||||||
|
proxyWg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer proxyWg.Done()
|
||||||
|
defer proxySpan.AddEvent("proxied to ambient weather network")
|
||||||
|
err := aw.awnProvider.ProxyReq(ctx, update)
|
||||||
|
if err != nil {
|
||||||
|
zerolog.Ctx(aw.appCtx).Err(err).Msg("failed to proxy to ambient weather")
|
||||||
|
proxySpan.RecordError(err)
|
||||||
|
proxySpan.SetStatus(codes.Error, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
zerolog.Ctx(aw.appCtx).Debug().
|
||||||
|
Str("station", station.Name).
|
||||||
|
Msg("proxied weather update to awn")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
if station.ProxyToWunderground {
|
||||||
|
proxyWg.Add(1)
|
||||||
|
go func() {
|
||||||
|
defer proxyWg.Done()
|
||||||
|
defer proxySpan.AddEvent("proxied to wunderground")
|
||||||
|
err := aw.wuProvider.ProxyReq(ctx, update)
|
||||||
|
if err != nil {
|
||||||
|
zerolog.Ctx(aw.appCtx).Err(err).Msg("failed to proxy to ambient weather")
|
||||||
|
proxySpan.RecordError(err)
|
||||||
|
proxySpan.SetStatus(codes.Error, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
zerolog.Ctx(aw.appCtx).Debug().
|
||||||
|
Str("station", station.Name).
|
||||||
|
Msg("proxied weather update to wunderground")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
proxyWg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
func (aw *AmbientWeather) InitMetrics() {
|
func (aw *AmbientWeather) InitMetrics() {
|
||||||
if aw.config.MetricPrefix != "" {
|
if aw.config.MetricPrefix != "" {
|
||||||
weather.MetricPrefix = aw.config.MetricPrefix
|
weather.MetricPrefix = aw.config.MetricPrefix
|
||||||
|
@ -51,7 +51,7 @@ func (l *LFStrippingListener) WrapConn(conn net.Conn) net.Conn {
|
|||||||
if !badReqURI.Match(line) {
|
if !badReqURI.Match(line) {
|
||||||
newData = append(newData, '\n')
|
newData = append(newData, '\n')
|
||||||
} else {
|
} else {
|
||||||
zerolog.Ctx(l.ctx).Trace().Bytes("line", line).
|
zerolog.Ctx(l.ctx).Warn().Bytes("line", line).
|
||||||
Msg("malformed request found, stripped 0x0a")
|
Msg("malformed request found, stripped 0x0a")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,4 +33,14 @@ type WeatherStation struct {
|
|||||||
// Check weather.WeatherUpdateField for options
|
// Check weather.WeatherUpdateField for options
|
||||||
KeepMetrics []string `yaml:"keepMetrics"`
|
KeepMetrics []string `yaml:"keepMetrics"`
|
||||||
DropMetrics []string `yaml:"dropMetrics"`
|
DropMetrics []string `yaml:"dropMetrics"`
|
||||||
|
|
||||||
|
// Relabels battery and sensor names
|
||||||
|
// Temp+Humidity Sensors:
|
||||||
|
// - TempHumiditySensor[1-8]
|
||||||
|
// Batteries:
|
||||||
|
// - IndoorSensor
|
||||||
|
// - OutdoorSensor
|
||||||
|
// - RainSensor
|
||||||
|
// - CO2Sensor
|
||||||
|
SensorMappings map[string]string `yaml:"sensorMappings"`
|
||||||
}
|
}
|
||||||
|
12
pkg/ambient/config/ws_map.go
Normal file
12
pkg/ambient/config/ws_map.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
// If the weather-station has a mapping, returns the new
|
||||||
|
// name for the sensor
|
||||||
|
func (ws *WeatherStation) MapSensor(sensor string) string {
|
||||||
|
for name, replacement := range ws.SensorMappings {
|
||||||
|
if name == sensor && replacement != "" {
|
||||||
|
return replacement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sensor
|
||||||
|
}
|
67
pkg/ambient/config/ws_map_test.go
Normal file
67
pkg/ambient/config/ws_map_test.go
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestWeatherStation_MapSensor(t *testing.T) {
|
||||||
|
type fields struct {
|
||||||
|
Name string
|
||||||
|
Equipment string
|
||||||
|
WundergroundID string
|
||||||
|
WundergroundPassword string
|
||||||
|
AWNPassKey string
|
||||||
|
ProxyToAWN bool
|
||||||
|
ProxyToWunderground bool
|
||||||
|
KeepMetrics []string
|
||||||
|
DropMetrics []string
|
||||||
|
SensorMappings map[string]string
|
||||||
|
}
|
||||||
|
type args struct {
|
||||||
|
sensor string
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
fields fields
|
||||||
|
args args
|
||||||
|
want string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Check sensor mapping",
|
||||||
|
fields: fields{
|
||||||
|
SensorMappings: map[string]string{
|
||||||
|
"TempHumiditySensor1": "TestSensor",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
args: args{sensor: "TempHumiditySensor1"},
|
||||||
|
want: "TestSensor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Check sensor no mapping",
|
||||||
|
fields: fields{
|
||||||
|
SensorMappings: map[string]string{
|
||||||
|
"TempHumiditySensor1": "TestSensor",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
args: args{sensor: "TempHumiditySensor2"},
|
||||||
|
want: "TempHumiditySensor2",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
ws := &WeatherStation{
|
||||||
|
Name: tt.fields.Name,
|
||||||
|
Equipment: tt.fields.Equipment,
|
||||||
|
WundergroundID: tt.fields.WundergroundID,
|
||||||
|
WundergroundPassword: tt.fields.WundergroundPassword,
|
||||||
|
AWNPassKey: tt.fields.AWNPassKey,
|
||||||
|
ProxyToAWN: tt.fields.ProxyToAWN,
|
||||||
|
ProxyToWunderground: tt.fields.ProxyToWunderground,
|
||||||
|
KeepMetrics: tt.fields.KeepMetrics,
|
||||||
|
DropMetrics: tt.fields.DropMetrics,
|
||||||
|
SensorMappings: tt.fields.SensorMappings,
|
||||||
|
}
|
||||||
|
if got := ws.MapSensor(tt.args.sensor); got != tt.want {
|
||||||
|
t.Errorf("WeatherStation.MapSensor() = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@ const (
|
|||||||
BattIndoorSensor = "IndoorSensor"
|
BattIndoorSensor = "IndoorSensor"
|
||||||
BattRainSensor = "RainSensor"
|
BattRainSensor = "RainSensor"
|
||||||
BattCO2Sensor = "CO2Sensor"
|
BattCO2Sensor = "CO2Sensor"
|
||||||
|
THSensor = "TempHumiditySensor"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (awn *AWNProvider) Name() string {
|
func (awn *AWNProvider) Name() string {
|
||||||
@ -89,11 +90,54 @@ func MapAwnUpdate(awnUpdate *AmbientWeatherUpdate) *weather.WeatherUpdate {
|
|||||||
Component: BattCO2Sensor,
|
Component: BattCO2Sensor,
|
||||||
Status: awnUpdate.BattCO2,
|
Status: awnUpdate.BattCO2,
|
||||||
},
|
},
|
||||||
|
// Temp and Humidity Sensors
|
||||||
|
{
|
||||||
|
Component: THSensor + "1",
|
||||||
|
Status: awnUpdate.Batt1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "2",
|
||||||
|
Status: awnUpdate.Batt2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "3",
|
||||||
|
Status: awnUpdate.Batt3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "4",
|
||||||
|
Status: awnUpdate.Batt4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "5",
|
||||||
|
Status: awnUpdate.Batt5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "6",
|
||||||
|
Status: awnUpdate.Batt6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "7",
|
||||||
|
Status: awnUpdate.Batt7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Component: THSensor + "8",
|
||||||
|
Status: awnUpdate.Batt8,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
TempIndoorF: awnUpdate.TempInF,
|
TempIndoorF: awnUpdate.TempInF,
|
||||||
HumidityIndoor: awnUpdate.HumidityIn,
|
HumidityIndoor: awnUpdate.HumidityIn,
|
||||||
BaromRelativeIn: awnUpdate.BaromRelIn,
|
BaromRelativeIn: awnUpdate.BaromRelIn,
|
||||||
BaromAbsoluteIn: awnUpdate.BaromAbsIn,
|
BaromAbsoluteIn: awnUpdate.BaromAbsIn,
|
||||||
|
TempHumiditySensors: []*weather.TempHumiditySensor{
|
||||||
|
{Name: THSensor + "1", TempF: awnUpdate.Temp1F, Humidity: awnUpdate.Humidity1},
|
||||||
|
{Name: THSensor + "2", TempF: awnUpdate.Temp2F, Humidity: awnUpdate.Humidity2},
|
||||||
|
{Name: THSensor + "3", TempF: awnUpdate.Temp3F, Humidity: awnUpdate.Humidity3},
|
||||||
|
{Name: THSensor + "4", TempF: awnUpdate.Temp4F, Humidity: awnUpdate.Humidity4},
|
||||||
|
{Name: THSensor + "5", TempF: awnUpdate.Temp5F, Humidity: awnUpdate.Humidity5},
|
||||||
|
{Name: THSensor + "6", TempF: awnUpdate.Temp6F, Humidity: awnUpdate.Humidity6},
|
||||||
|
{Name: THSensor + "7", TempF: awnUpdate.Temp7F, Humidity: awnUpdate.Humidity7},
|
||||||
|
{Name: THSensor + "8", TempF: awnUpdate.Temp8F, Humidity: awnUpdate.Humidity8},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,4 +28,32 @@ type AmbientWeatherUpdate struct {
|
|||||||
BaromAbsIn *float64 `json:"baromabsin,omitempty" schema:"baromabsin"`
|
BaromAbsIn *float64 `json:"baromabsin,omitempty" schema:"baromabsin"`
|
||||||
BattIn *int `json:"battin,omitempty" schema:"battin"`
|
BattIn *int `json:"battin,omitempty" schema:"battin"`
|
||||||
BattCO2 *int `json:"batt_co2,omitempty" schema:"batt_co2"`
|
BattCO2 *int `json:"batt_co2,omitempty" schema:"batt_co2"`
|
||||||
|
*AmbientTempHumiditySensors
|
||||||
|
}
|
||||||
|
|
||||||
|
type AmbientTempHumiditySensors struct {
|
||||||
|
Temp1F *float64 `json:"temp1f,omitempty" schema:"temp1f"`
|
||||||
|
Temp2F *float64 `json:"temp2f,omitempty" schema:"temp2f"`
|
||||||
|
Temp3F *float64 `json:"temp3f,omitempty" schema:"temp3f"`
|
||||||
|
Temp4F *float64 `json:"temp4f,omitempty" schema:"temp4f"`
|
||||||
|
Temp5F *float64 `json:"temp5f,omitempty" schema:"temp5f"`
|
||||||
|
Temp6F *float64 `json:"temp6f,omitempty" schema:"temp6f"`
|
||||||
|
Temp7F *float64 `json:"temp7f,omitempty" schema:"temp7f"`
|
||||||
|
Temp8F *float64 `json:"temp8f,omitempty" schema:"temp8f"`
|
||||||
|
Humidity1 *int `json:"humidity1,omitempty" schema:"humidity1"`
|
||||||
|
Humidity2 *int `json:"humidity2,omitempty" schema:"humidity2"`
|
||||||
|
Humidity3 *int `json:"humidity3,omitempty" schema:"humidity3"`
|
||||||
|
Humidity4 *int `json:"humidity4,omitempty" schema:"humidity4"`
|
||||||
|
Humidity5 *int `json:"humidity5,omitempty" schema:"humidity5"`
|
||||||
|
Humidity6 *int `json:"humidity6,omitempty" schema:"humidity6"`
|
||||||
|
Humidity7 *int `json:"humidity7,omitempty" schema:"humidity7"`
|
||||||
|
Humidity8 *int `json:"humidity8,omitempty" schema:"humidity8"`
|
||||||
|
Batt1 *int `json:"batt1,omitempty" schema:"batt1"`
|
||||||
|
Batt2 *int `json:"batt2,omitempty" schema:"batt2"`
|
||||||
|
Batt3 *int `json:"batt3,omitempty" schema:"batt3"`
|
||||||
|
Batt4 *int `json:"batt4,omitempty" schema:"batt4"`
|
||||||
|
Batt5 *int `json:"batt5,omitempty" schema:"batt5"`
|
||||||
|
Batt6 *int `json:"batt6,omitempty" schema:"batt6"`
|
||||||
|
Batt7 *int `json:"batt7,omitempty" schema:"batt7"`
|
||||||
|
Batt8 *int `json:"batt8,omitempty" schema:"batt8"`
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
// Attempts to complete missing fields that may not
|
// Attempts to complete missing fields that may not
|
||||||
// be set by a specific provider, such as DewPoint and WindChill
|
// be set by a specific provider, such as DewPoint and WindChill
|
||||||
|
// TODO: Add span
|
||||||
func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
||||||
if u == nil {
|
if u == nil {
|
||||||
return
|
return
|
||||||
@ -49,6 +50,24 @@ func (u *WeatherUpdate) Enrich(weatherStations ...*config.WeatherStation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Swaps sensor and component names based on
|
||||||
|
// user provided configuration
|
||||||
|
func (u *WeatherUpdate) MapSensors() {
|
||||||
|
if u.StationConfig == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map sensor battery components
|
||||||
|
for i, batt := range u.Batteries {
|
||||||
|
u.Batteries[i].Component = u.StationConfig.MapSensor(batt.Component)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map other sensors
|
||||||
|
for _, th := range u.TempHumiditySensors {
|
||||||
|
th.Name = u.StationConfig.MapSensor(th.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CalculateDewPoint(tempF, humidity float64) float64 {
|
func CalculateDewPoint(tempF, humidity float64) float64 {
|
||||||
// Convert temperature from Fahrenheit to Celsius
|
// Convert temperature from Fahrenheit to Celsius
|
||||||
tempC := (tempF - 32) * 5 / 9
|
tempC := (tempF - 32) * 5 / 9
|
||||||
|
@ -4,13 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
|
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
|
||||||
"github.com/rs/zerolog"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/metric"
|
"go.opentelemetry.io/otel/metric"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var MetricPrefix = "weather"
|
||||||
|
|
||||||
type WeatherMetrics struct {
|
type WeatherMetrics struct {
|
||||||
// Weather Metrics
|
// Weather Metrics
|
||||||
TempOutdoorF metric.Float64Gauge
|
TempOutdoorF metric.Float64Gauge
|
||||||
@ -37,6 +37,10 @@ type WeatherMetrics struct {
|
|||||||
DewPointF metric.Float64Gauge
|
DewPointF metric.Float64Gauge
|
||||||
WindChillF metric.Float64Gauge
|
WindChillF metric.Float64Gauge
|
||||||
|
|
||||||
|
// Temp and Humidity Sensors
|
||||||
|
SensorTempF metric.Float64Gauge
|
||||||
|
SensorHumidity metric.Int64Gauge
|
||||||
|
|
||||||
// Internal Telemetry
|
// Internal Telemetry
|
||||||
UpdatesReceived metric.Int64Counter
|
UpdatesReceived metric.Int64Counter
|
||||||
appCtx context.Context
|
appCtx context.Context
|
||||||
@ -45,92 +49,8 @@ type WeatherMetrics struct {
|
|||||||
recorder *MetricRecorder
|
recorder *MetricRecorder
|
||||||
}
|
}
|
||||||
|
|
||||||
var MetricPrefix = "weather"
|
|
||||||
|
|
||||||
func MustInitMetrics(appCtx context.Context) *WeatherMetrics {
|
|
||||||
wm := &WeatherMetrics{
|
|
||||||
appCtx: appCtx,
|
|
||||||
cfg: config.MustFromCtx(appCtx),
|
|
||||||
recorder: &MetricRecorder{ctx: appCtx, l: zerolog.Ctx(appCtx)},
|
|
||||||
}
|
|
||||||
|
|
||||||
wm.meter = otel.GetMeter(appCtx, "weather", "metrics")
|
|
||||||
|
|
||||||
// Weather Metrics
|
|
||||||
wm.TempOutdoorF, _ = wm.meter.Float64Gauge(MetricPrefix+"_temp_outdoor_f",
|
|
||||||
metric.WithDescription("Outdoor Temperature in Faherenheit"))
|
|
||||||
wm.TempIndoorF, _ = wm.meter.Float64Gauge(MetricPrefix+"_temp_indoor_f",
|
|
||||||
metric.WithDescription("Indoor Temperature in Faherenheit"))
|
|
||||||
wm.HumidityOudoor, _ = wm.meter.Int64Gauge(MetricPrefix+"_humidity_outdoor",
|
|
||||||
metric.WithDescription("Outdoor Humidity %"))
|
|
||||||
wm.HumidityIndoor, _ = wm.meter.Int64Gauge(MetricPrefix+"_humidity_indoor",
|
|
||||||
metric.WithDescription("Indoor Humidity %"))
|
|
||||||
wm.WindSpeedMPH, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_speed_mph",
|
|
||||||
metric.WithDescription("Wind Speed in MPH"))
|
|
||||||
wm.WindGustMPH, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_gust_mph",
|
|
||||||
metric.WithDescription("Wind Gust in MPH"))
|
|
||||||
wm.MaxDailyGust, _ = wm.meter.Float64Gauge(MetricPrefix+"_max_daily_gust",
|
|
||||||
metric.WithDescription("Max Daily Wind Gust"))
|
|
||||||
wm.WindDir, _ = wm.meter.Int64Gauge(MetricPrefix+"_wind_dir",
|
|
||||||
metric.WithDescription("Wind Direction in Degrees"))
|
|
||||||
wm.WindDirAvg10m, _ = wm.meter.Int64Gauge(MetricPrefix+"_wind_dir_avg_10m",
|
|
||||||
metric.WithDescription("Wind Direction 10m Average"))
|
|
||||||
wm.UV, _ = wm.meter.Int64Gauge(MetricPrefix+"_uv",
|
|
||||||
metric.WithDescription("UV Index"))
|
|
||||||
wm.SolarRadiation, _ = wm.meter.Float64Gauge(MetricPrefix+"_solar_radiation",
|
|
||||||
metric.WithDescription("Solar Radiation in W/㎡"))
|
|
||||||
wm.HourlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_hourly_rain_in",
|
|
||||||
metric.WithDescription("Hourly Rain in Inches"))
|
|
||||||
wm.EventRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_event_rain_in",
|
|
||||||
metric.WithDescription("Event Rain in Inches"))
|
|
||||||
wm.DailyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_daily_rain_in",
|
|
||||||
metric.WithDescription("Daily Rain in Inches"))
|
|
||||||
wm.WeeklyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_weekly_rain_in",
|
|
||||||
metric.WithDescription("Weekly Rain in Inches"))
|
|
||||||
wm.MonthlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_monthly_rain_in",
|
|
||||||
metric.WithDescription("Monthly Rain in Inches"))
|
|
||||||
wm.YearlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_yearly_rain_in",
|
|
||||||
metric.WithDescription("Yearly Rain in Inches"))
|
|
||||||
wm.TotalRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_total_rain_in",
|
|
||||||
metric.WithDescription("Total Rain in Inches"))
|
|
||||||
wm.BatteryStatus, _ = wm.meter.Int64Gauge(MetricPrefix+"_battery_status",
|
|
||||||
metric.WithDescription("Per-component battery status"))
|
|
||||||
wm.BaromRelativeIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_barometric_pressure_relative_in",
|
|
||||||
metric.WithDescription("Relative Pressure in Inches of Mercury"))
|
|
||||||
wm.BaromAbsoluteIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_barometric_pressure_absolute_in",
|
|
||||||
metric.WithDescription("Absolute Pressure in Inches of Mercury"))
|
|
||||||
wm.DewPointF, _ = wm.meter.Float64Gauge(MetricPrefix+"_dew_point_f",
|
|
||||||
metric.WithDescription("Dew Point in Faherenheit"))
|
|
||||||
wm.WindChillF, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_chill_f",
|
|
||||||
metric.WithDescription("Wind Chill in Faherenheit"))
|
|
||||||
|
|
||||||
// Internal Telemetry
|
|
||||||
wm.UpdatesReceived, _ = wm.meter.Int64Counter(MetricPrefix+"_updates_received",
|
|
||||||
metric.WithDescription("Metric Updates Processed by Exporter"))
|
|
||||||
|
|
||||||
return wm
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wm *WeatherMetrics) Update(u *WeatherUpdate) {
|
func (wm *WeatherMetrics) Update(u *WeatherUpdate) {
|
||||||
attributes := []attribute.KeyValue{
|
attributes := wm.GetAttributes(u)
|
||||||
semconv.ServiceVersion(wm.cfg.Version),
|
|
||||||
semconv.ServiceName(wm.cfg.Name),
|
|
||||||
semconv.DeploymentEnvironment(wm.cfg.Environment),
|
|
||||||
}
|
|
||||||
if u.StationType != nil {
|
|
||||||
attributes = append(attributes,
|
|
||||||
attribute.String("station_type", *u.StationType))
|
|
||||||
}
|
|
||||||
if u.StationConfig != nil {
|
|
||||||
if u.StationConfig.Name != "" {
|
|
||||||
attributes = append(attributes,
|
|
||||||
attribute.String("station_name", u.StationConfig.Name))
|
|
||||||
}
|
|
||||||
if u.StationConfig.Equipment != "" {
|
|
||||||
attributes = append(attributes,
|
|
||||||
attribute.String("station_equipment", u.StationConfig.Equipment))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.TempOutdoorF, FloatVal: u.TempOutdoorF, Field: FieldTempOutdoorF, Attributes: attributes, Station: u.StationConfig})
|
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.TempOutdoorF, FloatVal: u.TempOutdoorF, Field: FieldTempOutdoorF, Attributes: attributes, Station: u.StationConfig})
|
||||||
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.TempIndoorF, FloatVal: u.TempIndoorF, Field: FieldTempIndoorF, Attributes: attributes, Station: u.StationConfig})
|
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.TempIndoorF, FloatVal: u.TempIndoorF, Field: FieldTempIndoorF, Attributes: attributes, Station: u.StationConfig})
|
||||||
@ -155,13 +75,73 @@ func (wm *WeatherMetrics) Update(u *WeatherUpdate) {
|
|||||||
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.DewPointF, FloatVal: u.DewPointF, Field: FieldDewPointF, Attributes: attributes, Station: u.StationConfig})
|
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.DewPointF, FloatVal: u.DewPointF, Field: FieldDewPointF, Attributes: attributes, Station: u.StationConfig})
|
||||||
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.WindChillF, FloatVal: u.WindChillF, Field: FieldWindChillF, Attributes: attributes, Station: u.StationConfig})
|
wm.recorder.Record(&RecordOpts{Float64Gauge: wm.WindChillF, FloatVal: u.WindChillF, Field: FieldWindChillF, Attributes: attributes, Station: u.StationConfig})
|
||||||
|
|
||||||
// Batteries
|
wm.RecordBatteries(u, attributes)
|
||||||
for _, battery := range u.Batteries {
|
wm.RecordTempHumiditySensors(u, attributes)
|
||||||
batAttr := attributes
|
|
||||||
batAttr = append(batAttr, attribute.String("component", battery.Component))
|
|
||||||
|
|
||||||
wm.recorder.Record(&RecordOpts{Int64Gauge: wm.BatteryStatus, IntVal: battery.Status, Field: FieldBatteries, Attributes: batAttr, Station: u.StationConfig})
|
|
||||||
}
|
|
||||||
|
|
||||||
wm.UpdatesReceived.Add(wm.appCtx, 1)
|
wm.UpdatesReceived.Add(wm.appCtx, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (wm *WeatherMetrics) RecordBatteries(u *WeatherUpdate, attr []attribute.KeyValue) {
|
||||||
|
for _, battery := range u.Batteries {
|
||||||
|
batAttr := attr
|
||||||
|
batAttr = append(batAttr, attribute.String("component", battery.Component))
|
||||||
|
|
||||||
|
wm.recorder.Record(&RecordOpts{
|
||||||
|
Int64Gauge: wm.BatteryStatus,
|
||||||
|
IntVal: battery.Status,
|
||||||
|
Field: FieldBatteries,
|
||||||
|
Attributes: batAttr,
|
||||||
|
Station: u.StationConfig,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wm *WeatherMetrics) RecordTempHumiditySensors(u *WeatherUpdate, attr []attribute.KeyValue) {
|
||||||
|
if u == nil || u.TempHumiditySensors == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, sensor := range u.TempHumiditySensors {
|
||||||
|
sensorAttr := attr
|
||||||
|
sensorAttr = append(sensorAttr, attribute.String("sensorName", sensor.Name))
|
||||||
|
|
||||||
|
wm.recorder.Record(&RecordOpts{
|
||||||
|
Float64Gauge: wm.SensorTempF,
|
||||||
|
FloatVal: sensor.TempF,
|
||||||
|
Field: FieldSensorTempF,
|
||||||
|
Attributes: sensorAttr,
|
||||||
|
Station: u.StationConfig,
|
||||||
|
})
|
||||||
|
wm.recorder.Record(&RecordOpts{
|
||||||
|
Int64Gauge: wm.SensorHumidity,
|
||||||
|
IntVal: sensor.Humidity,
|
||||||
|
Field: FieldSensorHumidity,
|
||||||
|
Attributes: sensorAttr,
|
||||||
|
Station: u.StationConfig,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wm *WeatherMetrics) GetAttributes(u *WeatherUpdate) []attribute.KeyValue {
|
||||||
|
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,
|
||||||
|
attribute.String("station_type", *u.StationType))
|
||||||
|
}
|
||||||
|
if u.StationConfig != nil {
|
||||||
|
if u.StationConfig.Name != "" {
|
||||||
|
attributes = append(attributes,
|
||||||
|
attribute.String("station_name", u.StationConfig.Name))
|
||||||
|
}
|
||||||
|
if u.StationConfig.Equipment != "" {
|
||||||
|
attributes = append(attributes,
|
||||||
|
attribute.String("station_equipment", u.StationConfig.Equipment))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return attributes
|
||||||
|
}
|
||||||
|
80
pkg/weather/metrics_init.go
Normal file
80
pkg/weather/metrics_init.go
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package weather
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
||||||
|
"github.com/rs/zerolog"
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MustInitMetrics(appCtx context.Context) *WeatherMetrics {
|
||||||
|
wm := &WeatherMetrics{
|
||||||
|
appCtx: appCtx,
|
||||||
|
cfg: config.MustFromCtx(appCtx),
|
||||||
|
recorder: &MetricRecorder{ctx: appCtx, l: zerolog.Ctx(appCtx)},
|
||||||
|
}
|
||||||
|
|
||||||
|
wm.meter = otel.GetMeter(appCtx, "weather", "metrics")
|
||||||
|
|
||||||
|
// Weather Metrics
|
||||||
|
wm.TempOutdoorF, _ = wm.meter.Float64Gauge(MetricPrefix+"_temp_outdoor_f",
|
||||||
|
metric.WithDescription("Outdoor Temperature in Faherenheit"))
|
||||||
|
wm.TempIndoorF, _ = wm.meter.Float64Gauge(MetricPrefix+"_temp_indoor_f",
|
||||||
|
metric.WithDescription("Indoor Temperature in Faherenheit"))
|
||||||
|
wm.HumidityOudoor, _ = wm.meter.Int64Gauge(MetricPrefix+"_humidity_outdoor",
|
||||||
|
metric.WithDescription("Outdoor Humidity %"))
|
||||||
|
wm.HumidityIndoor, _ = wm.meter.Int64Gauge(MetricPrefix+"_humidity_indoor",
|
||||||
|
metric.WithDescription("Indoor Humidity %"))
|
||||||
|
wm.WindSpeedMPH, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_speed_mph",
|
||||||
|
metric.WithDescription("Wind Speed in MPH"))
|
||||||
|
wm.WindGustMPH, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_gust_mph",
|
||||||
|
metric.WithDescription("Wind Gust in MPH"))
|
||||||
|
wm.MaxDailyGust, _ = wm.meter.Float64Gauge(MetricPrefix+"_max_daily_gust",
|
||||||
|
metric.WithDescription("Max Daily Wind Gust"))
|
||||||
|
wm.WindDir, _ = wm.meter.Int64Gauge(MetricPrefix+"_wind_dir",
|
||||||
|
metric.WithDescription("Wind Direction in Degrees"))
|
||||||
|
wm.WindDirAvg10m, _ = wm.meter.Int64Gauge(MetricPrefix+"_wind_dir_avg_10m",
|
||||||
|
metric.WithDescription("Wind Direction 10m Average"))
|
||||||
|
wm.UV, _ = wm.meter.Int64Gauge(MetricPrefix+"_uv",
|
||||||
|
metric.WithDescription("UV Index"))
|
||||||
|
wm.SolarRadiation, _ = wm.meter.Float64Gauge(MetricPrefix+"_solar_radiation",
|
||||||
|
metric.WithDescription("Solar Radiation in W/㎡"))
|
||||||
|
wm.HourlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_hourly_rain_in",
|
||||||
|
metric.WithDescription("Hourly Rain in Inches"))
|
||||||
|
wm.EventRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_event_rain_in",
|
||||||
|
metric.WithDescription("Event Rain in Inches"))
|
||||||
|
wm.DailyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_daily_rain_in",
|
||||||
|
metric.WithDescription("Daily Rain in Inches"))
|
||||||
|
wm.WeeklyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_weekly_rain_in",
|
||||||
|
metric.WithDescription("Weekly Rain in Inches"))
|
||||||
|
wm.MonthlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_monthly_rain_in",
|
||||||
|
metric.WithDescription("Monthly Rain in Inches"))
|
||||||
|
wm.YearlyRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_yearly_rain_in",
|
||||||
|
metric.WithDescription("Yearly Rain in Inches"))
|
||||||
|
wm.TotalRainIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_total_rain_in",
|
||||||
|
metric.WithDescription("Total Rain in Inches"))
|
||||||
|
wm.BatteryStatus, _ = wm.meter.Int64Gauge(MetricPrefix+"_battery_status",
|
||||||
|
metric.WithDescription("Per-component battery status"))
|
||||||
|
wm.BaromRelativeIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_barometric_pressure_relative_in",
|
||||||
|
metric.WithDescription("Relative Pressure in Inches of Mercury"))
|
||||||
|
wm.BaromAbsoluteIn, _ = wm.meter.Float64Gauge(MetricPrefix+"_barometric_pressure_absolute_in",
|
||||||
|
metric.WithDescription("Absolute Pressure in Inches of Mercury"))
|
||||||
|
wm.DewPointF, _ = wm.meter.Float64Gauge(MetricPrefix+"_dew_point_f",
|
||||||
|
metric.WithDescription("Dew Point in Faherenheit"))
|
||||||
|
wm.WindChillF, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_chill_f",
|
||||||
|
metric.WithDescription("Wind Chill in Faherenheit"))
|
||||||
|
|
||||||
|
// Temp and Humidity Sensors
|
||||||
|
wm.SensorTempF, _ = wm.meter.Float64Gauge(MetricPrefix+"_sensor_temp_f",
|
||||||
|
metric.WithDescription("Temperature Sensor in Faherenheit"))
|
||||||
|
wm.SensorHumidity, _ = wm.meter.Int64Gauge(MetricPrefix+"_sensor_humidity",
|
||||||
|
metric.WithDescription("Humidity % Sensor"))
|
||||||
|
|
||||||
|
// Internal Telemetry
|
||||||
|
wm.UpdatesReceived, _ = wm.meter.Int64Counter(MetricPrefix+"_updates_received",
|
||||||
|
metric.WithDescription("Metric Updates Processed by Exporter"))
|
||||||
|
|
||||||
|
return wm
|
||||||
|
}
|
@ -38,8 +38,14 @@ type WeatherUpdate struct {
|
|||||||
// if not otherwise set
|
// if not otherwise set
|
||||||
DewPointF *float64
|
DewPointF *float64
|
||||||
WindChillF *float64
|
WindChillF *float64
|
||||||
// First URL parameters given to AWN/Wunderground
|
// Extra Temp+Humidity Sensors
|
||||||
// if proxying is enabled
|
TempHumiditySensors []*TempHumiditySensor
|
||||||
|
}
|
||||||
|
|
||||||
|
type TempHumiditySensor struct {
|
||||||
|
Name string
|
||||||
|
TempF *float64
|
||||||
|
Humidity *int
|
||||||
}
|
}
|
||||||
|
|
||||||
type BatteryStatus struct {
|
type BatteryStatus struct {
|
||||||
@ -76,6 +82,8 @@ const (
|
|||||||
FieldBaromAbsoluteIn = "BaromAbsoluteIn"
|
FieldBaromAbsoluteIn = "BaromAbsoluteIn"
|
||||||
FieldDewPointF = "DewPointF"
|
FieldDewPointF = "DewPointF"
|
||||||
FieldWindChillF = "WindChillF"
|
FieldWindChillF = "WindChillF"
|
||||||
|
FieldSensorTempF = "SensorTempF"
|
||||||
|
FieldSensorHumidity = "SensorHumidity"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (u *WeatherUpdate) GetStationName() string {
|
func (u *WeatherUpdate) GetStationName() string {
|
||||||
|
Reference in New Issue
Block a user