Compare commits
No commits in common. "main" and "v0.10.0" have entirely different histories.
@ -2,7 +2,6 @@ name: Build and Publish
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ["v*"]
|
tags: ["v*"]
|
||||||
branches: ["main"]
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PACKAGE_NAME: ambient-local-exporter
|
PACKAGE_NAME: ambient-local-exporter
|
||||||
@ -22,10 +21,9 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/v') # Only run on tag push
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go Environment
|
- name: Set up Go Environment
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
@ -89,29 +87,12 @@ jobs:
|
|||||||
VER_PKG=${{ env.VER_PKG }}
|
VER_PKG=${{ env.VER_PKG }}
|
||||||
VERSION=${{ github.ref_name }}
|
VERSION=${{ github.ref_name }}
|
||||||
|
|
||||||
# Detect if the helm chart was updated
|
|
||||||
check-chart:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
chart-updated: ${{ steps.filter.outputs.chart }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Check Chart Changed
|
|
||||||
uses: dorny/paths-filter@v3
|
|
||||||
id: filter
|
|
||||||
with:
|
|
||||||
base: ${{ github.ref }}
|
|
||||||
filters: |
|
|
||||||
chart:
|
|
||||||
- helm/ambient-local-exporter/Chart.yaml
|
|
||||||
|
|
||||||
helm-release:
|
helm-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-chart
|
needs: release
|
||||||
if: ${{ needs.check-chart.outputs.chart-updated == 'true' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Helm
|
- name: Install Helm
|
||||||
env:
|
env:
|
||||||
@ -121,7 +102,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Package Chart
|
- name: Package Chart
|
||||||
run: |
|
run: |
|
||||||
helm package --app-version ${VERSION} ${CHART_DIR}
|
helm package --app-version ${VERSION#v} ${CHART_DIR}
|
||||||
|
|
||||||
- name: Publish Chart
|
- name: Publish Chart
|
||||||
env:
|
env:
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "proto/googleapis"]
|
|
||||||
path = proto/googleapis
|
|
||||||
url = https://github.com/googleapis/googleapis.git
|
|
7
Makefile
7
Makefile
@ -14,11 +14,9 @@ DOCKER_IMG := gitea.libretechconsulting.com/rmcguire/ambient-local-exporter
|
|||||||
all: proto test build docker
|
all: proto test build docker
|
||||||
|
|
||||||
proto: check_protoc $(API_DIR)
|
proto: check_protoc $(API_DIR)
|
||||||
protoc --proto_path=proto --proto_path=proto/googleapis \
|
protoc --proto_path=proto \
|
||||||
--go_out=$(API_DIR) --go_opt=paths=source_relative \
|
--go_out=$(API_DIR) --go_opt=paths=source_relative \
|
||||||
--go-grpc_out=$(API_DIR) --go-grpc_opt=paths=source_relative \
|
--go-grpc_out=$(API_DIR) --go-grpc_opt=paths=source_relative \
|
||||||
--grpc-gateway_out=$(API_DIR) --grpc-gateway_opt=paths=source_relative \
|
|
||||||
--openapiv2_out=$(API_DIR) \
|
|
||||||
$(foreach dir, $(PROTO_DIRS), $(wildcard $(dir)/*.proto))
|
$(foreach dir, $(PROTO_DIRS), $(wildcard $(dir)/*.proto))
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@ -35,9 +33,6 @@ build: test
|
|||||||
done
|
done
|
||||||
go build -ldflags "-X $(VER_PKG)=$(VERSION)" -o bin/${CMD_NAME}
|
go build -ldflags "-X $(VER_PKG)=$(VERSION)" -o bin/${CMD_NAME}
|
||||||
|
|
||||||
schema:
|
|
||||||
go run . -schema > contrib/schema.json
|
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
@echo "Building Docker image $(DOCKER_IMG):$(VERSION)"
|
@echo "Building Docker image $(DOCKER_IMG):$(VERSION)"
|
||||||
docker build \
|
docker build \
|
||||||
|
13
TODO.md
13
TODO.md
@ -1,19 +1,10 @@
|
|||||||
# Issues
|
|
||||||
- [x] Redis recorder panic
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
- [ ] Make lightning distance unit configurable (kph|mph)
|
- [ ] Finish implementing weather GRPC
|
||||||
- [ ] Set TTL on redis key
|
|
||||||
- [ ] Add json schema to CI and README
|
|
||||||
- [ ] Update README
|
- [ ] Update README
|
||||||
- [ ] Add Grafana dashboard
|
- [ ] Add Grafana dashboard
|
||||||
|
- [ ] Add new spans
|
||||||
|
|
||||||
## Done
|
## Done
|
||||||
- [x] Make recorder.Set concurrent
|
|
||||||
- [x] Stop Marshaling sensors / batteries with no data
|
|
||||||
- [x] Finish implementing weather GRPC
|
|
||||||
- [x] Add json schema for config
|
|
||||||
- [x] Add new spans
|
|
||||||
- [x] Helm Chart
|
- [x] Helm Chart
|
||||||
- [x] Add proxy to upstream support
|
- [x] Add proxy to upstream support
|
||||||
- [x] Fix wunderground 401
|
- [x] Fix wunderground 401
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.6
|
// protoc-gen-go v1.36.5
|
||||||
// protoc v5.29.3
|
// protoc v5.29.3
|
||||||
// source: weather/weather.proto
|
// source: weather/weather.proto
|
||||||
|
|
||||||
@ -22,94 +22,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
type CountWeatherUpdatesRequest struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Opts *GetWeatherOpts `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesRequest) Reset() {
|
|
||||||
*x = CountWeatherUpdatesRequest{}
|
|
||||||
mi := &file_weather_weather_proto_msgTypes[0]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesRequest) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*CountWeatherUpdatesRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesRequest) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_weather_weather_proto_msgTypes[0]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use CountWeatherUpdatesRequest.ProtoReflect.Descriptor instead.
|
|
||||||
func (*CountWeatherUpdatesRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{0}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesRequest) GetOpts() *GetWeatherOpts {
|
|
||||||
if x != nil {
|
|
||||||
return x.Opts
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type CountWeatherUpdatesResponse struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesResponse) Reset() {
|
|
||||||
*x = CountWeatherUpdatesResponse{}
|
|
||||||
mi := &file_weather_weather_proto_msgTypes[1]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesResponse) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*CountWeatherUpdatesResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesResponse) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_weather_weather_proto_msgTypes[1]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use CountWeatherUpdatesResponse.ProtoReflect.Descriptor instead.
|
|
||||||
func (*CountWeatherUpdatesResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CountWeatherUpdatesResponse) GetCount() int32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.Count
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetWeatherRequest struct {
|
type GetWeatherRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Opts *GetWeatherOpts `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"`
|
Opts *GetWeatherOpts `protobuf:"bytes,1,opt,name=opts,proto3" json:"opts,omitempty"`
|
||||||
@ -120,7 +32,7 @@ type GetWeatherRequest struct {
|
|||||||
|
|
||||||
func (x *GetWeatherRequest) Reset() {
|
func (x *GetWeatherRequest) Reset() {
|
||||||
*x = GetWeatherRequest{}
|
*x = GetWeatherRequest{}
|
||||||
mi := &file_weather_weather_proto_msgTypes[2]
|
mi := &file_weather_weather_proto_msgTypes[0]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -132,7 +44,7 @@ func (x *GetWeatherRequest) String() string {
|
|||||||
func (*GetWeatherRequest) ProtoMessage() {}
|
func (*GetWeatherRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetWeatherRequest) ProtoReflect() protoreflect.Message {
|
func (x *GetWeatherRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_weather_weather_proto_msgTypes[2]
|
mi := &file_weather_weather_proto_msgTypes[0]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -145,7 +57,7 @@ func (x *GetWeatherRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetWeatherRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetWeatherRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*GetWeatherRequest) Descriptor() ([]byte, []int) {
|
func (*GetWeatherRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{2}
|
return file_weather_weather_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetWeatherRequest) GetOpts() *GetWeatherOpts {
|
func (x *GetWeatherRequest) GetOpts() *GetWeatherOpts {
|
||||||
@ -172,7 +84,7 @@ type GetWeatherResponse struct {
|
|||||||
|
|
||||||
func (x *GetWeatherResponse) Reset() {
|
func (x *GetWeatherResponse) Reset() {
|
||||||
*x = GetWeatherResponse{}
|
*x = GetWeatherResponse{}
|
||||||
mi := &file_weather_weather_proto_msgTypes[3]
|
mi := &file_weather_weather_proto_msgTypes[1]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -184,7 +96,7 @@ func (x *GetWeatherResponse) String() string {
|
|||||||
func (*GetWeatherResponse) ProtoMessage() {}
|
func (*GetWeatherResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetWeatherResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetWeatherResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_weather_weather_proto_msgTypes[3]
|
mi := &file_weather_weather_proto_msgTypes[1]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -197,7 +109,7 @@ func (x *GetWeatherResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetWeatherResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetWeatherResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetWeatherResponse) Descriptor() ([]byte, []int) {
|
func (*GetWeatherResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{3}
|
return file_weather_weather_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetWeatherResponse) GetLastUpdated() *timestamppb.Timestamp {
|
func (x *GetWeatherResponse) GetLastUpdated() *timestamppb.Timestamp {
|
||||||
@ -224,7 +136,7 @@ type GetWeatherOpts struct {
|
|||||||
|
|
||||||
func (x *GetWeatherOpts) Reset() {
|
func (x *GetWeatherOpts) Reset() {
|
||||||
*x = GetWeatherOpts{}
|
*x = GetWeatherOpts{}
|
||||||
mi := &file_weather_weather_proto_msgTypes[4]
|
mi := &file_weather_weather_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -236,7 +148,7 @@ func (x *GetWeatherOpts) String() string {
|
|||||||
func (*GetWeatherOpts) ProtoMessage() {}
|
func (*GetWeatherOpts) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetWeatherOpts) ProtoReflect() protoreflect.Message {
|
func (x *GetWeatherOpts) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_weather_weather_proto_msgTypes[4]
|
mi := &file_weather_weather_proto_msgTypes[2]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -249,7 +161,7 @@ func (x *GetWeatherOpts) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetWeatherOpts.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetWeatherOpts.ProtoReflect.Descriptor instead.
|
||||||
func (*GetWeatherOpts) Descriptor() ([]byte, []int) {
|
func (*GetWeatherOpts) Descriptor() ([]byte, []int) {
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{4}
|
return file_weather_weather_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetWeatherOpts) GetStationName() string {
|
func (x *GetWeatherOpts) GetStationName() string {
|
||||||
@ -295,17 +207,13 @@ type WeatherUpdate struct {
|
|||||||
DewPointF *float64 `protobuf:"fixed64,25,opt,name=dew_point_f,json=dewPointF,proto3,oneof" json:"dew_point_f,omitempty"`
|
DewPointF *float64 `protobuf:"fixed64,25,opt,name=dew_point_f,json=dewPointF,proto3,oneof" json:"dew_point_f,omitempty"`
|
||||||
WindChillF *float64 `protobuf:"fixed64,26,opt,name=wind_chill_f,json=windChillF,proto3,oneof" json:"wind_chill_f,omitempty"`
|
WindChillF *float64 `protobuf:"fixed64,26,opt,name=wind_chill_f,json=windChillF,proto3,oneof" json:"wind_chill_f,omitempty"`
|
||||||
TempHumiditySensors []*TempHumiditySensor `protobuf:"bytes,27,rep,name=temp_humidity_sensors,json=tempHumiditySensors,proto3" json:"temp_humidity_sensors,omitempty"`
|
TempHumiditySensors []*TempHumiditySensor `protobuf:"bytes,27,rep,name=temp_humidity_sensors,json=tempHumiditySensors,proto3" json:"temp_humidity_sensors,omitempty"`
|
||||||
UpdateTimestamp *timestamppb.Timestamp `protobuf:"bytes,28,opt,name=update_timestamp,json=updateTimestamp,proto3" json:"update_timestamp,omitempty"`
|
|
||||||
LightningDay *int32 `protobuf:"varint,29,opt,name=lightning_day,json=lightningDay,proto3,oneof" json:"lightning_day,omitempty"`
|
|
||||||
LightningDistance *int32 `protobuf:"varint,30,opt,name=lightning_distance,json=lightningDistance,proto3,oneof" json:"lightning_distance,omitempty"`
|
|
||||||
LightningLastTime *timestamppb.Timestamp `protobuf:"bytes,31,opt,name=lightning_last_time,json=lightningLastTime,proto3,oneof" json:"lightning_last_time,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WeatherUpdate) Reset() {
|
func (x *WeatherUpdate) Reset() {
|
||||||
*x = WeatherUpdate{}
|
*x = WeatherUpdate{}
|
||||||
mi := &file_weather_weather_proto_msgTypes[5]
|
mi := &file_weather_weather_proto_msgTypes[3]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -317,7 +225,7 @@ func (x *WeatherUpdate) String() string {
|
|||||||
func (*WeatherUpdate) ProtoMessage() {}
|
func (*WeatherUpdate) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *WeatherUpdate) ProtoReflect() protoreflect.Message {
|
func (x *WeatherUpdate) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_weather_weather_proto_msgTypes[5]
|
mi := &file_weather_weather_proto_msgTypes[3]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -330,7 +238,7 @@ func (x *WeatherUpdate) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use WeatherUpdate.ProtoReflect.Descriptor instead.
|
// Deprecated: Use WeatherUpdate.ProtoReflect.Descriptor instead.
|
||||||
func (*WeatherUpdate) Descriptor() ([]byte, []int) {
|
func (*WeatherUpdate) Descriptor() ([]byte, []int) {
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{5}
|
return file_weather_weather_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WeatherUpdate) GetStationName() string {
|
func (x *WeatherUpdate) GetStationName() string {
|
||||||
@ -522,34 +430,6 @@ func (x *WeatherUpdate) GetTempHumiditySensors() []*TempHumiditySensor {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WeatherUpdate) GetUpdateTimestamp() *timestamppb.Timestamp {
|
|
||||||
if x != nil {
|
|
||||||
return x.UpdateTimestamp
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *WeatherUpdate) GetLightningDay() int32 {
|
|
||||||
if x != nil && x.LightningDay != nil {
|
|
||||||
return *x.LightningDay
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *WeatherUpdate) GetLightningDistance() int32 {
|
|
||||||
if x != nil && x.LightningDistance != nil {
|
|
||||||
return *x.LightningDistance
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *WeatherUpdate) GetLightningLastTime() *timestamppb.Timestamp {
|
|
||||||
if x != nil {
|
|
||||||
return x.LightningLastTime
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Represents a temperature and humidity sensor
|
// Represents a temperature and humidity sensor
|
||||||
type TempHumiditySensor struct {
|
type TempHumiditySensor struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
@ -562,7 +442,7 @@ type TempHumiditySensor struct {
|
|||||||
|
|
||||||
func (x *TempHumiditySensor) Reset() {
|
func (x *TempHumiditySensor) Reset() {
|
||||||
*x = TempHumiditySensor{}
|
*x = TempHumiditySensor{}
|
||||||
mi := &file_weather_weather_proto_msgTypes[6]
|
mi := &file_weather_weather_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -574,7 +454,7 @@ func (x *TempHumiditySensor) String() string {
|
|||||||
func (*TempHumiditySensor) ProtoMessage() {}
|
func (*TempHumiditySensor) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *TempHumiditySensor) ProtoReflect() protoreflect.Message {
|
func (x *TempHumiditySensor) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_weather_weather_proto_msgTypes[6]
|
mi := &file_weather_weather_proto_msgTypes[4]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -587,7 +467,7 @@ func (x *TempHumiditySensor) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use TempHumiditySensor.ProtoReflect.Descriptor instead.
|
// Deprecated: Use TempHumiditySensor.ProtoReflect.Descriptor instead.
|
||||||
func (*TempHumiditySensor) Descriptor() ([]byte, []int) {
|
func (*TempHumiditySensor) Descriptor() ([]byte, []int) {
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{6}
|
return file_weather_weather_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TempHumiditySensor) GetName() string {
|
func (x *TempHumiditySensor) GetName() string {
|
||||||
@ -622,7 +502,7 @@ type BatteryStatus struct {
|
|||||||
|
|
||||||
func (x *BatteryStatus) Reset() {
|
func (x *BatteryStatus) Reset() {
|
||||||
*x = BatteryStatus{}
|
*x = BatteryStatus{}
|
||||||
mi := &file_weather_weather_proto_msgTypes[7]
|
mi := &file_weather_weather_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -634,7 +514,7 @@ func (x *BatteryStatus) String() string {
|
|||||||
func (*BatteryStatus) ProtoMessage() {}
|
func (*BatteryStatus) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *BatteryStatus) ProtoReflect() protoreflect.Message {
|
func (x *BatteryStatus) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_weather_weather_proto_msgTypes[7]
|
mi := &file_weather_weather_proto_msgTypes[5]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -647,7 +527,7 @@ func (x *BatteryStatus) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use BatteryStatus.ProtoReflect.Descriptor instead.
|
// Deprecated: Use BatteryStatus.ProtoReflect.Descriptor instead.
|
||||||
func (*BatteryStatus) Descriptor() ([]byte, []int) {
|
func (*BatteryStatus) Descriptor() ([]byte, []int) {
|
||||||
return file_weather_weather_proto_rawDescGZIP(), []int{7}
|
return file_weather_weather_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BatteryStatus) GetComponent() string {
|
func (x *BatteryStatus) GetComponent() string {
|
||||||
@ -666,96 +546,157 @@ func (x *BatteryStatus) GetStatus() int32 {
|
|||||||
|
|
||||||
var File_weather_weather_proto protoreflect.FileDescriptor
|
var File_weather_weather_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
const file_weather_weather_proto_rawDesc = "" +
|
var file_weather_weather_proto_rawDesc = string([]byte{
|
||||||
"\n" +
|
0x0a, 0x15, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2f, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65,
|
||||||
"\x15weather/weather.proto\x12\x0fambient.weather\x1a\x1fgoogle/protobuf/timestamp.proto\"Q\n" +
|
0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74,
|
||||||
"\x1aCountWeatherUpdatesRequest\x123\n" +
|
0x2e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||||
"\x04opts\x18\x01 \x01(\v2\x1f.ambient.weather.GetWeatherOptsR\x04opts\"3\n" +
|
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||||
"\x1bCountWeatherUpdatesResponse\x12\x14\n" +
|
0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x11, 0x47, 0x65, 0x74,
|
||||||
"\x05count\x18\x01 \x01(\x05R\x05count\"m\n" +
|
0x57, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x33,
|
||||||
"\x11GetWeatherRequest\x123\n" +
|
0x0a, 0x04, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61,
|
||||||
"\x04opts\x18\x01 \x01(\v2\x1f.ambient.weather.GetWeatherOptsR\x04opts\x12\x19\n" +
|
0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2e, 0x47,
|
||||||
"\x05limit\x18\x02 \x01(\x05H\x00R\x05limit\x88\x01\x01B\b\n" +
|
0x65, 0x74, 0x57, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x04, 0x6f,
|
||||||
"\x06_limit\"\x9c\x01\n" +
|
0x70, 0x74, 0x73, 0x12, 0x19, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01,
|
||||||
"\x12GetWeatherResponse\x12=\n" +
|
0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08,
|
||||||
"\flast_updated\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\vlastUpdated\x12G\n" +
|
0x0a, 0x06, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x9c, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74,
|
||||||
"\x0fweather_updates\x18\x02 \x03(\v2\x1e.ambient.weather.WeatherUpdateR\x0eweatherUpdates\"\x82\x01\n" +
|
0x57, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||||
"\x0eGetWeatherOpts\x12&\n" +
|
0x3d, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18,
|
||||||
"\fstation_name\x18\x01 \x01(\tH\x00R\vstationName\x88\x01\x01\x12&\n" +
|
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||||
"\fstation_type\x18\x02 \x01(\tH\x01R\vstationType\x88\x01\x01B\x0f\n" +
|
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||||
"\r_station_nameB\x0f\n" +
|
0x70, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x47,
|
||||||
"\r_station_type\"\xee\x0e\n" +
|
0x0a, 0x0f, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||||
"\rWeatherUpdate\x12!\n" +
|
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e,
|
||||||
"\fstation_name\x18\x01 \x01(\tR\vstationName\x12!\n" +
|
0x74, 0x2e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2e, 0x57, 0x65, 0x61, 0x74, 0x68, 0x65,
|
||||||
"\fstation_type\x18\x02 \x01(\tR\vstationType\x12\x1d\n" +
|
0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72,
|
||||||
"\n" +
|
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x57,
|
||||||
"station_id\x18\x03 \x01(\tR\tstationId\x12)\n" +
|
0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0c, 0x73, 0x74,
|
||||||
"\x0etemp_outdoor_f\x18\x04 \x01(\x01H\x00R\ftempOutdoorF\x88\x01\x01\x12'\n" +
|
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
"\rtemp_indoor_f\x18\x05 \x01(\x01H\x01R\vtempIndoorF\x88\x01\x01\x12.\n" +
|
0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x88,
|
||||||
"\x10humidity_outdoor\x18\x06 \x01(\x05H\x02R\x0fhumidityOutdoor\x88\x01\x01\x12,\n" +
|
0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79,
|
||||||
"\x0fhumidity_indoor\x18\a \x01(\x05H\x03R\x0ehumidityIndoor\x88\x01\x01\x12)\n" +
|
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74,
|
||||||
"\x0ewind_speed_mph\x18\b \x01(\x01H\x04R\fwindSpeedMph\x88\x01\x01\x12'\n" +
|
0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x73,
|
||||||
"\rwind_gust_mph\x18\t \x01(\x01H\x05R\vwindGustMph\x88\x01\x01\x12)\n" +
|
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0f, 0x0a, 0x0d, 0x5f,
|
||||||
"\x0emax_daily_gust\x18\n" +
|
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0xb7, 0x0c, 0x0a,
|
||||||
" \x01(\x01H\x06R\fmaxDailyGust\x88\x01\x01\x12\x1e\n" +
|
0x0d, 0x57, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x21,
|
||||||
"\bwind_dir\x18\v \x01(\x05H\aR\awindDir\x88\x01\x01\x12,\n" +
|
0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
|
||||||
"\x10wind_dir_avg_10m\x18\f \x01(\x05H\bR\rwindDirAvg10m\x88\x01\x01\x12\x13\n" +
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d,
|
||||||
"\x02uv\x18\r \x01(\x05H\tR\x02uv\x88\x01\x01\x12,\n" +
|
0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70,
|
||||||
"\x0fsolar_radiation\x18\x0e \x01(\x01H\n" +
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
"R\x0esolarRadiation\x88\x01\x01\x12)\n" +
|
0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
||||||
"\x0ehourly_rain_in\x18\x0f \x01(\x01H\vR\fhourlyRainIn\x88\x01\x01\x12'\n" +
|
0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f,
|
||||||
"\revent_rain_in\x18\x10 \x01(\x01H\fR\veventRainIn\x88\x01\x01\x12'\n" +
|
0x6e, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x0e, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x6f, 0x75, 0x74, 0x64,
|
||||||
"\rdaily_rain_in\x18\x11 \x01(\x01H\rR\vdailyRainIn\x88\x01\x01\x12)\n" +
|
0x6f, 0x6f, 0x72, 0x5f, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x0c, 0x74,
|
||||||
"\x0eweekly_rain_in\x18\x12 \x01(\x01H\x0eR\fweeklyRainIn\x88\x01\x01\x12+\n" +
|
0x65, 0x6d, 0x70, 0x4f, 0x75, 0x74, 0x64, 0x6f, 0x6f, 0x72, 0x46, 0x88, 0x01, 0x01, 0x12, 0x27,
|
||||||
"\x0fmonthly_rain_in\x18\x13 \x01(\x01H\x0fR\rmonthlyRainIn\x88\x01\x01\x12)\n" +
|
0x0a, 0x0d, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x69, 0x6e, 0x64, 0x6f, 0x6f, 0x72, 0x5f, 0x66, 0x18,
|
||||||
"\x0eyearly_rain_in\x18\x14 \x01(\x01H\x10R\fyearlyRainIn\x88\x01\x01\x12'\n" +
|
0x05, 0x20, 0x01, 0x28, 0x01, 0x48, 0x01, 0x52, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x49, 0x6e, 0x64,
|
||||||
"\rtotal_rain_in\x18\x15 \x01(\x01H\x11R\vtotalRainIn\x88\x01\x01\x12<\n" +
|
0x6f, 0x6f, 0x72, 0x46, 0x88, 0x01, 0x01, 0x12, 0x2e, 0x0a, 0x10, 0x68, 0x75, 0x6d, 0x69, 0x64,
|
||||||
"\tbatteries\x18\x16 \x03(\v2\x1e.ambient.weather.BatteryStatusR\tbatteries\x12/\n" +
|
0x69, 0x74, 0x79, 0x5f, 0x6f, 0x75, 0x74, 0x64, 0x6f, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||||
"\x11barom_relative_in\x18\x17 \x01(\x01H\x12R\x0fbaromRelativeIn\x88\x01\x01\x12/\n" +
|
0x05, 0x48, 0x02, 0x52, 0x0f, 0x68, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x4f, 0x75, 0x74,
|
||||||
"\x11barom_absolute_in\x18\x18 \x01(\x01H\x13R\x0fbaromAbsoluteIn\x88\x01\x01\x12#\n" +
|
0x64, 0x6f, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x0f, 0x68, 0x75, 0x6d, 0x69, 0x64,
|
||||||
"\vdew_point_f\x18\x19 \x01(\x01H\x14R\tdewPointF\x88\x01\x01\x12%\n" +
|
0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x6f, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
|
||||||
"\fwind_chill_f\x18\x1a \x01(\x01H\x15R\n" +
|
0x48, 0x03, 0x52, 0x0e, 0x68, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x64, 0x6f,
|
||||||
"windChillF\x88\x01\x01\x12W\n" +
|
0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0e, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x73, 0x70,
|
||||||
"\x15temp_humidity_sensors\x18\x1b \x03(\v2#.ambient.weather.TempHumiditySensorR\x13tempHumiditySensors\x12E\n" +
|
0x65, 0x65, 0x64, 0x5f, 0x6d, 0x70, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x48, 0x04, 0x52,
|
||||||
"\x10update_timestamp\x18\x1c \x01(\v2\x1a.google.protobuf.TimestampR\x0fupdateTimestamp\x12(\n" +
|
0x0c, 0x77, 0x69, 0x6e, 0x64, 0x53, 0x70, 0x65, 0x65, 0x64, 0x4d, 0x70, 0x68, 0x88, 0x01, 0x01,
|
||||||
"\rlightning_day\x18\x1d \x01(\x05H\x16R\flightningDay\x88\x01\x01\x122\n" +
|
0x12, 0x27, 0x0a, 0x0d, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x67, 0x75, 0x73, 0x74, 0x5f, 0x6d, 0x70,
|
||||||
"\x12lightning_distance\x18\x1e \x01(\x05H\x17R\x11lightningDistance\x88\x01\x01\x12O\n" +
|
0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x48, 0x05, 0x52, 0x0b, 0x77, 0x69, 0x6e, 0x64, 0x47,
|
||||||
"\x13lightning_last_time\x18\x1f \x01(\v2\x1a.google.protobuf.TimestampH\x18R\x11lightningLastTime\x88\x01\x01B\x11\n" +
|
0x75, 0x73, 0x74, 0x4d, 0x70, 0x68, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0e, 0x6d, 0x61, 0x78,
|
||||||
"\x0f_temp_outdoor_fB\x10\n" +
|
0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x67, 0x75, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28,
|
||||||
"\x0e_temp_indoor_fB\x13\n" +
|
0x01, 0x48, 0x06, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x47, 0x75, 0x73,
|
||||||
"\x11_humidity_outdoorB\x12\n" +
|
0x74, 0x88, 0x01, 0x01, 0x12, 0x1e, 0x0a, 0x08, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x64, 0x69, 0x72,
|
||||||
"\x10_humidity_indoorB\x11\n" +
|
0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x48, 0x07, 0x52, 0x07, 0x77, 0x69, 0x6e, 0x64, 0x44, 0x69,
|
||||||
"\x0f_wind_speed_mphB\x10\n" +
|
0x72, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x10, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x64, 0x69, 0x72,
|
||||||
"\x0e_wind_gust_mphB\x11\n" +
|
0x5f, 0x61, 0x76, 0x67, 0x5f, 0x31, 0x30, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x48, 0x08,
|
||||||
"\x0f_max_daily_gustB\v\n" +
|
0x52, 0x0d, 0x77, 0x69, 0x6e, 0x64, 0x44, 0x69, 0x72, 0x41, 0x76, 0x67, 0x31, 0x30, 0x6d, 0x88,
|
||||||
"\t_wind_dirB\x13\n" +
|
0x01, 0x01, 0x12, 0x13, 0x0a, 0x02, 0x75, 0x76, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x48, 0x09,
|
||||||
"\x11_wind_dir_avg_10mB\x05\n" +
|
0x52, 0x02, 0x75, 0x76, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x0f, 0x73, 0x6f, 0x6c, 0x61, 0x72,
|
||||||
"\x03_uvB\x12\n" +
|
0x5f, 0x72, 0x61, 0x64, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x01,
|
||||||
"\x10_solar_radiationB\x11\n" +
|
0x48, 0x0a, 0x52, 0x0e, 0x73, 0x6f, 0x6c, 0x61, 0x72, 0x52, 0x61, 0x64, 0x69, 0x61, 0x74, 0x69,
|
||||||
"\x0f_hourly_rain_inB\x10\n" +
|
0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0e, 0x68, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x5f,
|
||||||
"\x0e_event_rain_inB\x10\n" +
|
0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x01, 0x48, 0x0b, 0x52,
|
||||||
"\x0e_daily_rain_inB\x11\n" +
|
0x0c, 0x68, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x52, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x88, 0x01, 0x01,
|
||||||
"\x0f_weekly_rain_inB\x12\n" +
|
0x12, 0x27, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69,
|
||||||
"\x10_monthly_rain_inB\x11\n" +
|
0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x01, 0x48, 0x0c, 0x52, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74,
|
||||||
"\x0f_yearly_rain_inB\x10\n" +
|
0x52, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0d, 0x64, 0x61, 0x69,
|
||||||
"\x0e_total_rain_inB\x14\n" +
|
0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x01,
|
||||||
"\x12_barom_relative_inB\x14\n" +
|
0x48, 0x0d, 0x52, 0x0b, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x52, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x88,
|
||||||
"\x12_barom_absolute_inB\x0e\n" +
|
0x01, 0x01, 0x12, 0x29, 0x0a, 0x0e, 0x77, 0x65, 0x65, 0x6b, 0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69,
|
||||||
"\f_dew_point_fB\x0f\n" +
|
0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x12, 0x20, 0x01, 0x28, 0x01, 0x48, 0x0e, 0x52, 0x0c, 0x77, 0x65,
|
||||||
"\r_wind_chill_fB\x10\n" +
|
0x65, 0x6b, 0x6c, 0x79, 0x52, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x2b, 0x0a,
|
||||||
"\x0e_lightning_dayB\x15\n" +
|
0x0f, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e,
|
||||||
"\x13_lightning_distanceB\x16\n" +
|
0x18, 0x13, 0x20, 0x01, 0x28, 0x01, 0x48, 0x0f, 0x52, 0x0d, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c,
|
||||||
"\x14_lightning_last_time\"}\n" +
|
0x79, 0x52, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0e, 0x79, 0x65,
|
||||||
"\x12TempHumiditySensor\x12\x12\n" +
|
0x61, 0x72, 0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x14, 0x20, 0x01,
|
||||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" +
|
0x28, 0x01, 0x48, 0x10, 0x52, 0x0c, 0x79, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x52, 0x61, 0x69, 0x6e,
|
||||||
"\x06temp_f\x18\x02 \x01(\x01H\x00R\x05tempF\x88\x01\x01\x12\x1f\n" +
|
0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x72,
|
||||||
"\bhumidity\x18\x03 \x01(\x05H\x01R\bhumidity\x88\x01\x01B\t\n" +
|
0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01, 0x48, 0x11, 0x52, 0x0b,
|
||||||
"\a_temp_fB\v\n" +
|
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x3c,
|
||||||
"\t_humidity\"U\n" +
|
0x0a, 0x09, 0x62, 0x61, 0x74, 0x74, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28,
|
||||||
"\rBatteryStatus\x12\x1c\n" +
|
0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x77, 0x65, 0x61, 0x74,
|
||||||
"\tcomponent\x18\x01 \x01(\tR\tcomponent\x12\x1b\n" +
|
0x68, 0x65, 0x72, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||||
"\x06status\x18\x02 \x01(\x05H\x00R\x06status\x88\x01\x01B\t\n" +
|
0x73, 0x52, 0x09, 0x62, 0x61, 0x74, 0x74, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x11,
|
||||||
"\a_statusBTZRgitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weatherb\x06proto3"
|
0x62, 0x61, 0x72, 0x6f, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69,
|
||||||
|
0x6e, 0x18, 0x17, 0x20, 0x01, 0x28, 0x01, 0x48, 0x12, 0x52, 0x0f, 0x62, 0x61, 0x72, 0x6f, 0x6d,
|
||||||
|
0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a,
|
||||||
|
0x11, 0x62, 0x61, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x5f,
|
||||||
|
0x69, 0x6e, 0x18, 0x18, 0x20, 0x01, 0x28, 0x01, 0x48, 0x13, 0x52, 0x0f, 0x62, 0x61, 0x72, 0x6f,
|
||||||
|
0x6d, 0x41, 0x62, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x23,
|
||||||
|
0x0a, 0x0b, 0x64, 0x65, 0x77, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x66, 0x18, 0x19, 0x20,
|
||||||
|
0x01, 0x28, 0x01, 0x48, 0x14, 0x52, 0x09, 0x64, 0x65, 0x77, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x46,
|
||||||
|
0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0c, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x63, 0x68, 0x69, 0x6c,
|
||||||
|
0x6c, 0x5f, 0x66, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x01, 0x48, 0x15, 0x52, 0x0a, 0x77, 0x69, 0x6e,
|
||||||
|
0x64, 0x43, 0x68, 0x69, 0x6c, 0x6c, 0x46, 0x88, 0x01, 0x01, 0x12, 0x57, 0x0a, 0x15, 0x74, 0x65,
|
||||||
|
0x6d, 0x70, 0x5f, 0x68, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x65, 0x6e, 0x73,
|
||||||
|
0x6f, 0x72, 0x73, 0x18, 0x1b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x6d, 0x62, 0x69,
|
||||||
|
0x65, 0x6e, 0x74, 0x2e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x6d, 0x70,
|
||||||
|
0x48, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x52, 0x13,
|
||||||
|
0x74, 0x65, 0x6d, 0x70, 0x48, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x53, 0x65, 0x6e, 0x73,
|
||||||
|
0x6f, 0x72, 0x73, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x6f, 0x75, 0x74,
|
||||||
|
0x64, 0x6f, 0x6f, 0x72, 0x5f, 0x66, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f,
|
||||||
|
0x69, 0x6e, 0x64, 0x6f, 0x6f, 0x72, 0x5f, 0x66, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x68, 0x75, 0x6d,
|
||||||
|
0x69, 0x64, 0x69, 0x74, 0x79, 0x5f, 0x6f, 0x75, 0x74, 0x64, 0x6f, 0x6f, 0x72, 0x42, 0x12, 0x0a,
|
||||||
|
0x10, 0x5f, 0x68, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x64, 0x6f, 0x6f,
|
||||||
|
0x72, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64,
|
||||||
|
0x5f, 0x6d, 0x70, 0x68, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x67, 0x75,
|
||||||
|
0x73, 0x74, 0x5f, 0x6d, 0x70, 0x68, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x64,
|
||||||
|
0x61, 0x69, 0x6c, 0x79, 0x5f, 0x67, 0x75, 0x73, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x77, 0x69,
|
||||||
|
0x6e, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x5f,
|
||||||
|
0x64, 0x69, 0x72, 0x5f, 0x61, 0x76, 0x67, 0x5f, 0x31, 0x30, 0x6d, 0x42, 0x05, 0x0a, 0x03, 0x5f,
|
||||||
|
0x75, 0x76, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x6f, 0x6c, 0x61, 0x72, 0x5f, 0x72, 0x61, 0x64,
|
||||||
|
0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x68, 0x6f, 0x75, 0x72, 0x6c,
|
||||||
|
0x79, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x65, 0x76,
|
||||||
|
0x65, 0x6e, 0x74, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x42, 0x10, 0x0a, 0x0e, 0x5f,
|
||||||
|
0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x42, 0x11, 0x0a,
|
||||||
|
0x0f, 0x5f, 0x77, 0x65, 0x65, 0x6b, 0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e,
|
||||||
|
0x42, 0x12, 0x0a, 0x10, 0x5f, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x5f, 0x72, 0x61, 0x69,
|
||||||
|
0x6e, 0x5f, 0x69, 0x6e, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x79, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x5f,
|
||||||
|
0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x74, 0x6f, 0x74, 0x61,
|
||||||
|
0x6c, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x62, 0x61,
|
||||||
|
0x72, 0x6f, 0x6d, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x42,
|
||||||
|
0x14, 0x0a, 0x12, 0x5f, 0x62, 0x61, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75,
|
||||||
|
0x74, 0x65, 0x5f, 0x69, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x65, 0x77, 0x5f, 0x70, 0x6f,
|
||||||
|
0x69, 0x6e, 0x74, 0x5f, 0x66, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x5f, 0x63,
|
||||||
|
0x68, 0x69, 0x6c, 0x6c, 0x5f, 0x66, 0x22, 0x7d, 0x0a, 0x12, 0x54, 0x65, 0x6d, 0x70, 0x48, 0x75,
|
||||||
|
0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04,
|
||||||
|
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
|
0x12, 0x1a, 0x0a, 0x06, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01,
|
||||||
|
0x48, 0x00, 0x52, 0x05, 0x74, 0x65, 0x6d, 0x70, 0x46, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08,
|
||||||
|
0x68, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01,
|
||||||
|
0x52, 0x08, 0x68, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a,
|
||||||
|
0x07, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x5f, 0x66, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x68, 0x75, 0x6d,
|
||||||
|
0x69, 0x64, 0x69, 0x74, 0x79, 0x22, 0x55, 0x0a, 0x0d, 0x42, 0x61, 0x74, 0x74, 0x65, 0x72, 0x79,
|
||||||
|
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e,
|
||||||
|
0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f,
|
||||||
|
0x6e, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02,
|
||||||
|
0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01,
|
||||||
|
0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x54, 0x5a, 0x52,
|
||||||
|
0x67, 0x69, 0x74, 0x65, 0x61, 0x2e, 0x6c, 0x69, 0x62, 0x72, 0x65, 0x74, 0x65, 0x63, 0x68, 0x63,
|
||||||
|
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6d,
|
||||||
|
0x63, 0x67, 0x75, 0x69, 0x72, 0x65, 0x2f, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x6c,
|
||||||
|
0x6f, 0x63, 0x61, 0x6c, 0x2d, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70,
|
||||||
|
0x69, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x77, 0x65, 0x61, 0x74, 0x68,
|
||||||
|
0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_weather_weather_proto_rawDescOnce sync.Once
|
file_weather_weather_proto_rawDescOnce sync.Once
|
||||||
@ -769,32 +710,27 @@ func file_weather_weather_proto_rawDescGZIP() []byte {
|
|||||||
return file_weather_weather_proto_rawDescData
|
return file_weather_weather_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_weather_weather_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
var file_weather_weather_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||||
var file_weather_weather_proto_goTypes = []any{
|
var file_weather_weather_proto_goTypes = []any{
|
||||||
(*CountWeatherUpdatesRequest)(nil), // 0: ambient.weather.CountWeatherUpdatesRequest
|
(*GetWeatherRequest)(nil), // 0: ambient.weather.GetWeatherRequest
|
||||||
(*CountWeatherUpdatesResponse)(nil), // 1: ambient.weather.CountWeatherUpdatesResponse
|
(*GetWeatherResponse)(nil), // 1: ambient.weather.GetWeatherResponse
|
||||||
(*GetWeatherRequest)(nil), // 2: ambient.weather.GetWeatherRequest
|
(*GetWeatherOpts)(nil), // 2: ambient.weather.GetWeatherOpts
|
||||||
(*GetWeatherResponse)(nil), // 3: ambient.weather.GetWeatherResponse
|
(*WeatherUpdate)(nil), // 3: ambient.weather.WeatherUpdate
|
||||||
(*GetWeatherOpts)(nil), // 4: ambient.weather.GetWeatherOpts
|
(*TempHumiditySensor)(nil), // 4: ambient.weather.TempHumiditySensor
|
||||||
(*WeatherUpdate)(nil), // 5: ambient.weather.WeatherUpdate
|
(*BatteryStatus)(nil), // 5: ambient.weather.BatteryStatus
|
||||||
(*TempHumiditySensor)(nil), // 6: ambient.weather.TempHumiditySensor
|
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
|
||||||
(*BatteryStatus)(nil), // 7: ambient.weather.BatteryStatus
|
|
||||||
(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
|
|
||||||
}
|
}
|
||||||
var file_weather_weather_proto_depIdxs = []int32{
|
var file_weather_weather_proto_depIdxs = []int32{
|
||||||
4, // 0: ambient.weather.CountWeatherUpdatesRequest.opts:type_name -> ambient.weather.GetWeatherOpts
|
2, // 0: ambient.weather.GetWeatherRequest.opts:type_name -> ambient.weather.GetWeatherOpts
|
||||||
4, // 1: ambient.weather.GetWeatherRequest.opts:type_name -> ambient.weather.GetWeatherOpts
|
6, // 1: ambient.weather.GetWeatherResponse.last_updated:type_name -> google.protobuf.Timestamp
|
||||||
8, // 2: ambient.weather.GetWeatherResponse.last_updated:type_name -> google.protobuf.Timestamp
|
3, // 2: ambient.weather.GetWeatherResponse.weather_updates:type_name -> ambient.weather.WeatherUpdate
|
||||||
5, // 3: ambient.weather.GetWeatherResponse.weather_updates:type_name -> ambient.weather.WeatherUpdate
|
5, // 3: ambient.weather.WeatherUpdate.batteries:type_name -> ambient.weather.BatteryStatus
|
||||||
7, // 4: ambient.weather.WeatherUpdate.batteries:type_name -> ambient.weather.BatteryStatus
|
4, // 4: ambient.weather.WeatherUpdate.temp_humidity_sensors:type_name -> ambient.weather.TempHumiditySensor
|
||||||
6, // 5: ambient.weather.WeatherUpdate.temp_humidity_sensors:type_name -> ambient.weather.TempHumiditySensor
|
5, // [5:5] is the sub-list for method output_type
|
||||||
8, // 6: ambient.weather.WeatherUpdate.update_timestamp:type_name -> google.protobuf.Timestamp
|
5, // [5:5] is the sub-list for method input_type
|
||||||
8, // 7: ambient.weather.WeatherUpdate.lightning_last_time:type_name -> google.protobuf.Timestamp
|
5, // [5:5] is the sub-list for extension type_name
|
||||||
8, // [8:8] is the sub-list for method output_type
|
5, // [5:5] is the sub-list for extension extendee
|
||||||
8, // [8:8] is the sub-list for method input_type
|
0, // [0:5] is the sub-list for field type_name
|
||||||
8, // [8:8] is the sub-list for extension type_name
|
|
||||||
8, // [8:8] is the sub-list for extension extendee
|
|
||||||
0, // [0:8] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_weather_weather_proto_init() }
|
func init() { file_weather_weather_proto_init() }
|
||||||
@ -802,18 +738,18 @@ func file_weather_weather_proto_init() {
|
|||||||
if File_weather_weather_proto != nil {
|
if File_weather_weather_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
file_weather_weather_proto_msgTypes[0].OneofWrappers = []any{}
|
||||||
file_weather_weather_proto_msgTypes[2].OneofWrappers = []any{}
|
file_weather_weather_proto_msgTypes[2].OneofWrappers = []any{}
|
||||||
|
file_weather_weather_proto_msgTypes[3].OneofWrappers = []any{}
|
||||||
file_weather_weather_proto_msgTypes[4].OneofWrappers = []any{}
|
file_weather_weather_proto_msgTypes[4].OneofWrappers = []any{}
|
||||||
file_weather_weather_proto_msgTypes[5].OneofWrappers = []any{}
|
file_weather_weather_proto_msgTypes[5].OneofWrappers = []any{}
|
||||||
file_weather_weather_proto_msgTypes[6].OneofWrappers = []any{}
|
|
||||||
file_weather_weather_proto_msgTypes[7].OneofWrappers = []any{}
|
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_weather_weather_proto_rawDesc), len(file_weather_weather_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_weather_weather_proto_rawDesc), len(file_weather_weather_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 8,
|
NumMessages: 6,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"swagger": "2.0",
|
|
||||||
"info": {
|
|
||||||
"title": "weather/weather.proto",
|
|
||||||
"version": "version not set"
|
|
||||||
},
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"paths": {},
|
|
||||||
"definitions": {
|
|
||||||
"protobufAny": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"@type": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": {}
|
|
||||||
},
|
|
||||||
"rpcStatus": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"code": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"details": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"$ref": "#/definitions/protobufAny"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,12 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.6
|
// protoc-gen-go v1.36.5
|
||||||
// protoc v5.29.3
|
// protoc v5.29.3
|
||||||
// source: weather/weather_service.proto
|
// source: weather/weather_service.proto
|
||||||
|
|
||||||
package weather
|
package weather
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@ -23,27 +22,36 @@ const (
|
|||||||
|
|
||||||
var File_weather_weather_service_proto protoreflect.FileDescriptor
|
var File_weather_weather_service_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
const file_weather_weather_service_proto_rawDesc = "" +
|
var file_weather_weather_service_proto_rawDesc = string([]byte{
|
||||||
"\n" +
|
0x0a, 0x1d, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2f, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65,
|
||||||
"\x1dweather/weather_service.proto\x12\x0fambient.weather\x1a\x1cgoogle/api/annotations.proto\x1a\x15weather/weather.proto2\x8e\x02\n" +
|
0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||||
"\x1aAmbientLocalWeatherService\x12j\n" +
|
0x0f, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72,
|
||||||
"\n" +
|
0x1a, 0x15, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2f, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65,
|
||||||
"GetWeather\x12\".ambient.weather.GetWeatherRequest\x1a#.ambient.weather.GetWeatherResponse\"\x13\x82\xd3\xe4\x93\x02\r\x12\v/v1/weather\x12\x83\x01\n" +
|
0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x73, 0x0a, 0x1a, 0x41, 0x6d, 0x62, 0x69, 0x65,
|
||||||
"\x13CountWeatherUpdates\x12+.ambient.weather.CountWeatherUpdatesRequest\x1a,.ambient.weather.CountWeatherUpdatesResponse\"\x11\x82\xd3\xe4\x93\x02\v\x12\t/v1/countBTZRgitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weatherb\x06proto3"
|
0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x53, 0x65,
|
||||||
|
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x57, 0x65, 0x61, 0x74,
|
||||||
|
0x68, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x77, 0x65,
|
||||||
|
0x61, 0x74, 0x68, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72,
|
||||||
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e,
|
||||||
|
0x74, 0x2e, 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x65, 0x61,
|
||||||
|
0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x54, 0x5a, 0x52,
|
||||||
|
0x67, 0x69, 0x74, 0x65, 0x61, 0x2e, 0x6c, 0x69, 0x62, 0x72, 0x65, 0x74, 0x65, 0x63, 0x68, 0x63,
|
||||||
|
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6d,
|
||||||
|
0x63, 0x67, 0x75, 0x69, 0x72, 0x65, 0x2f, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x2d, 0x6c,
|
||||||
|
0x6f, 0x63, 0x61, 0x6c, 0x2d, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70,
|
||||||
|
0x69, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x77, 0x65, 0x61, 0x74, 0x68,
|
||||||
|
0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
})
|
||||||
|
|
||||||
var file_weather_weather_service_proto_goTypes = []any{
|
var file_weather_weather_service_proto_goTypes = []any{
|
||||||
(*GetWeatherRequest)(nil), // 0: ambient.weather.GetWeatherRequest
|
(*GetWeatherRequest)(nil), // 0: ambient.weather.GetWeatherRequest
|
||||||
(*CountWeatherUpdatesRequest)(nil), // 1: ambient.weather.CountWeatherUpdatesRequest
|
(*GetWeatherResponse)(nil), // 1: ambient.weather.GetWeatherResponse
|
||||||
(*GetWeatherResponse)(nil), // 2: ambient.weather.GetWeatherResponse
|
|
||||||
(*CountWeatherUpdatesResponse)(nil), // 3: ambient.weather.CountWeatherUpdatesResponse
|
|
||||||
}
|
}
|
||||||
var file_weather_weather_service_proto_depIdxs = []int32{
|
var file_weather_weather_service_proto_depIdxs = []int32{
|
||||||
0, // 0: ambient.weather.AmbientLocalWeatherService.GetWeather:input_type -> ambient.weather.GetWeatherRequest
|
0, // 0: ambient.weather.AmbientLocalWeatherService.GetWeather:input_type -> ambient.weather.GetWeatherRequest
|
||||||
1, // 1: ambient.weather.AmbientLocalWeatherService.CountWeatherUpdates:input_type -> ambient.weather.CountWeatherUpdatesRequest
|
1, // 1: ambient.weather.AmbientLocalWeatherService.GetWeather:output_type -> ambient.weather.GetWeatherResponse
|
||||||
2, // 2: ambient.weather.AmbientLocalWeatherService.GetWeather:output_type -> ambient.weather.GetWeatherResponse
|
1, // [1:2] is the sub-list for method output_type
|
||||||
3, // 3: ambient.weather.AmbientLocalWeatherService.CountWeatherUpdates:output_type -> ambient.weather.CountWeatherUpdatesResponse
|
0, // [0:1] is the sub-list for method input_type
|
||||||
2, // [2:4] is the sub-list for method output_type
|
|
||||||
0, // [0:2] is the sub-list for method input_type
|
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
0, // [0:0] is the sub-list for field type_name
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
@ -1,235 +0,0 @@
|
|||||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
|
||||||
// source: weather/weather_service.proto
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package weather is a reverse proxy.
|
|
||||||
|
|
||||||
It translates gRPC into RESTful JSON APIs.
|
|
||||||
*/
|
|
||||||
package weather
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/grpclog"
|
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Suppress "imported and not used" errors
|
|
||||||
var (
|
|
||||||
_ codes.Code
|
|
||||||
_ io.Reader
|
|
||||||
_ status.Status
|
|
||||||
_ = errors.New
|
|
||||||
_ = runtime.String
|
|
||||||
_ = utilities.NewDoubleArray
|
|
||||||
_ = metadata.Join
|
|
||||||
)
|
|
||||||
|
|
||||||
var filter_AmbientLocalWeatherService_GetWeather_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_AmbientLocalWeatherService_GetWeather_0(ctx context.Context, marshaler runtime.Marshaler, client AmbientLocalWeatherServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq GetWeatherRequest
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
io.Copy(io.Discard, req.Body)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AmbientLocalWeatherService_GetWeather_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.GetWeather(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_AmbientLocalWeatherService_GetWeather_0(ctx context.Context, marshaler runtime.Marshaler, server AmbientLocalWeatherServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq GetWeatherRequest
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AmbientLocalWeatherService_GetWeather_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.GetWeather(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter_AmbientLocalWeatherService_CountWeatherUpdates_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_AmbientLocalWeatherService_CountWeatherUpdates_0(ctx context.Context, marshaler runtime.Marshaler, client AmbientLocalWeatherServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq CountWeatherUpdatesRequest
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
io.Copy(io.Discard, req.Body)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AmbientLocalWeatherService_CountWeatherUpdates_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.CountWeatherUpdates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_AmbientLocalWeatherService_CountWeatherUpdates_0(ctx context.Context, marshaler runtime.Marshaler, server AmbientLocalWeatherServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq CountWeatherUpdatesRequest
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AmbientLocalWeatherService_CountWeatherUpdates_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.CountWeatherUpdates(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAmbientLocalWeatherServiceHandlerServer registers the http handlers for service AmbientLocalWeatherService to "mux".
|
|
||||||
// UnaryRPC :call AmbientLocalWeatherServiceServer directly.
|
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
|
||||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAmbientLocalWeatherServiceHandlerFromEndpoint instead.
|
|
||||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
|
||||||
func RegisterAmbientLocalWeatherServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AmbientLocalWeatherServiceServer) error {
|
|
||||||
mux.Handle(http.MethodGet, pattern_AmbientLocalWeatherService_GetWeather_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ambient.weather.AmbientLocalWeatherService/GetWeather", runtime.WithHTTPPathPattern("/v1/weather"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AmbientLocalWeatherService_GetWeather_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_AmbientLocalWeatherService_GetWeather_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_AmbientLocalWeatherService_CountWeatherUpdates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ambient.weather.AmbientLocalWeatherService/CountWeatherUpdates", runtime.WithHTTPPathPattern("/v1/count"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AmbientLocalWeatherService_CountWeatherUpdates_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_AmbientLocalWeatherService_CountWeatherUpdates_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAmbientLocalWeatherServiceHandlerFromEndpoint is same as RegisterAmbientLocalWeatherServiceHandler but
|
|
||||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
|
||||||
func RegisterAmbientLocalWeatherServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
|
||||||
conn, err := grpc.NewClient(endpoint, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
if cerr := conn.Close(); cerr != nil {
|
|
||||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
go func() {
|
|
||||||
<-ctx.Done()
|
|
||||||
if cerr := conn.Close(); cerr != nil {
|
|
||||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}()
|
|
||||||
return RegisterAmbientLocalWeatherServiceHandler(ctx, mux, conn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAmbientLocalWeatherServiceHandler registers the http handlers for service AmbientLocalWeatherService to "mux".
|
|
||||||
// The handlers forward requests to the grpc endpoint over "conn".
|
|
||||||
func RegisterAmbientLocalWeatherServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
|
||||||
return RegisterAmbientLocalWeatherServiceHandlerClient(ctx, mux, NewAmbientLocalWeatherServiceClient(conn))
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAmbientLocalWeatherServiceHandlerClient registers the http handlers for service AmbientLocalWeatherService
|
|
||||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AmbientLocalWeatherServiceClient".
|
|
||||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AmbientLocalWeatherServiceClient"
|
|
||||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
|
||||||
// "AmbientLocalWeatherServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
|
||||||
func RegisterAmbientLocalWeatherServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AmbientLocalWeatherServiceClient) error {
|
|
||||||
mux.Handle(http.MethodGet, pattern_AmbientLocalWeatherService_GetWeather_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/ambient.weather.AmbientLocalWeatherService/GetWeather", runtime.WithHTTPPathPattern("/v1/weather"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_AmbientLocalWeatherService_GetWeather_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_AmbientLocalWeatherService_GetWeather_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_AmbientLocalWeatherService_CountWeatherUpdates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/ambient.weather.AmbientLocalWeatherService/CountWeatherUpdates", runtime.WithHTTPPathPattern("/v1/count"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_AmbientLocalWeatherService_CountWeatherUpdates_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_AmbientLocalWeatherService_CountWeatherUpdates_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
pattern_AmbientLocalWeatherService_GetWeather_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "weather"}, ""))
|
|
||||||
pattern_AmbientLocalWeatherService_CountWeatherUpdates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "count"}, ""))
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
forward_AmbientLocalWeatherService_GetWeather_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_AmbientLocalWeatherService_CountWeatherUpdates_0 = runtime.ForwardResponseMessage
|
|
||||||
)
|
|
@ -1,327 +0,0 @@
|
|||||||
{
|
|
||||||
"swagger": "2.0",
|
|
||||||
"info": {
|
|
||||||
"title": "weather/weather_service.proto",
|
|
||||||
"version": "version not set"
|
|
||||||
},
|
|
||||||
"tags": [
|
|
||||||
{
|
|
||||||
"name": "AmbientLocalWeatherService"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"paths": {
|
|
||||||
"/v1/count": {
|
|
||||||
"get": {
|
|
||||||
"operationId": "AmbientLocalWeatherService_CountWeatherUpdates",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A successful response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/weatherCountWeatherUpdatesResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"default": {
|
|
||||||
"description": "An unexpected error response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/rpcStatus"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "opts.stationName",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "opts.stationType",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"AmbientLocalWeatherService"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/v1/weather": {
|
|
||||||
"get": {
|
|
||||||
"operationId": "AmbientLocalWeatherService_GetWeather",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A successful response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/weatherGetWeatherResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"default": {
|
|
||||||
"description": "An unexpected error response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/rpcStatus"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "opts.stationName",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "opts.stationType",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "limit",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"AmbientLocalWeatherService"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"definitions": {
|
|
||||||
"protobufAny": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"@type": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": {}
|
|
||||||
},
|
|
||||||
"rpcStatus": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"code": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"details": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"$ref": "#/definitions/protobufAny"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"weatherBatteryStatus": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"component": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"title": "Represents battery status for different components"
|
|
||||||
},
|
|
||||||
"weatherCountWeatherUpdatesResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"count": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"weatherGetWeatherOpts": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"stationName": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"stationType": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"weatherGetWeatherResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"lastUpdated": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"weatherUpdates": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"$ref": "#/definitions/weatherWeatherUpdate"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"weatherTempHumiditySensor": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"tempF": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"humidity": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"title": "Represents a temperature and humidity sensor"
|
|
||||||
},
|
|
||||||
"weatherWeatherUpdate": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"stationName": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"stationType": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"stationId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"tempOutdoorF": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"tempIndoorF": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"humidityOutdoor": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"humidityIndoor": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"windSpeedMph": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"windGustMph": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"maxDailyGust": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"windDir": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"windDirAvg10m": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"uv": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"solarRadiation": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"hourlyRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"eventRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"dailyRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"weeklyRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"monthlyRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"yearlyRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"totalRainIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"batteries": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"$ref": "#/definitions/weatherBatteryStatus"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"baromRelativeIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"baromAbsoluteIn": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"dewPointF": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"windChillF": {
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"tempHumiditySensors": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"$ref": "#/definitions/weatherTempHumiditySensor"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"updateTimestamp": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"lightningDay": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"lightningDistance": {
|
|
||||||
"type": "integer",
|
|
||||||
"format": "int32"
|
|
||||||
},
|
|
||||||
"lightningLastTime": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,8 +19,7 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AmbientLocalWeatherService_GetWeather_FullMethodName = "/ambient.weather.AmbientLocalWeatherService/GetWeather"
|
AmbientLocalWeatherService_GetWeather_FullMethodName = "/ambient.weather.AmbientLocalWeatherService/GetWeather"
|
||||||
AmbientLocalWeatherService_CountWeatherUpdates_FullMethodName = "/ambient.weather.AmbientLocalWeatherService/CountWeatherUpdates"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// AmbientLocalWeatherServiceClient is the client API for AmbientLocalWeatherService service.
|
// AmbientLocalWeatherServiceClient is the client API for AmbientLocalWeatherService service.
|
||||||
@ -28,7 +27,6 @@ const (
|
|||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
type AmbientLocalWeatherServiceClient interface {
|
type AmbientLocalWeatherServiceClient interface {
|
||||||
GetWeather(ctx context.Context, in *GetWeatherRequest, opts ...grpc.CallOption) (*GetWeatherResponse, error)
|
GetWeather(ctx context.Context, in *GetWeatherRequest, opts ...grpc.CallOption) (*GetWeatherResponse, error)
|
||||||
CountWeatherUpdates(ctx context.Context, in *CountWeatherUpdatesRequest, opts ...grpc.CallOption) (*CountWeatherUpdatesResponse, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ambientLocalWeatherServiceClient struct {
|
type ambientLocalWeatherServiceClient struct {
|
||||||
@ -49,22 +47,11 @@ func (c *ambientLocalWeatherServiceClient) GetWeather(ctx context.Context, in *G
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ambientLocalWeatherServiceClient) CountWeatherUpdates(ctx context.Context, in *CountWeatherUpdatesRequest, opts ...grpc.CallOption) (*CountWeatherUpdatesResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(CountWeatherUpdatesResponse)
|
|
||||||
err := c.cc.Invoke(ctx, AmbientLocalWeatherService_CountWeatherUpdates_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// AmbientLocalWeatherServiceServer is the server API for AmbientLocalWeatherService service.
|
// AmbientLocalWeatherServiceServer is the server API for AmbientLocalWeatherService service.
|
||||||
// All implementations must embed UnimplementedAmbientLocalWeatherServiceServer
|
// All implementations must embed UnimplementedAmbientLocalWeatherServiceServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
type AmbientLocalWeatherServiceServer interface {
|
type AmbientLocalWeatherServiceServer interface {
|
||||||
GetWeather(context.Context, *GetWeatherRequest) (*GetWeatherResponse, error)
|
GetWeather(context.Context, *GetWeatherRequest) (*GetWeatherResponse, error)
|
||||||
CountWeatherUpdates(context.Context, *CountWeatherUpdatesRequest) (*CountWeatherUpdatesResponse, error)
|
|
||||||
mustEmbedUnimplementedAmbientLocalWeatherServiceServer()
|
mustEmbedUnimplementedAmbientLocalWeatherServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,9 +65,6 @@ type UnimplementedAmbientLocalWeatherServiceServer struct{}
|
|||||||
func (UnimplementedAmbientLocalWeatherServiceServer) GetWeather(context.Context, *GetWeatherRequest) (*GetWeatherResponse, error) {
|
func (UnimplementedAmbientLocalWeatherServiceServer) GetWeather(context.Context, *GetWeatherRequest) (*GetWeatherResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetWeather not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetWeather not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedAmbientLocalWeatherServiceServer) CountWeatherUpdates(context.Context, *CountWeatherUpdatesRequest) (*CountWeatherUpdatesResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CountWeatherUpdates not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedAmbientLocalWeatherServiceServer) mustEmbedUnimplementedAmbientLocalWeatherServiceServer() {
|
func (UnimplementedAmbientLocalWeatherServiceServer) mustEmbedUnimplementedAmbientLocalWeatherServiceServer() {
|
||||||
}
|
}
|
||||||
func (UnimplementedAmbientLocalWeatherServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedAmbientLocalWeatherServiceServer) testEmbeddedByValue() {}
|
||||||
@ -121,24 +105,6 @@ func _AmbientLocalWeatherService_GetWeather_Handler(srv interface{}, ctx context
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _AmbientLocalWeatherService_CountWeatherUpdates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(CountWeatherUpdatesRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(AmbientLocalWeatherServiceServer).CountWeatherUpdates(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: AmbientLocalWeatherService_CountWeatherUpdates_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(AmbientLocalWeatherServiceServer).CountWeatherUpdates(ctx, req.(*CountWeatherUpdatesRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AmbientLocalWeatherService_ServiceDesc is the grpc.ServiceDesc for AmbientLocalWeatherService service.
|
// AmbientLocalWeatherService_ServiceDesc is the grpc.ServiceDesc for AmbientLocalWeatherService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -150,10 +116,6 @@ var AmbientLocalWeatherService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetWeather",
|
MethodName: "GetWeather",
|
||||||
Handler: _AmbientLocalWeatherService_GetWeather_Handler,
|
Handler: _AmbientLocalWeatherService_GetWeather_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "CountWeatherUpdates",
|
|
||||||
Handler: _AmbientLocalWeatherService_CountWeatherUpdates_Handler,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "weather/weather_service.proto",
|
Metadata: "weather/weather_service.proto",
|
||||||
|
75
app.go
75
app.go
@ -1,75 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/app"
|
|
||||||
grpcopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
|
|
||||||
httpopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
|
||||||
|
|
||||||
weatherpb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/ambientgrpc"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/ambienthttp"
|
|
||||||
)
|
|
||||||
|
|
||||||
func prepareApp(ctx context.Context, aw *ambient.AmbientWeather) *app.App {
|
|
||||||
// Load ambient routes into app
|
|
||||||
awApp := &app.App{
|
|
||||||
AppContext: ctx,
|
|
||||||
|
|
||||||
// HTTP Endpoints for Ambient Weather Stations
|
|
||||||
HTTP: &httpopts.AppHTTP{
|
|
||||||
Funcs: []httpopts.HTTPFunc{
|
|
||||||
{
|
|
||||||
Path: "/weatherstation/updateweatherstation.php",
|
|
||||||
HandlerFunc: aw.GetWundergroundHandlerFunc(ctx),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Path: "/data/report",
|
|
||||||
HandlerFunc: aw.GetAWNHandlerFunc(ctx),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// HTTP Listener that fixes broken requests generated by
|
|
||||||
// some versions of awn firmware
|
|
||||||
CustomListener: ambienthttp.NewAWNMutatingListener(ctx,
|
|
||||||
aw.Config.HTTP.Listen), // Necessary to fix certain bad AWN firmware
|
|
||||||
|
|
||||||
HealthChecks: []httpopts.HealthCheckFunc{
|
|
||||||
// Check recorder health
|
|
||||||
// Only redis implements this
|
|
||||||
func(ctx context.Context) error {
|
|
||||||
var errs error
|
|
||||||
errs = errors.Join(errs, aw.GetRecorder().Ping(ctx))
|
|
||||||
return errs
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// GRPC Service for retrieving weather
|
|
||||||
GRPC: &grpcopts.AppGRPC{
|
|
||||||
GRPCDialOpts: []grpc.DialOption{
|
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
||||||
},
|
|
||||||
GRPCGatewayOpts: aw.GetGatewayOpts(),
|
|
||||||
Services: []*grpcopts.GRPCService{
|
|
||||||
{
|
|
||||||
Name: "Weather Service",
|
|
||||||
Type: &weatherpb.AmbientLocalWeatherService_ServiceDesc,
|
|
||||||
Service: ambientgrpc.NewGRPCWeather(ctx, aw.GetRecorder()),
|
|
||||||
GwRegistrationFuncs: []grpcopts.GwRegistrationFunc{
|
|
||||||
// HTTP API via grpc-gateway. Update path in app grpc config
|
|
||||||
// to change default (/grpcapi)
|
|
||||||
weatherpb.RegisterAmbientLocalWeatherServiceHandler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
return awApp
|
|
||||||
}
|
|
@ -1,238 +0,0 @@
|
|||||||
{
|
|
||||||
"definitions": {
|
|
||||||
"ConfigGRPCConfig": {
|
|
||||||
"properties": {
|
|
||||||
"enableGRPCGateway": {
|
|
||||||
"default": true,
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"enableInstrumentation": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"enableReflection": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"enabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"grpcGatewayPath": {
|
|
||||||
"default": "/grpc-api",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"listen": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"logRequests": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ConfigHTTPConfig": {
|
|
||||||
"properties": {
|
|
||||||
"enabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"idleTimeout": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"listen": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"logRequests": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"readTimeout": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"writeTimeout": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ConfigLogConfig": {
|
|
||||||
"properties": {
|
|
||||||
"enabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"format": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"level": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"timeFormat": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ConfigOTELConfig": {
|
|
||||||
"properties": {
|
|
||||||
"enabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"metricIntervalSecs": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"prometheusEnabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"prometheusPath": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"stdoutEnabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ConfigRecorderConfig": {
|
|
||||||
"properties": {
|
|
||||||
"keepLast": {
|
|
||||||
"default": 120,
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"redisConfig": {
|
|
||||||
"$ref": "#/definitions/ConfigRedisConfig"
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"enum": [
|
|
||||||
"memory",
|
|
||||||
"redis",
|
|
||||||
"noop"
|
|
||||||
],
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ConfigRedisConfig": {
|
|
||||||
"properties": {
|
|
||||||
"redisDB": {
|
|
||||||
"default": 0,
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"redisHost": {
|
|
||||||
"default": "127.0.0.1",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"redisKeyTTL": {
|
|
||||||
"default": "24h",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"redisPassword": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"redisPort": {
|
|
||||||
"default": 6379,
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"redisTLS": {
|
|
||||||
"default": false,
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"redisTLSInsecure": {
|
|
||||||
"default": false,
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"redisUser": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ConfigWeatherStation": {
|
|
||||||
"properties": {
|
|
||||||
"awnPassKey": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"dropMetrics": {
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
},
|
|
||||||
"equipment": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"keepMetrics": {
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"proxyToAWN": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"proxyToWunderground": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"sensorMappings": {
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"wundergroundID": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"wundergroundPassword": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"environment": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"grpc": {
|
|
||||||
"$ref": "#/definitions/ConfigGRPCConfig"
|
|
||||||
},
|
|
||||||
"http": {
|
|
||||||
"$ref": "#/definitions/ConfigHTTPConfig"
|
|
||||||
},
|
|
||||||
"logging": {
|
|
||||||
"$ref": "#/definitions/ConfigLogConfig"
|
|
||||||
},
|
|
||||||
"metricPrefix": {
|
|
||||||
"default": "weather",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"otel": {
|
|
||||||
"$ref": "#/definitions/ConfigOTELConfig"
|
|
||||||
},
|
|
||||||
"recorderConfig": {
|
|
||||||
"$ref": "#/definitions/ConfigRecorderConfig"
|
|
||||||
},
|
|
||||||
"updatesToKeep": {
|
|
||||||
"default": 1,
|
|
||||||
"type": [
|
|
||||||
"null",
|
|
||||||
"integer"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"version": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"weatherStations": {
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/ConfigWeatherStation"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"type": "object"
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
{
|
|
||||||
"PASSKEY": [
|
|
||||||
"DE:AD:BE:EF:BE:EF"
|
|
||||||
],
|
|
||||||
"baromabsin": [
|
|
||||||
"29.025"
|
|
||||||
],
|
|
||||||
"baromrelin": [
|
|
||||||
"30.005"
|
|
||||||
],
|
|
||||||
"batt1": [
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"battin": [
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"battout": [
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"battrain": [
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"dailyrainin": [
|
|
||||||
"0.000"
|
|
||||||
],
|
|
||||||
"dateutc": [
|
|
||||||
"2025-03-23 14:07:59"
|
|
||||||
],
|
|
||||||
"eventrainin": [
|
|
||||||
"0.000"
|
|
||||||
],
|
|
||||||
"hourlyrainin": [
|
|
||||||
"0.000"
|
|
||||||
],
|
|
||||||
"humidity": [
|
|
||||||
"55"
|
|
||||||
],
|
|
||||||
"humidity1": [
|
|
||||||
"53"
|
|
||||||
],
|
|
||||||
"humidityin": [
|
|
||||||
"36"
|
|
||||||
],
|
|
||||||
"maxdailygust": [
|
|
||||||
"20.36"
|
|
||||||
],
|
|
||||||
"monthlyrainin": [
|
|
||||||
"1.969"
|
|
||||||
],
|
|
||||||
"solarradiation": [
|
|
||||||
"142.15"
|
|
||||||
],
|
|
||||||
"stationtype": [
|
|
||||||
"WeatherHub_V1.0.2"
|
|
||||||
],
|
|
||||||
"temp1f": [
|
|
||||||
"-2.74"
|
|
||||||
],
|
|
||||||
"tempf": [
|
|
||||||
"33.98"
|
|
||||||
],
|
|
||||||
"tempinf": [
|
|
||||||
"70.52"
|
|
||||||
],
|
|
||||||
"totalrainin": [
|
|
||||||
"2.421"
|
|
||||||
],
|
|
||||||
"uv": [
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"weeklyrainin": [
|
|
||||||
"0.000"
|
|
||||||
],
|
|
||||||
"winddir": [
|
|
||||||
"117"
|
|
||||||
],
|
|
||||||
"winddir_avg10m": [
|
|
||||||
"127"
|
|
||||||
],
|
|
||||||
"windgustmph": [
|
|
||||||
"17.22"
|
|
||||||
],
|
|
||||||
"windspeedmph": [
|
|
||||||
"10.29"
|
|
||||||
],
|
|
||||||
"yearlyrainin": [
|
|
||||||
"2.421"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
#!env sh
|
|
||||||
SCRIPT_DIR=$( dirname $0 )
|
|
||||||
JSON_FILE="${SCRIPT_DIR}/wu_sample.json"
|
|
||||||
BASE_URL="http://127.0.0.1:8080/data/report"
|
|
||||||
|
|
||||||
# Convert JSON to query parameters
|
|
||||||
QUERY_STRING=$(jq -r 'to_entries | map("\(.key)=\(.value[0] | @uri)") | join("&")' "$JSON_FILE")
|
|
||||||
|
|
||||||
curl -G --data "$QUERY_STRING" "$BASE_URL"
|
|
@ -3,8 +3,7 @@ services:
|
|||||||
ambient-local-exporter:
|
ambient-local-exporter:
|
||||||
build: .
|
build: .
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080 # HTTP
|
- 8080:8080
|
||||||
- 8081:8081 # GRPC
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.yaml:/app/config.yaml
|
- ./config.yaml:/app/config.yaml
|
||||||
command:
|
command:
|
||||||
|
35
go.mod
35
go.mod
@ -1,22 +1,19 @@
|
|||||||
module gitea.libretechconsulting.com/rmcguire/ambient-local-exporter
|
module gitea.libretechconsulting.com/rmcguire/ambient-local-exporter
|
||||||
|
|
||||||
go 1.24.1
|
go 1.23.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.9.1
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.3
|
||||||
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/grpc-ecosystem/grpc-gateway/v2 v2.26.3
|
github.com/rs/zerolog v1.33.0
|
||||||
github.com/redis/go-redis/v9 v9.7.3
|
|
||||||
github.com/rs/zerolog v1.34.0
|
|
||||||
go.opentelemetry.io/otel v1.35.0
|
go.opentelemetry.io/otel v1.35.0
|
||||||
go.opentelemetry.io/otel/metric v1.35.0
|
go.opentelemetry.io/otel/metric v1.35.0
|
||||||
go.opentelemetry.io/otel/trace v1.35.0
|
go.opentelemetry.io/otel/trace v1.35.0
|
||||||
golang.org/x/sys v0.31.0
|
golang.org/x/sys v0.31.0
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463
|
|
||||||
google.golang.org/grpc v1.71.0
|
google.golang.org/grpc v1.71.0
|
||||||
google.golang.org/protobuf v1.36.6
|
google.golang.org/protobuf v1.36.5
|
||||||
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e
|
k8s.io/utils v0.0.0-20241210054802-24370beab758
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@ -24,24 +21,20 @@ require (
|
|||||||
github.com/caarlos0/env/v11 v11.3.1 // indirect
|
github.com/caarlos0/env/v11 v11.3.1 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
|
||||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
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/golang/protobuf v1.5.4 // indirect
|
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1 // indirect
|
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1 // indirect
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||||
github.com/klauspost/compress v1.18.0 // 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.21.1 // 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.63.0 // indirect
|
github.com/prometheus/common v0.62.0 // indirect
|
||||||
github.com/prometheus/procfs v0.16.0 // indirect
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
github.com/swaggest/jsonschema-go v0.3.73 // indirect
|
|
||||||
github.com/swaggest/refl v1.3.1 // indirect
|
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
|
||||||
@ -56,15 +49,7 @@ require (
|
|||||||
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
||||||
golang.org/x/net v0.37.0 // indirect
|
golang.org/x/net v0.37.0 // indirect
|
||||||
golang.org/x/text v0.23.0 // indirect
|
golang.org/x/text v0.23.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20250313205543-e70fdf4c4cb4 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
tool (
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
|
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc
|
|
||||||
google.golang.org/protobuf/cmd/protoc-gen-go
|
|
||||||
)
|
|
||||||
|
147
go.sum
147
go.sum
@ -1,48 +1,22 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.0 h1:XIqk2xpKZ+GzCyh3ZpST93nu+WqteXBPCRcWVliEiks=
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.0/go.mod h1:S3/vdMEiRWWIdD0Fr+tjJc627VzxNzO4Ia2HgTBXe+g=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.7.0 h1:yhRRwV/dxN4Bey1Qv8/rHHV5QvALrZuDJFI+zFPc7sU=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.2 h1:vpEdZu7WI8qIil5NLf6OUF/Tk8+3txZ7fTv1NRRnOoc=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.7.0/go.mod h1:EM3Z9QcRD+b7UlKGA9y37ppfUBC0Reyf5sYEC6vFZcY=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.2/go.mod h1:S3/vdMEiRWWIdD0Fr+tjJc627VzxNzO4Ia2HgTBXe+g=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.8.0 h1:PC8vlpr8tLoRwIHsq5nvOYzz9VqGhxrecAzWuwDXZVo=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.3 h1:dXYHJxK/1vmWBj1wqbqEUncFt3O92agy9gNWoa9NpA0=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.8.0/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
|
gitea.libretechconsulting.com/rmcguire/go-app v0.6.3/go.mod h1:S3/vdMEiRWWIdD0Fr+tjJc627VzxNzO4Ia2HgTBXe+g=
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.8.1 h1:pnmFJnY77dsh84zvVcHqFuQgkxy3hjCQ8tFRGv/aJOw=
|
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.8.1/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
|
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.9.0 h1:ZOBdVk2EehGCX6K3pdT5Dy07bMiUR7VTifE+n0ODfak=
|
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.9.0/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
|
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.9.1 h1:QihWX1YeCqttpAjXq6nHWvNk1MpIhuW8bSO3G+fbsRg=
|
|
||||||
gitea.libretechconsulting.com/rmcguire/go-app v0.9.1/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
|
||||||
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/bool64/dev v0.2.39 h1:kP8DnMGlWXhGYJEZE/J0l/gVBdbuhoPGL+MJG4QbofE=
|
|
||||||
github.com/bool64/dev v0.2.39/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg=
|
|
||||||
github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E=
|
|
||||||
github.com/bool64/shared v0.1.5/go.mod h1:081yz68YC9jeFB3+Bbmno2RFWvGKv1lPKkMP6MHJlPs=
|
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
|
||||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
|
||||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
|
||||||
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
|
github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA=
|
||||||
github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
|
github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
|
||||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
@ -51,30 +25,18 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
|
|||||||
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||||
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
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.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
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/go-grpc-middleware/v2 v2.3.1 h1:KcFzXwzM/kGhIRHvc8jdixfIJjVzuUJdnv+5xsPutog=
|
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1 h1:KcFzXwzM/kGhIRHvc8jdixfIJjVzuUJdnv+5xsPutog=
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc=
|
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.1/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
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/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc=
|
|
||||||
github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE=
|
|
||||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
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/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=
|
||||||
@ -97,35 +59,19 @@ 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.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
|
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_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
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.63.0 h1:YR/EIY1o3mEFP/kZCD7iDMnLPlGyuU2Gb3HIcXnA98k=
|
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
|
||||||
github.com/prometheus/common v0.63.0/go.mod h1:VVFF/fBIoToEnWRVkYoXEkq3R3paCoxG9PXP74SnV18=
|
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
|
||||||
github.com/prometheus/procfs v0.16.0 h1:xh6oHhKwnOJKMYiYBDWmkHqQPyiY40sny36Cmx2bbsM=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
github.com/prometheus/procfs v0.16.0/go.mod h1:8veyXUu3nGP7oaCxhX6yeaM5u4stL2FeMXnCqhDthZg=
|
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||||
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
|
|
||||||
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
|
|
||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
|
||||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
|
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||||
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
|
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
|
||||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7o2xQ=
|
|
||||||
github.com/swaggest/assertjson v1.9.0/go.mod h1:b+ZKX2VRiUjxfUIal0HDN85W0nHPAYUbYH5WkkSsFsU=
|
|
||||||
github.com/swaggest/jsonschema-go v0.3.73 h1:gU1pBzF3pkZ1GDD3dRMdQoCjrA0sldJ+QcM7aSSPgvc=
|
|
||||||
github.com/swaggest/jsonschema-go v0.3.73/go.mod h1:qp+Ym2DIXHlHzch3HKz50gPf2wJhKOrAB/VYqLS2oJU=
|
|
||||||
github.com/swaggest/refl v1.3.1 h1:XGplEkYftR7p9cz1lsiwXMM2yzmOymTE9vneVVpaOh4=
|
|
||||||
github.com/swaggest/refl v1.3.1/go.mod h1:4uUVFVfPJ0NSX9FPwMPspeHos9wPFlCMGoPRllUbpvA=
|
|
||||||
github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA=
|
|
||||||
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
|
|
||||||
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M=
|
|
||||||
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
|
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw=
|
||||||
@ -158,80 +104,29 @@ go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU
|
|||||||
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
|
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||||
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
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.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||||
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=
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4=
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20250313205543-e70fdf4c4cb4 h1:kCjWYliqPA8g5z87mbjnf/cdgQqMzBfp9xYre5qKu2A=
|
|
||||||
google.golang.org/genproto v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:SqIx1NV9hcvqdLHo7uNZDS5lrUJybQ3evo3+z/WBfA0=
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250313205543-e70fdf4c4cb4 h1:IFnXJq3UPB3oBREOodn1v1aGQeZYQclEmvWRMN0PSsY=
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:c8q6Z6OCqnfVIqUFJkCzKcrj8eCvUrz+K4KRzSTuANg=
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 h1:hE3bRWtU6uceqlh4fhrSnUyjKHMKB9KrTLLG+bc0ddM=
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463/go.mod h1:U90ffi8eUL9MwPcrJylN5+Mk2v3vuPDptd5yyNUiRR8=
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 h1:iK2jbkWL86DXjEx0qiHcRE9dE4/Ahua5k6V8OWFb//c=
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 h1:e0AIkUUhxyBKh6ssZNrAMeqhA7RKUj42346d1y02i2g=
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
|
||||||
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
|
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/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=
|
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
|
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
|
||||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
|
||||||
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=
|
||||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||||
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e h1:KqK5c/ghOm8xkHYhlodbp6i6+r+ChV2vuAuVRdFbLro=
|
|
||||||
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
|
||||||
|
@ -15,13 +15,13 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.1.12
|
version: 0.1.0
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "v0.18.1"
|
appVersion: "0.9.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: hull
|
- name: hull
|
||||||
|
@ -130,7 +130,7 @@ hull:
|
|||||||
main:
|
main:
|
||||||
image:
|
image:
|
||||||
repository: _HT*hull.config.settings.repo
|
repository: _HT*hull.config.settings.repo
|
||||||
tag: _HT*hull.config.settings.tag
|
tag: _HT!{{ printf "v%s" _HT*hull.config.settings.tag }}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
args:
|
args:
|
||||||
- -config
|
- -config
|
||||||
|
82
main.go
82
main.go
@ -2,24 +2,28 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/app"
|
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/app"
|
||||||
|
grpcopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
|
||||||
|
httpopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
"k8s.io/utils/ptr"
|
||||||
|
|
||||||
|
weatherpb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient"
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient"
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/ambienthttp"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
||||||
|
weathergrpc "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/grpc"
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/state"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultMetricPrefix = "weather"
|
defaultMetricPrefix = "weather"
|
||||||
|
defaultUpdatesToKeep = 120
|
||||||
)
|
)
|
||||||
|
|
||||||
var schema bool
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx, cncl := signal.NotifyContext(context.Background(), os.Kill, os.Interrupt, unix.SIGTERM)
|
ctx, cncl := signal.NotifyContext(context.Background(), os.Kill, os.Interrupt, unix.SIGTERM)
|
||||||
defer cncl()
|
defer cncl()
|
||||||
@ -35,12 +39,6 @@ func main() {
|
|||||||
// and set up logging, tracing, etc..
|
// and set up logging, tracing, etc..
|
||||||
aw := ambient.New(ctx, awConfig).Init()
|
aw := ambient.New(ctx, awConfig).Init()
|
||||||
|
|
||||||
// Just show schema if that's all we were asked to do
|
|
||||||
if schema {
|
|
||||||
printSchema(awConfig)
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load http and grpc routes, prepare the app
|
// Load http and grpc routes, prepare the app
|
||||||
awApp := prepareApp(ctx, aw)
|
awApp := prepareApp(ctx, aw)
|
||||||
|
|
||||||
@ -49,16 +47,58 @@ func main() {
|
|||||||
<-awApp.Done()
|
<-awApp.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag.Parse will be called by go-app
|
func prepareApp(ctx context.Context, aw *ambient.AmbientWeather) *app.App {
|
||||||
func init() {
|
// Config updates / defaults
|
||||||
flag.BoolVar(&schema, "schema", false, "generate json schema and exit")
|
if aw.Config.UpdatesToKeep == nil || *aw.Config.UpdatesToKeep < 1 {
|
||||||
}
|
aw.Config.UpdatesToKeep = ptr.To(defaultUpdatesToKeep)
|
||||||
|
|
||||||
func printSchema(config *config.AmbientLocalExporterConfig) {
|
|
||||||
bytes, err := app.CustomSchema(config)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(string(bytes))
|
// Load ambient routes into app
|
||||||
|
awApp := &app.App{
|
||||||
|
AppContext: ctx,
|
||||||
|
|
||||||
|
// HTTP Endpoints for Ambient Weather Stations
|
||||||
|
HTTP: &httpopts.AppHTTP{
|
||||||
|
Funcs: []httpopts.HTTPFunc{
|
||||||
|
{
|
||||||
|
Path: "/weatherstation/updateweatherstation.php",
|
||||||
|
HandlerFunc: aw.GetWundergroundHandlerFunc(ctx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Path: "/data/report",
|
||||||
|
HandlerFunc: aw.GetAWNHandlerFunc(ctx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// HTTP Listener that fixes broken requests generated by
|
||||||
|
// some versions of awn firmware
|
||||||
|
CustomListener: ambienthttp.NewAWNMutatingListener(ctx,
|
||||||
|
aw.Config.HTTP.Listen), // Necessary to fix certain bad AWN firmware
|
||||||
|
|
||||||
|
// Health check funcs
|
||||||
|
HealthChecks: []httpopts.HealthCheckFunc{
|
||||||
|
// TODO: Implement
|
||||||
|
func(ctx context.Context) error {
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// GRPC Service for retrieving weather
|
||||||
|
GRPC: &grpcopts.AppGRPC{
|
||||||
|
Services: []*grpcopts.GRPCService{
|
||||||
|
{
|
||||||
|
Name: "Weather Service",
|
||||||
|
Type: &weatherpb.AmbientLocalWeatherService_ServiceDesc,
|
||||||
|
Service: weathergrpc.NewGRPCWeather(ctx, state.NewWeatherState(
|
||||||
|
&state.Opts{
|
||||||
|
Ctx: ctx,
|
||||||
|
KeepLast: *aw.Config.UpdatesToKeep,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return awApp
|
||||||
}
|
}
|
||||||
|
@ -20,85 +20,35 @@ import (
|
|||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/provider/awn"
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/provider/awn"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/provider/wunderground"
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/provider/wunderground"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders/memory"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders/noop"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders/redis"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const defUpdatesToKeep = 120
|
|
||||||
|
|
||||||
type AmbientWeather struct {
|
type AmbientWeather struct {
|
||||||
// These providers implement support for the update sent
|
// These providers implement support for the update sent
|
||||||
// when either "AmbientWeather" or "Wunderground" are selected
|
// when either "AmbientWeather" or "Wunderground" are selected
|
||||||
// in the "Custom" section of the AWNet app, or the web UI
|
// in the "Custom" section of the AWNet app, or the web UI
|
||||||
// of an Ambient WeatherHub
|
// of an Ambient WeatherHub
|
||||||
Config *config.AmbientLocalExporterConfig
|
Config *config.AmbientLocalExporterConfig
|
||||||
awnProvider provider.AmbientProvider
|
awnProvider provider.AmbientProvider
|
||||||
wuProvider provider.AmbientProvider
|
wuProvider provider.AmbientProvider
|
||||||
weatherRecorder *recorder.WeatherRecorder
|
appCtx context.Context
|
||||||
appCtx context.Context
|
metrics *weather.WeatherMetrics
|
||||||
metrics *weather.WeatherMetrics
|
l *zerolog.Logger
|
||||||
l *zerolog.Logger
|
|
||||||
*sync.RWMutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(appCtx context.Context, awConfig *config.AmbientLocalExporterConfig) *AmbientWeather {
|
func New(appCtx context.Context, awConfig *config.AmbientLocalExporterConfig) *AmbientWeather {
|
||||||
return &AmbientWeather{
|
return &AmbientWeather{
|
||||||
Config: awConfig,
|
Config: awConfig,
|
||||||
appCtx: appCtx,
|
appCtx: appCtx,
|
||||||
RWMutex: &sync.RWMutex{},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize with defaults, set logger from context
|
// Initialize with defaults, set logger from context
|
||||||
func (aw *AmbientWeather) Init() *AmbientWeather {
|
func (aw *AmbientWeather) Init() *AmbientWeather {
|
||||||
tracer := otel.GetTracer(aw.appCtx, "ambientWeather")
|
|
||||||
_, span := tracer.Start(aw.appCtx, "ambientWeather.init",
|
|
||||||
trace.WithAttributes(
|
|
||||||
attribute.String("name", aw.Config.Name),
|
|
||||||
attribute.Bool("grpcEnabled", aw.Config.GRPCEnabled()),
|
|
||||||
attribute.Bool("httpEnabled", aw.Config.HTTPEnabled()),
|
|
||||||
attribute.Int("weatherStations", len(aw.Config.WeatherStations)),
|
|
||||||
))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
aw.awnProvider = &awn.AWNProvider{}
|
aw.awnProvider = &awn.AWNProvider{}
|
||||||
aw.wuProvider = &wunderground.WUProvider{}
|
aw.wuProvider = &wunderground.WUProvider{}
|
||||||
aw.l = zerolog.Ctx(aw.appCtx)
|
aw.l = zerolog.Ctx(aw.appCtx)
|
||||||
|
|
||||||
updatesToKeep := defUpdatesToKeep
|
|
||||||
if aw.Config.UpdatesToKeep != nil && *aw.Config.UpdatesToKeep > 0 {
|
|
||||||
updatesToKeep = *aw.Config.UpdatesToKeep
|
|
||||||
}
|
|
||||||
span.SetAttributes(attribute.Int("updatesToKeep", updatesToKeep))
|
|
||||||
|
|
||||||
// Choose weather recorder for grpc / api requests,
|
|
||||||
// default is memory recorder
|
|
||||||
var r recorders.Recorder
|
|
||||||
if aw.Config == nil || aw.Config.RecorderConfig == nil {
|
|
||||||
r = &memory.MemoryRecorder{}
|
|
||||||
} else {
|
|
||||||
switch aw.Config.RecorderConfig.Type {
|
|
||||||
case config.TypeMemory:
|
|
||||||
r = &memory.MemoryRecorder{}
|
|
||||||
case config.TypeRedis:
|
|
||||||
r = &redis.RedisRecorder{}
|
|
||||||
case config.TypeNoop:
|
|
||||||
r = &noop.NoopRecorder{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aw.weatherRecorder = recorder.MustNewWeatherRecorder(&recorder.Opts{
|
|
||||||
AppConfig: aw.Config,
|
|
||||||
Ctx: aw.appCtx,
|
|
||||||
KeepLast: updatesToKeep,
|
|
||||||
Recorder: r,
|
|
||||||
})
|
|
||||||
|
|
||||||
aw.l.Trace().Any("awConfig", aw.Config).Send()
|
aw.l.Trace().Any("awConfig", aw.Config).Send()
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
return aw
|
return aw
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,9 +78,6 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
w http.ResponseWriter,
|
w http.ResponseWriter,
|
||||||
r *http.Request,
|
r *http.Request,
|
||||||
) {
|
) {
|
||||||
aw.Lock()
|
|
||||||
defer aw.Unlock()
|
|
||||||
|
|
||||||
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")
|
||||||
|
|
||||||
@ -163,43 +110,21 @@ func (aw *AmbientWeather) handleProviderRequest(
|
|||||||
updateSpan.SetAttributes(attribute.String("stationName", update.StationConfig.Name))
|
updateSpan.SetAttributes(attribute.String("stationName", update.StationConfig.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concurrently record the now enriched update
|
|
||||||
// to the configured recorder and to otel, and proxy
|
|
||||||
// to enabled downstream providers
|
|
||||||
var updateWg sync.WaitGroup
|
|
||||||
|
|
||||||
// Record state
|
|
||||||
updateWg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer updateWg.Done()
|
|
||||||
aw.weatherRecorder.Set(ctx, update)
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Update metrics
|
// Update metrics
|
||||||
updateWg.Add(1)
|
aw.metricsUpdate(ctx, p, update)
|
||||||
go func() {
|
|
||||||
defer updateWg.Done()
|
|
||||||
aw.metricsUpdate(ctx, p, update)
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Proxy update to one or both services if configured to do so
|
|
||||||
// Uses a weather update to allow awn to publish to wunderground and
|
|
||||||
// visa versa.
|
|
||||||
if update.StationConfig != nil {
|
|
||||||
updateWg.Add(1)
|
|
||||||
go func() {
|
|
||||||
defer updateWg.Done()
|
|
||||||
aw.proxyUpdate(ctx, p, update)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
updateWg.Wait()
|
|
||||||
|
|
||||||
l.Debug().
|
l.Debug().
|
||||||
Str("provider", p.Name()).
|
Str("provider", p.Name()).
|
||||||
Any("update", update).
|
Any("update", update).
|
||||||
Msg("successfully handled update")
|
Msg("successfully handled update")
|
||||||
w.Write([]byte("ok"))
|
w.Write([]byte("ok"))
|
||||||
|
|
||||||
|
// Proxy update to one or both services if configured to do so
|
||||||
|
// Uses a weather update to allow awn to publish to wunderground and
|
||||||
|
// visa versa.
|
||||||
|
if update.StationConfig != nil {
|
||||||
|
aw.proxyUpdate(ctx, p, update)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aw *AmbientWeather) enrichUpdate(
|
func (aw *AmbientWeather) enrichUpdate(
|
||||||
@ -317,22 +242,3 @@ func (aw *AmbientWeather) enrichStation(update *weather.WeatherUpdate) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aw *AmbientWeather) GetLogger() *zerolog.Logger {
|
|
||||||
aw.RLock()
|
|
||||||
defer aw.RUnlock()
|
|
||||||
return aw.l
|
|
||||||
}
|
|
||||||
|
|
||||||
func (aw *AmbientWeather) GetCtx() context.Context {
|
|
||||||
aw.RLock()
|
|
||||||
defer aw.RUnlock()
|
|
||||||
return aw.appCtx
|
|
||||||
}
|
|
||||||
|
|
||||||
func (aw *AmbientWeather) GetRecorder() *recorder.WeatherRecorder {
|
|
||||||
aw.RLock()
|
|
||||||
defer aw.RUnlock()
|
|
||||||
|
|
||||||
return aw.weatherRecorder
|
|
||||||
}
|
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
package ambientgrpc
|
|
||||||
|
|
||||||
import (
|
|
||||||
"slices"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/util"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Converts a slice of weather.WeatherUpdate to proto structs
|
|
||||||
func UpdatesToPbUpdates(u []*weather.WeatherUpdate) []*pb.WeatherUpdate {
|
|
||||||
updates := make([]*pb.WeatherUpdate, len(u))
|
|
||||||
for i, update := range u {
|
|
||||||
updates[i] = UpdateToPbUpdate(update)
|
|
||||||
}
|
|
||||||
return updates
|
|
||||||
}
|
|
||||||
|
|
||||||
// Maps a weather.WeatherUpdate to the proto version.
|
|
||||||
//
|
|
||||||
// This should be auto-generated code, but as the proto should be
|
|
||||||
// stable, it is probably not worth the effort.
|
|
||||||
func UpdateToPbUpdate(u *weather.WeatherUpdate) *pb.WeatherUpdate {
|
|
||||||
if u.DateUTC == nil {
|
|
||||||
now := time.Now()
|
|
||||||
u.DateUTC = &now
|
|
||||||
}
|
|
||||||
|
|
||||||
return &pb.WeatherUpdate{
|
|
||||||
StationName: u.StationConfig.Name,
|
|
||||||
StationType: util.DerefStr(u.StationType),
|
|
||||||
StationId: util.DerefStr(u.StationID),
|
|
||||||
TempOutdoorF: u.TempOutdoorF,
|
|
||||||
TempIndoorF: u.TempIndoorF,
|
|
||||||
HumidityOutdoor: util.Int32ptr(u.HumidityOudoor),
|
|
||||||
HumidityIndoor: util.Int32ptr(u.HumidityIndoor),
|
|
||||||
WindSpeedMph: u.WindSpeedMPH,
|
|
||||||
WindGustMph: u.WindGustMPH,
|
|
||||||
MaxDailyGust: u.MaxDailyGust,
|
|
||||||
WindDir: util.Int32ptr(u.WindDir),
|
|
||||||
WindDirAvg_10M: util.Int32ptr(u.WindDirAvg10m),
|
|
||||||
Uv: util.Int32ptr(u.UV),
|
|
||||||
SolarRadiation: u.SolarRadiation,
|
|
||||||
HourlyRainIn: u.HourlyRainIn,
|
|
||||||
EventRainIn: u.EventRainIn,
|
|
||||||
DailyRainIn: u.DailyRainIn,
|
|
||||||
WeeklyRainIn: u.WeeklyRainIn,
|
|
||||||
MonthlyRainIn: u.MonthlyRainIn,
|
|
||||||
YearlyRainIn: u.YearlyRainIn,
|
|
||||||
TotalRainIn: u.TotalRainIn,
|
|
||||||
Batteries: batteriesToPbBatteries(u.Batteries),
|
|
||||||
BaromRelativeIn: u.BaromRelativeIn,
|
|
||||||
BaromAbsoluteIn: u.BaromAbsoluteIn,
|
|
||||||
DewPointF: u.DewPointF,
|
|
||||||
WindChillF: u.WindChillF,
|
|
||||||
TempHumiditySensors: thSensorsToPbSensors(u.TempHumiditySensors),
|
|
||||||
UpdateTimestamp: timestamppb.New(*u.DateUTC),
|
|
||||||
LightningDay: util.Int32ptr(u.LightningDay),
|
|
||||||
LightningDistance: util.Int32ptr(u.LightningDistance),
|
|
||||||
LightningLastTime: util.TimestampFromIntPtr(u.LightningLastTime),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func batteriesToPbBatteries(batteries []weather.BatteryStatus) []*pb.BatteryStatus {
|
|
||||||
pbBatteries := make([]*pb.BatteryStatus, 0, len(batteries))
|
|
||||||
for _, b := range batteries {
|
|
||||||
if b.Status != nil {
|
|
||||||
pbBatteries = append(pbBatteries, &pb.BatteryStatus{
|
|
||||||
Component: b.Component,
|
|
||||||
Status: util.Int32ptr(b.Status),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return slices.Clip(pbBatteries)
|
|
||||||
}
|
|
||||||
|
|
||||||
func thSensorsToPbSensors(sensors []*weather.TempHumiditySensor) []*pb.TempHumiditySensor {
|
|
||||||
pbSensors := make([]*pb.TempHumiditySensor, 0, len(sensors))
|
|
||||||
for _, s := range sensors {
|
|
||||||
if s.TempF != nil || s.Humidity != nil {
|
|
||||||
pbSensors = append(pbSensors, &pb.TempHumiditySensor{
|
|
||||||
Name: s.Name,
|
|
||||||
TempF: s.TempF,
|
|
||||||
Humidity: util.Int32ptr(s.Humidity),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return slices.Clip(pbSensors)
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
package ambientgrpc
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
|
||||||
"k8s.io/utils/ptr"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
var now = time.Now()
|
|
||||||
|
|
||||||
var mockUpdate = &weather.WeatherUpdate{
|
|
||||||
DateUTC: &now,
|
|
||||||
StationConfig: &config.WeatherStation{
|
|
||||||
Name: "50W",
|
|
||||||
Equipment: "WS-5000",
|
|
||||||
},
|
|
||||||
StationID: ptr.To("50W"),
|
|
||||||
StationType: ptr.To("WS-5000"),
|
|
||||||
TempOutdoorF: ptr.To(97.6),
|
|
||||||
TempIndoorF: ptr.To(77.6),
|
|
||||||
HumidityOudoor: ptr.To(50),
|
|
||||||
HumidityIndoor: ptr.To(50),
|
|
||||||
WindSpeedMPH: ptr.To(20.5),
|
|
||||||
WindGustMPH: ptr.To(30.5),
|
|
||||||
MaxDailyGust: ptr.To(40.0),
|
|
||||||
WindDir: ptr.To(180),
|
|
||||||
WindDirAvg10m: ptr.To(180),
|
|
||||||
UV: nil,
|
|
||||||
SolarRadiation: ptr.To(9.999),
|
|
||||||
HourlyRainIn: ptr.To(9.999),
|
|
||||||
EventRainIn: ptr.To(9.999),
|
|
||||||
DailyRainIn: ptr.To(9.999),
|
|
||||||
WeeklyRainIn: ptr.To(9.999),
|
|
||||||
MonthlyRainIn: ptr.To(9.999),
|
|
||||||
YearlyRainIn: ptr.To(9.999),
|
|
||||||
TotalRainIn: ptr.To(9.999),
|
|
||||||
Batteries: []weather.BatteryStatus{
|
|
||||||
{Component: "battery1", Status: ptr.To(1)},
|
|
||||||
{Component: "battery2", Status: ptr.To(1)},
|
|
||||||
},
|
|
||||||
BaromRelativeIn: ptr.To(9.999),
|
|
||||||
BaromAbsoluteIn: ptr.To(9.999),
|
|
||||||
DewPointF: ptr.To(9.999),
|
|
||||||
WindChillF: ptr.To(9.999),
|
|
||||||
TempHumiditySensors: []*weather.TempHumiditySensor{
|
|
||||||
{Name: "sensor1", TempF: ptr.To(99.999), Humidity: nil},
|
|
||||||
},
|
|
||||||
LightningDay: ptr.To(1),
|
|
||||||
LightningDistance: ptr.To(20),
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestUpdateToPbUpdate(t *testing.T) {
|
|
||||||
type args struct {
|
|
||||||
u *weather.WeatherUpdate
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
args args
|
|
||||||
want *pb.WeatherUpdate
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Map Update to PB",
|
|
||||||
args: args{u: mockUpdate},
|
|
||||||
want: &pb.WeatherUpdate{
|
|
||||||
StationName: mockUpdate.StationConfig.Name,
|
|
||||||
StationType: *mockUpdate.StationType,
|
|
||||||
StationId: *mockUpdate.StationID,
|
|
||||||
TempOutdoorF: mockUpdate.TempOutdoorF,
|
|
||||||
TempIndoorF: mockUpdate.TempIndoorF,
|
|
||||||
HumidityOutdoor: ptr.To(int32(*mockUpdate.HumidityOudoor)),
|
|
||||||
HumidityIndoor: ptr.To(int32(*mockUpdate.HumidityIndoor)),
|
|
||||||
WindSpeedMph: mockUpdate.WindSpeedMPH,
|
|
||||||
WindGustMph: mockUpdate.WindGustMPH,
|
|
||||||
MaxDailyGust: mockUpdate.MaxDailyGust,
|
|
||||||
WindDir: ptr.To(int32(*mockUpdate.WindDir)),
|
|
||||||
WindDirAvg_10M: ptr.To(int32(*mockUpdate.WindDirAvg10m)),
|
|
||||||
Uv: nil,
|
|
||||||
SolarRadiation: mockUpdate.SolarRadiation,
|
|
||||||
HourlyRainIn: mockUpdate.HourlyRainIn,
|
|
||||||
EventRainIn: mockUpdate.EventRainIn,
|
|
||||||
DailyRainIn: mockUpdate.DailyRainIn,
|
|
||||||
WeeklyRainIn: mockUpdate.WeeklyRainIn,
|
|
||||||
MonthlyRainIn: mockUpdate.MonthlyRainIn,
|
|
||||||
YearlyRainIn: mockUpdate.YearlyRainIn,
|
|
||||||
TotalRainIn: mockUpdate.TotalRainIn,
|
|
||||||
Batteries: []*pb.BatteryStatus{
|
|
||||||
{Component: mockUpdate.Batteries[0].Component, Status: ptr.To(int32(*mockUpdate.Batteries[0].Status))},
|
|
||||||
{Component: mockUpdate.Batteries[1].Component, Status: ptr.To(int32(*mockUpdate.Batteries[1].Status))},
|
|
||||||
},
|
|
||||||
BaromRelativeIn: mockUpdate.BaromRelativeIn,
|
|
||||||
BaromAbsoluteIn: mockUpdate.BaromAbsoluteIn,
|
|
||||||
DewPointF: mockUpdate.DewPointF,
|
|
||||||
WindChillF: mockUpdate.WindChillF,
|
|
||||||
TempHumiditySensors: []*pb.TempHumiditySensor{
|
|
||||||
{
|
|
||||||
Name: mockUpdate.TempHumiditySensors[0].Name,
|
|
||||||
TempF: mockUpdate.TempHumiditySensors[0].TempF,
|
|
||||||
Humidity: nil,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
UpdateTimestamp: timestamppb.New(now),
|
|
||||||
LightningDay: ptr.To(int32(1)),
|
|
||||||
LightningDistance: ptr.To(int32(20)),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
if got := UpdateToPbUpdate(tt.args.u); !reflect.DeepEqual(got, tt.want) {
|
|
||||||
t.Errorf("UpdateToPbUpdate() = %v, want %v", got, tt.want)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package ambient
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (aw *AmbientWeather) GetGatewayOpts() []runtime.ServeMuxOption {
|
|
||||||
return []runtime.ServeMuxOption{
|
|
||||||
runtime.WithErrorHandler(func(ctx context.Context, sm *runtime.ServeMux, m runtime.Marshaler, w http.ResponseWriter, req *http.Request, err error) {
|
|
||||||
aw.GetLogger().Err(err).Msg("error handling gateway request")
|
|
||||||
runtime.DefaultHTTPErrorHandler(ctx, sm, m, w, req, err)
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,25 +6,24 @@ import (
|
|||||||
|
|
||||||
// This configuration includes all config from go-app/config.AppConfig
|
// This configuration includes all config from go-app/config.AppConfig
|
||||||
type AmbientLocalExporterConfig struct {
|
type AmbientLocalExporterConfig struct {
|
||||||
MetricPrefix string `yaml:"metricPrefix" default:"weather" env:"AMBIENT_METRIC_PREFIX" json:"metricPrefix,omitempty"`
|
MetricPrefix string `yaml:"metricPrefix" default:"weather" env:"AMBIENT_METRIC_PREFIX"`
|
||||||
UpdatesToKeep *int `yaml:"updatesToKeep" default:"1" env:"AMBIENT_UPDATES_TO_KEEP" json:"updatesToKeep,omitempty"`
|
UpdatesToKeep *int `yaml:"updatesToKeep" default:"1" env:"AMBIENT_UPDATES_TO_KEEP"`
|
||||||
WeatherStations []WeatherStation `yaml:"weatherStations" json:"weatherStations,omitempty"` // No env, too complex, not worth the time
|
WeatherStations []WeatherStation `yaml:"weatherStations" env:"weatherStations"` // No env, too complex, not worth the time
|
||||||
RecorderConfig *RecorderConfig `yaml:"recorderConfig" json:"recorderConfig,omitempty"`
|
|
||||||
*config.AppConfig // Extends app config
|
*config.AppConfig // Extends app config
|
||||||
}
|
}
|
||||||
|
|
||||||
type WeatherStation struct {
|
type WeatherStation struct {
|
||||||
Name string `yaml:"name" json:"name,omitempty"` // Human Friendly Name (e.g. Back Yard Weather)
|
Name string `yaml:"name"` // Human Friendly Name (e.g. Back Yard Weather)
|
||||||
Equipment string `yaml:"equipment" json:"equipment,omitempty"` // Equipment Type (e.g. WS-5000)
|
Equipment string `yaml:"equipment"` // Equipment Type (e.g. WS-5000)
|
||||||
|
|
||||||
// Required if proxying to awn/wu is enabled
|
// Required if proxying to awn/wu is enabled
|
||||||
WundergroundID string `yaml:"wundergroundID" json:"wundergroundID,omitempty"`
|
WundergroundID string `yaml:"wundergroundID"`
|
||||||
WundergroundPassword string `yaml:"wundergroundPassword" json:"wundergroundPassword,omitempty"`
|
WundergroundPassword string `yaml:"wundergroundPassword"`
|
||||||
AWNPassKey string `yaml:"awnPassKey" json:"awnPassKey,omitempty"`
|
AWNPassKey string `yaml:"awnPassKey"`
|
||||||
|
|
||||||
// Proxy updates to AWN or Wunderground
|
// Proxy updates to AWN or Wunderground
|
||||||
ProxyToAWN bool `yaml:"proxyToAWN" json:"proxyToAWN,omitempty"`
|
ProxyToAWN bool `yaml:"proxyToAWN"`
|
||||||
ProxyToWunderground bool `yaml:"proxyToWunderground" json:"proxyToWunderground,omitempty"`
|
ProxyToWunderground bool `yaml:"proxyToWunderground"`
|
||||||
|
|
||||||
// Unreliable / unwanted metrics by name of WeatherUpdate Field
|
// Unreliable / unwanted metrics by name of WeatherUpdate Field
|
||||||
// will be excluded if present in discardMetrics
|
// will be excluded if present in discardMetrics
|
||||||
@ -33,8 +32,8 @@ type WeatherStation struct {
|
|||||||
// ignoring discardMetrics.
|
// ignoring discardMetrics.
|
||||||
//
|
//
|
||||||
// Check weather.WeatherUpdateField for options
|
// Check weather.WeatherUpdateField for options
|
||||||
KeepMetrics []string `yaml:"keepMetrics" json:"keepMetrics,omitempty"`
|
KeepMetrics []string `yaml:"keepMetrics"`
|
||||||
DropMetrics []string `yaml:"dropMetrics" json:"dropMetrics,omitempty"`
|
DropMetrics []string `yaml:"dropMetrics"`
|
||||||
|
|
||||||
// Relabels battery and sensor names
|
// Relabels battery and sensor names
|
||||||
// Temp+Humidity Sensors:
|
// Temp+Humidity Sensors:
|
||||||
@ -44,5 +43,5 @@ type WeatherStation struct {
|
|||||||
// - OutdoorSensor
|
// - OutdoorSensor
|
||||||
// - RainSensor
|
// - RainSensor
|
||||||
// - CO2Sensor
|
// - CO2Sensor
|
||||||
SensorMappings map[string]string `yaml:"sensorMappings" json:"sensorMappings,omitempty"`
|
SensorMappings map[string]string `yaml:"sensorMappings"`
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package config
|
|
||||||
|
|
||||||
type RecorderType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
TypeMemory RecorderType = "memory" // Stores weather updates in memory
|
|
||||||
TypeRedis RecorderType = "redis" // Required for replicas > 1
|
|
||||||
TypeNoop RecorderType = "noop" // No-op implementation
|
|
||||||
)
|
|
||||||
|
|
||||||
type RecorderConfig struct {
|
|
||||||
Type RecorderType `yaml:"type" env:"RECORDER_TYPE" json:"type,omitempty" enum:"memory,redis,noop"`
|
|
||||||
KeepLast int `yaml:"keepLast" env:"RECORDER_KEEP_LAST" json:"keepLast,omitempty" default:"120"`
|
|
||||||
RedisConfig *RedisConfig `yaml:"redisConfig,omitempty" json:"redisConfig,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RedisConfig struct {
|
|
||||||
RedisHost string `yaml:"redisHost" env:"REDIS_HOST" default:"127.0.0.1" json:"redisHost,omitempty"`
|
|
||||||
RedisPort int `yaml:"redisPort" env:"REDIS_PORT" default:"6379" json:"redisPort,omitempty"`
|
|
||||||
RedisUser string `yaml:"redisUser" env:"REDIS_USER" json:"redisUser,omitempty"`
|
|
||||||
RedisPassword string `yaml:"redisPassword" env:"REDIS_PASSWORD" json:"redisPassword,omitempty"`
|
|
||||||
RedisDB int `yaml:"redisDB" env:"REDIS_DB" default:"0" json:"redisDB,omitempty"`
|
|
||||||
RedisTLS bool `yaml:"redisTLS" env:"REDIS_TLS" default:"false" json:"redisTLS,omitempty"`
|
|
||||||
RedisTLSInsecure bool `yaml:"redisTLSInsecure" env:"REDIS_TLS_INSECURE" default:"false" json:"redisTLSInsecure,omitempty"`
|
|
||||||
RedisKeyTTL string `yaml:"redisKeyTTL" env:"REDIS_KEY_TTL" default:"24h" json:"redisKeyTTL,omitempty"`
|
|
||||||
}
|
|
@ -20,12 +20,11 @@ const (
|
|||||||
|
|
||||||
// Battery Sensors
|
// Battery Sensors
|
||||||
const (
|
const (
|
||||||
BattOutdoorSensor = "OutdoorSensor"
|
BattOutdoorSensor = "OutdoorSensor"
|
||||||
BattIndoorSensor = "IndoorSensor"
|
BattIndoorSensor = "IndoorSensor"
|
||||||
BattRainSensor = "RainSensor"
|
BattRainSensor = "RainSensor"
|
||||||
BattCO2Sensor = "CO2Sensor"
|
BattCO2Sensor = "CO2Sensor"
|
||||||
BattLightningSensor = "LightningSensor"
|
THSensor = "TempHumiditySensor"
|
||||||
THSensor = "TempHumiditySensor"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (awn *AWNProvider) Name() string {
|
func (awn *AWNProvider) Name() string {
|
||||||
@ -75,10 +74,6 @@ func MapAwnUpdate(awnUpdate *AmbientWeatherUpdate) *weather.WeatherUpdate {
|
|||||||
YearlyRainIn: awnUpdate.YearlyRainIn,
|
YearlyRainIn: awnUpdate.YearlyRainIn,
|
||||||
TotalRainIn: awnUpdate.TotalRainIn,
|
TotalRainIn: awnUpdate.TotalRainIn,
|
||||||
Batteries: []weather.BatteryStatus{
|
Batteries: []weather.BatteryStatus{
|
||||||
{
|
|
||||||
Component: BattLightningSensor,
|
|
||||||
Status: awnUpdate.BattLightning,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Component: BattOutdoorSensor,
|
Component: BattOutdoorSensor,
|
||||||
Status: awnUpdate.BattOut,
|
Status: awnUpdate.BattOut,
|
||||||
@ -143,9 +138,6 @@ func MapAwnUpdate(awnUpdate *AmbientWeatherUpdate) *weather.WeatherUpdate {
|
|||||||
{Name: THSensor + "7", TempF: awnUpdate.Temp7F, Humidity: awnUpdate.Humidity7},
|
{Name: THSensor + "7", TempF: awnUpdate.Temp7F, Humidity: awnUpdate.Humidity7},
|
||||||
{Name: THSensor + "8", TempF: awnUpdate.Temp8F, Humidity: awnUpdate.Humidity8},
|
{Name: THSensor + "8", TempF: awnUpdate.Temp8F, Humidity: awnUpdate.Humidity8},
|
||||||
},
|
},
|
||||||
LightningDay: awnUpdate.LightningDay,
|
|
||||||
LightningDistance: awnUpdate.LightningDistance,
|
|
||||||
LightningLastTime: awnUpdate.LightningLastTime,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,8 +145,6 @@ func UnmarshalQueryParams(query url.Values) (*AmbientWeatherUpdate, error) {
|
|||||||
update := new(AmbientWeatherUpdate)
|
update := new(AmbientWeatherUpdate)
|
||||||
|
|
||||||
decoder := schema.NewDecoder()
|
decoder := schema.NewDecoder()
|
||||||
decoder.IgnoreUnknownKeys(true)
|
|
||||||
|
|
||||||
if err := decoder.Decode(update, query); err != nil {
|
if err := decoder.Decode(update, query); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,6 @@ type AmbientWeatherUpdate struct {
|
|||||||
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
|
*AmbientTempHumiditySensors
|
||||||
*AmbientLightningData
|
|
||||||
}
|
|
||||||
|
|
||||||
type AmbientLightningData struct {
|
|
||||||
BattLightning *int `json:"batt_lightning,omitempty" schema:"batt_lightning"`
|
|
||||||
LightningDay *int `json:"lightning_day,omitempty" schema:"lightning_day" description:"count of lightning detections"`
|
|
||||||
LightningDistance *int `json:"lightning_distance,omitempty" schema:"lightning_distance" description:"distance in kilometers"`
|
|
||||||
LightningLastTime *int `json:"lightning_time,omitempty" schema:"lightning_time" description:"last lightning detection time"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AmbientTempHumiditySensors struct {
|
type AmbientTempHumiditySensors struct {
|
||||||
|
118
pkg/util/util.go
118
pkg/util/util.go
@ -1,118 +0,0 @@
|
|||||||
package util
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/md5"
|
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
|
||||||
"slices"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
|
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
|
||||||
"k8s.io/utils/ptr"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
const defaultLimit = -1
|
|
||||||
|
|
||||||
func DerefStr(s *string) string {
|
|
||||||
if s == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return *s
|
|
||||||
}
|
|
||||||
|
|
||||||
func Int32ptr(i *int) *int32 {
|
|
||||||
if i == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return ptr.To(int32(*i))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TimestampFromIntPtr(i *int) *timestamppb.Timestamp {
|
|
||||||
if i == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return timestamppb.New(time.Unix(int64(*i), 0))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generates a hash that will be consistent
|
|
||||||
// across all running replicas
|
|
||||||
func GetAppHash(conf *config.AppConfig) string {
|
|
||||||
hashName := fmt.Sprintf("%s-%s-%s",
|
|
||||||
conf.Name,
|
|
||||||
conf.Environment,
|
|
||||||
conf.Version,
|
|
||||||
)
|
|
||||||
|
|
||||||
hash := md5.Sum([]byte(hashName))
|
|
||||||
return hex.EncodeToString(hash[:])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a limit from req, applying a default if unset or not sane
|
|
||||||
func GetLimitFromReq(req *pb.GetWeatherRequest) int {
|
|
||||||
if req == nil || req.Limit == nil {
|
|
||||||
return defaultLimit
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.GetLimit() == 0 {
|
|
||||||
return defaultLimit
|
|
||||||
}
|
|
||||||
|
|
||||||
return int(req.GetLimit())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simple helper to trim a list of updates
|
|
||||||
func LimitUpdates(updates []*weather.WeatherUpdate, limit int) []*weather.WeatherUpdate {
|
|
||||||
if limit < 0 {
|
|
||||||
return updates // No limit
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(updates) > limit {
|
|
||||||
return updates[len(updates)-limit:] // Trim to limit
|
|
||||||
}
|
|
||||||
|
|
||||||
return updates // Within limit
|
|
||||||
}
|
|
||||||
|
|
||||||
func ApplyOptsToUpdates(updates []*weather.WeatherUpdate, limit int, opts *pb.GetWeatherOpts) []*weather.WeatherUpdate {
|
|
||||||
if opts == nil {
|
|
||||||
return updates
|
|
||||||
} else if opts.StationName == nil && opts.StationType == nil {
|
|
||||||
return updates
|
|
||||||
}
|
|
||||||
|
|
||||||
capacity := len(updates)
|
|
||||||
if limit > 0 {
|
|
||||||
capacity = limit
|
|
||||||
}
|
|
||||||
|
|
||||||
filtered := make([]*weather.WeatherUpdate, 0, capacity)
|
|
||||||
|
|
||||||
for i := len(updates) - 1; i >= 0; i-- {
|
|
||||||
update := updates[i]
|
|
||||||
match := true
|
|
||||||
|
|
||||||
if opts.GetStationName() != "" {
|
|
||||||
if update.GetStationName() != opts.GetStationName() {
|
|
||||||
match = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if opts.GetStationType() != "" {
|
|
||||||
if DerefStr(update.StationType) != opts.GetStationType() {
|
|
||||||
match = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if match {
|
|
||||||
filtered = append(filtered, update)
|
|
||||||
if limit > 0 && len(filtered) >= limit {
|
|
||||||
return slices.Clip(filtered)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return slices.Clip(filtered)
|
|
||||||
}
|
|
85
pkg/weather/grpc/mapupdate.go
Normal file
85
pkg/weather/grpc/mapupdate.go
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
package grpc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/utils/ptr"
|
||||||
|
|
||||||
|
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdatesToPbUpdates(u []*weather.WeatherUpdate) []*pb.WeatherUpdate {
|
||||||
|
updates := make([]*pb.WeatherUpdate, len(u))
|
||||||
|
for i, update := range u {
|
||||||
|
updates[i] = UpdateToPbUpdate(update)
|
||||||
|
}
|
||||||
|
return updates
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateToPbUpdate(u *weather.WeatherUpdate) *pb.WeatherUpdate {
|
||||||
|
return &pb.WeatherUpdate{
|
||||||
|
StationName: u.StationConfig.Name,
|
||||||
|
StationType: derefStr(u.StationType),
|
||||||
|
StationId: derefStr(u.StationID),
|
||||||
|
TempOutdoorF: u.TempOutdoorF,
|
||||||
|
TempIndoorF: u.TempIndoorF,
|
||||||
|
HumidityOutdoor: int32ptr(u.HumidityOudoor),
|
||||||
|
HumidityIndoor: int32ptr(u.HumidityIndoor),
|
||||||
|
WindSpeedMph: u.WindSpeedMPH,
|
||||||
|
WindGustMph: u.WindGustMPH,
|
||||||
|
MaxDailyGust: u.MaxDailyGust,
|
||||||
|
WindDir: int32ptr(u.WindDir),
|
||||||
|
WindDirAvg_10M: int32ptr(u.WindDirAvg10m),
|
||||||
|
Uv: int32ptr(u.UV),
|
||||||
|
SolarRadiation: u.SolarRadiation,
|
||||||
|
HourlyRainIn: u.HourlyRainIn,
|
||||||
|
EventRainIn: u.EventRainIn,
|
||||||
|
DailyRainIn: u.DailyRainIn,
|
||||||
|
WeeklyRainIn: u.WeeklyRainIn,
|
||||||
|
MonthlyRainIn: u.MonthlyRainIn,
|
||||||
|
YearlyRainIn: u.YearlyRainIn,
|
||||||
|
TotalRainIn: u.TotalRainIn,
|
||||||
|
Batteries: batteriesToPbBatteries(u.Batteries),
|
||||||
|
BaromRelativeIn: u.BaromRelativeIn,
|
||||||
|
BaromAbsoluteIn: u.BaromAbsoluteIn,
|
||||||
|
DewPointF: u.DewPointF,
|
||||||
|
WindChillF: u.WindChillF,
|
||||||
|
TempHumiditySensors: thSensorsToPbSensors(u.TempHumiditySensors),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func batteriesToPbBatteries(batteries []weather.BatteryStatus) []*pb.BatteryStatus {
|
||||||
|
pbBatteries := make([]*pb.BatteryStatus, len(batteries))
|
||||||
|
for i, b := range batteries {
|
||||||
|
pbBatteries[i] = &pb.BatteryStatus{
|
||||||
|
Component: b.Component,
|
||||||
|
Status: int32ptr(b.Status),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pbBatteries
|
||||||
|
}
|
||||||
|
|
||||||
|
func thSensorsToPbSensors(sensors []*weather.TempHumiditySensor) []*pb.TempHumiditySensor {
|
||||||
|
pbSensors := make([]*pb.TempHumiditySensor, len(sensors))
|
||||||
|
for i, s := range sensors {
|
||||||
|
pbSensors[i] = &pb.TempHumiditySensor{
|
||||||
|
Name: s.Name,
|
||||||
|
TempF: s.TempF,
|
||||||
|
Humidity: int32ptr(s.Humidity),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pbSensors
|
||||||
|
}
|
||||||
|
|
||||||
|
func derefStr(s *string) string {
|
||||||
|
if s == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *s
|
||||||
|
}
|
||||||
|
|
||||||
|
func int32ptr(i *int) *int32 {
|
||||||
|
if i == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return ptr.To(int32(*i))
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package ambientgrpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -9,50 +9,28 @@ import (
|
|||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
"k8s.io/utils/ptr"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder"
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/state"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GRPCWeather struct {
|
type GRPCWeather struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
recorder *recorder.WeatherRecorder
|
state *state.WeatherState
|
||||||
tracer trace.Tracer
|
tracer trace.Tracer
|
||||||
*pb.UnimplementedAmbientLocalWeatherServiceServer
|
*pb.UnimplementedAmbientLocalWeatherServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGRPCWeather(ctx context.Context, recorder *recorder.WeatherRecorder) *GRPCWeather {
|
func NewGRPCWeather(ctx context.Context, state *state.WeatherState) *GRPCWeather {
|
||||||
return &GRPCWeather{
|
return &GRPCWeather{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
recorder: recorder,
|
state: state,
|
||||||
tracer: otel.GetTracer(ctx, "grpcWeather"),
|
tracer: otel.GetTracer(ctx, "grpcWeather"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *GRPCWeather) CountWeatherUpdates(ctx context.Context, req *pb.CountWeatherUpdatesRequest) (
|
|
||||||
*pb.CountWeatherUpdatesResponse, error,
|
|
||||||
) {
|
|
||||||
if req.Opts == nil {
|
|
||||||
count := w.recorder.Count(ctx)
|
|
||||||
return &pb.CountWeatherUpdatesResponse{Count: int32(count)}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := w.GetWeather(ctx, &pb.GetWeatherRequest{
|
|
||||||
Opts: req.Opts,
|
|
||||||
Limit: ptr.To(int32(-1)),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return &pb.CountWeatherUpdatesResponse{
|
|
||||||
Count: int32(len(resp.WeatherUpdates)),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *GRPCWeather) GetWeather(ctx context.Context, req *pb.GetWeatherRequest) (
|
func (w *GRPCWeather) GetWeather(ctx context.Context, req *pb.GetWeatherRequest) (
|
||||||
*pb.GetWeatherResponse, error,
|
*pb.GetWeatherResponse, error,
|
||||||
) {
|
) {
|
||||||
@ -68,13 +46,13 @@ func (w *GRPCWeather) GetWeather(ctx context.Context, req *pb.GetWeatherRequest)
|
|||||||
|
|
||||||
span.SetAttributes(attribute.Int("limit", limit))
|
span.SetAttributes(attribute.Int("limit", limit))
|
||||||
|
|
||||||
updates, err := w.recorder.Get(ctx, req)
|
updates, err := w.state.Get(ctx, limit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
span.RecordError(err)
|
span.RecordError(err)
|
||||||
span.SetStatus(otelcodes.Error, err.Error())
|
span.SetStatus(otelcodes.Error, err.Error())
|
||||||
return nil, status.Error(codes.Internal, err.Error())
|
return nil, status.Errorf(codes.Internal, err.Error())
|
||||||
} else if len(updates) < 1 {
|
} else if len(updates) < 1 {
|
||||||
return nil, status.Error(codes.OutOfRange, "no weather available")
|
return nil, status.Errorf(codes.OutOfRange, "no weather available")
|
||||||
}
|
}
|
||||||
|
|
||||||
span.SetStatus(otelcodes.Ok, "")
|
span.SetStatus(otelcodes.Ok, "")
|
@ -37,11 +37,6 @@ type WeatherMetrics struct {
|
|||||||
DewPointF metric.Float64Gauge
|
DewPointF metric.Float64Gauge
|
||||||
WindChillF metric.Float64Gauge
|
WindChillF metric.Float64Gauge
|
||||||
|
|
||||||
// Lightning Sensor
|
|
||||||
LightningCountDay metric.Int64Gauge
|
|
||||||
LightningLastDistance metric.Int64Gauge
|
|
||||||
LightningLastTime metric.Int64Gauge
|
|
||||||
|
|
||||||
// Temp and Humidity Sensors
|
// Temp and Humidity Sensors
|
||||||
SensorTempF metric.Float64Gauge
|
SensorTempF metric.Float64Gauge
|
||||||
SensorHumidity metric.Int64Gauge
|
SensorHumidity metric.Int64Gauge
|
||||||
@ -80,10 +75,6 @@ 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})
|
||||||
|
|
||||||
wm.recorder.Record(&RecordOpts{Int64Gauge: wm.LightningLastDistance, IntVal: u.LightningDistance, Field: FieldLightningDistance, Attributes: attributes, Station: u.StationConfig})
|
|
||||||
wm.recorder.Record(&RecordOpts{Int64Gauge: wm.LightningCountDay, IntVal: u.LightningDay, Field: FieldLightningDay, Attributes: attributes, Station: u.StationConfig})
|
|
||||||
wm.recorder.Record(&RecordOpts{Int64Gauge: wm.LightningLastTime, IntVal: u.LightningLastTime, Field: FieldLightningLastTime, Attributes: attributes, Station: u.StationConfig})
|
|
||||||
|
|
||||||
wm.RecordBatteries(u, attributes)
|
wm.RecordBatteries(u, attributes)
|
||||||
wm.RecordTempHumiditySensors(u, attributes)
|
wm.RecordTempHumiditySensors(u, attributes)
|
||||||
|
|
||||||
|
@ -66,16 +66,6 @@ func MustInitMetrics(appCtx context.Context) *WeatherMetrics {
|
|||||||
wm.WindChillF, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_chill_f",
|
wm.WindChillF, _ = wm.meter.Float64Gauge(MetricPrefix+"_wind_chill_f",
|
||||||
metric.WithDescription("Wind Chill in Faherenheit"))
|
metric.WithDescription("Wind Chill in Faherenheit"))
|
||||||
|
|
||||||
// Lightning Sensor
|
|
||||||
wm.LightningCountDay, _ = wm.meter.Int64Gauge(MetricPrefix+"_lightning_day",
|
|
||||||
metric.WithDescription("Count of lightning strikes for current day"))
|
|
||||||
wm.LightningLastDistance, _ = wm.meter.Int64Gauge(MetricPrefix+"_lightning_last_distance",
|
|
||||||
metric.WithDescription("Last measured lightning distance"),
|
|
||||||
metric.WithUnit("km"))
|
|
||||||
wm.LightningLastTime, _ = wm.meter.Int64Gauge(MetricPrefix+"_lightning_last_time",
|
|
||||||
metric.WithDescription("Last lightning time (epoch)"),
|
|
||||||
metric.WithUnit("s"))
|
|
||||||
|
|
||||||
// Temp and Humidity Sensors
|
// Temp and Humidity Sensors
|
||||||
wm.SensorTempF, _ = wm.meter.Float64Gauge(MetricPrefix+"_sensor_temp_f",
|
wm.SensorTempF, _ = wm.meter.Float64Gauge(MetricPrefix+"_sensor_temp_f",
|
||||||
metric.WithDescription("Temperature Sensor in Faherenheit"))
|
metric.WithDescription("Temperature Sensor in Faherenheit"))
|
||||||
|
@ -3,7 +3,6 @@ package weather
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"slices"
|
|
||||||
|
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
@ -20,7 +19,6 @@ type MetricRecorder struct {
|
|||||||
type RecordOpts struct {
|
type RecordOpts struct {
|
||||||
Float64Gauge metric.Float64Gauge
|
Float64Gauge metric.Float64Gauge
|
||||||
Int64Gauge metric.Int64Gauge
|
Int64Gauge metric.Int64Gauge
|
||||||
Int64Counter metric.Int64Counter
|
|
||||||
IntVal *int
|
IntVal *int
|
||||||
FloatVal *float64
|
FloatVal *float64
|
||||||
Attributes []attribute.KeyValue
|
Attributes []attribute.KeyValue
|
||||||
@ -60,39 +58,26 @@ func (r *MetricRecorder) Record(opts *RecordOpts) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
r.recordFloat(opts.Float64Gauge, *opts.FloatVal, opts.Attributes...)
|
r.recordFloat(opts.Float64Gauge, *opts.FloatVal, opts.Attributes...)
|
||||||
} else if opts.Int64Counter != nil {
|
|
||||||
if opts.IntVal == nil {
|
|
||||||
log := r.l.Trace().Str("field", string(opts.Field))
|
|
||||||
if opts.Station != nil {
|
|
||||||
log = log.Str("station", opts.Station.Name)
|
|
||||||
}
|
|
||||||
log.Msg("Dropping nil float metric")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
r.recordCounter(opts.Int64Counter, *opts.IntVal, opts.Attributes...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *RecordOpts) keep() bool {
|
func (o *RecordOpts) keep() bool {
|
||||||
// If keep fields are given, only check keep fields
|
// If keep fields are given, only check keep fields
|
||||||
if len(o.Station.KeepMetrics) > 0 {
|
if len(o.Station.KeepMetrics) > 0 {
|
||||||
return slices.Contains(o.Station.KeepMetrics, o.Field)
|
for _, f := range o.Station.KeepMetrics {
|
||||||
|
if f == o.Field {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return !slices.Contains(o.Station.DropMetrics, o.Field)
|
for _, f := range o.Station.DropMetrics {
|
||||||
}
|
if f == o.Field {
|
||||||
|
return false
|
||||||
func (r *MetricRecorder) recordCounter(
|
}
|
||||||
m metric.Int64Counter, value int, attributes ...attribute.KeyValue,
|
|
||||||
) {
|
|
||||||
// Prepare metric attributes
|
|
||||||
options := make([]metric.AddOption, 0, len(attributes))
|
|
||||||
if len(attributes) > 0 {
|
|
||||||
options = append(options, metric.WithAttributes(attributes...))
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
val := int64(value)
|
|
||||||
m.Add(r.ctx, val, options...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *MetricRecorder) recordInt(
|
func (r *MetricRecorder) recordInt(
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package recorder
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/rs/zerolog"
|
|
||||||
"go.opentelemetry.io/otel/metric"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders"
|
|
||||||
)
|
|
||||||
|
|
||||||
type WeatherRecorder struct {
|
|
||||||
recorder recorders.Recorder
|
|
||||||
ctx context.Context
|
|
||||||
tracer trace.Tracer
|
|
||||||
meter metric.Meter
|
|
||||||
*sync.RWMutex
|
|
||||||
}
|
|
||||||
|
|
||||||
type Opts struct {
|
|
||||||
AppConfig *config.AmbientLocalExporterConfig
|
|
||||||
Ctx context.Context
|
|
||||||
Recorder recorders.Recorder // If nil, will use memory recorder
|
|
||||||
KeepLast int
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *WeatherRecorder) Ping(ctx context.Context) error {
|
|
||||||
return r.recorder.Ping(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func MustNewWeatherRecorder(opts *Opts) *WeatherRecorder {
|
|
||||||
if opts.KeepLast < 1 {
|
|
||||||
opts.KeepLast = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.Recorder == nil {
|
|
||||||
panic("no recorder provided")
|
|
||||||
}
|
|
||||||
|
|
||||||
opts.Recorder.Init(opts.Ctx, &recorders.RecorderOpts{
|
|
||||||
AppConfig: opts.AppConfig,
|
|
||||||
RetainLast: opts.KeepLast,
|
|
||||||
BaseCtx: opts.Ctx,
|
|
||||||
})
|
|
||||||
|
|
||||||
zerolog.Ctx(opts.Ctx).Info().Str("recorderType", opts.Recorder.Name()).
|
|
||||||
Msg("weather update recorder ready")
|
|
||||||
|
|
||||||
return &WeatherRecorder{
|
|
||||||
ctx: opts.Ctx,
|
|
||||||
recorder: opts.Recorder,
|
|
||||||
tracer: otel.GetTracer(opts.Ctx, "weatherRecorder"),
|
|
||||||
meter: otel.GetMeter(opts.Ctx, "weatherRecorder"),
|
|
||||||
RWMutex: &sync.RWMutex{},
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
package recorder
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
"k8s.io/utils/ptr"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Returns last requested number of weather updates
|
|
||||||
// If negative number given, will return all weather observations
|
|
||||||
func (w *WeatherRecorder) Get(ctx context.Context, req *pb.GetWeatherRequest) (
|
|
||||||
[]*weather.WeatherUpdate, error,
|
|
||||||
) {
|
|
||||||
if req == nil {
|
|
||||||
req = &pb.GetWeatherRequest{Limit: ptr.To(int32(-1))}
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Limit == nil || *req.Limit < 0 {
|
|
||||||
req.Limit = ptr.To(int32(-1))
|
|
||||||
} else if *req.Limit == 0 {
|
|
||||||
req.Limit = ptr.To(int32(1))
|
|
||||||
}
|
|
||||||
|
|
||||||
var filterSN, filterST string
|
|
||||||
if req.Opts != nil {
|
|
||||||
filterSN = req.Opts.GetStationName()
|
|
||||||
filterST = req.Opts.GetStationType()
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, span := w.tracer.Start(ctx, "getWeatherRecorder")
|
|
||||||
span.SetAttributes(
|
|
||||||
attribute.String("stationNameFilter", filterSN),
|
|
||||||
attribute.String("stationTypeFilter", filterST),
|
|
||||||
attribute.Int("last", int(*req.Limit)),
|
|
||||||
attribute.Int("currentSize", w.Count(ctx)),
|
|
||||||
)
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
updates, err := w.recorder.Get(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, err.Error())
|
|
||||||
} else {
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
return updates, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns count of retained weather updates
|
|
||||||
func (w *WeatherRecorder) Count(ctx context.Context) int {
|
|
||||||
ctx, span := w.tracer.Start(ctx, "countWeatherRecorder")
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
count := w.recorder.Count(ctx)
|
|
||||||
span.SetAttributes(attribute.Int("count", count))
|
|
||||||
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
return count
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package recorder
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/util"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (w *WeatherRecorder) Set(ctx context.Context, u *weather.WeatherUpdate) error {
|
|
||||||
if u.StationConfig == nil {
|
|
||||||
u.StationConfig = &config.WeatherStation{
|
|
||||||
Name: "unregistered",
|
|
||||||
Equipment: "unknown",
|
|
||||||
ProxyToAWN: false,
|
|
||||||
ProxyToWunderground: false,
|
|
||||||
KeepMetrics: []string{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, span := w.tracer.Start(ctx, "setRecorderUpdate", trace.WithAttributes(
|
|
||||||
attribute.String("stationName", u.StationConfig.Name),
|
|
||||||
attribute.String("stationType", util.DerefStr(u.StationType)),
|
|
||||||
attribute.String("stationEquipment", u.StationConfig.Equipment),
|
|
||||||
))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
return w.recorder.Set(ctx, u)
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package memory
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) Count(ctx context.Context) int {
|
|
||||||
_, span := r.tracer.Start(ctx, "countWeatherRecorder")
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
count := r.count()
|
|
||||||
|
|
||||||
span.SetAttributes(attribute.Int("count", count))
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
|
|
||||||
return count
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) count() int {
|
|
||||||
return len(r.updates)
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package memory
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/util"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) Get(ctx context.Context, req *pb.GetWeatherRequest) (
|
|
||||||
[]*weather.WeatherUpdate, error,
|
|
||||||
) {
|
|
||||||
_, span := r.tracer.Start(ctx, "memoryRecorder.Get")
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
r.RLock()
|
|
||||||
defer r.RUnlock()
|
|
||||||
|
|
||||||
span.AddEvent("acquired lock on recorder cache")
|
|
||||||
|
|
||||||
limit := util.GetLimitFromReq(req)
|
|
||||||
if r.count() == 0 {
|
|
||||||
err := errors.New("no recorded updates to get")
|
|
||||||
span.RecordError(err)
|
|
||||||
return nil, err
|
|
||||||
} else if limit > 0 && r.count() <= limit {
|
|
||||||
span.RecordError(errors.New("requested more updates than recorded"))
|
|
||||||
}
|
|
||||||
|
|
||||||
updates := r.getUpdatesFromReq(req)
|
|
||||||
span.AddEvent("request limit/opts applied to updates")
|
|
||||||
|
|
||||||
span.SetAttributes(attribute.Int("retrieved", len(updates)))
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
|
|
||||||
return updates, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) getUpdatesFromReq(req *pb.GetWeatherRequest) []*weather.WeatherUpdate {
|
|
||||||
if req.Opts == nil {
|
|
||||||
return util.LimitUpdates(r.updates, util.GetLimitFromReq(req))
|
|
||||||
}
|
|
||||||
|
|
||||||
return util.ApplyOptsToUpdates(r.updates, util.GetLimitFromReq(req), req.Opts)
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package memory
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
DEF_RETAIN_LAST = 120
|
|
||||||
NAME = "memory recorder"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MemoryRecorder struct {
|
|
||||||
baseCtx context.Context
|
|
||||||
updates []*weather.WeatherUpdate
|
|
||||||
tracer trace.Tracer
|
|
||||||
keep int
|
|
||||||
*sync.RWMutex
|
|
||||||
}
|
|
||||||
|
|
||||||
// No meaningful health check to do here
|
|
||||||
func (r *MemoryRecorder) Ping(ctx context.Context) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) Init(ctx context.Context, opts *recorders.RecorderOpts) {
|
|
||||||
if opts.RetainLast < 1 {
|
|
||||||
opts.RetainLast = DEF_RETAIN_LAST
|
|
||||||
}
|
|
||||||
|
|
||||||
r.updates = make([]*weather.WeatherUpdate, 0, opts.RetainLast)
|
|
||||||
r.keep = opts.RetainLast
|
|
||||||
r.baseCtx = opts.BaseCtx
|
|
||||||
r.RWMutex = &sync.RWMutex{}
|
|
||||||
r.tracer = otel.GetTracer(r.baseCtx, "memoryRecorder")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) Name() string { return NAME }
|
|
@ -1,38 +0,0 @@
|
|||||||
package memory
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) Set(ctx context.Context, u *weather.WeatherUpdate) error {
|
|
||||||
r.Lock()
|
|
||||||
defer r.Unlock()
|
|
||||||
|
|
||||||
ctx, span := r.tracer.Start(ctx, "memoryRecorder.Set")
|
|
||||||
span.SetAttributes(
|
|
||||||
attribute.Int("countWeatherUpdates", r.Count(ctx)),
|
|
||||||
attribute.Int("keepUpdates", r.keep),
|
|
||||||
)
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
return r.set(ctx, u)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *MemoryRecorder) set(ctx context.Context, u *weather.WeatherUpdate) error {
|
|
||||||
span := trace.SpanFromContext(ctx)
|
|
||||||
|
|
||||||
if len(r.updates) > r.keep {
|
|
||||||
r.updates = r.updates[1:]
|
|
||||||
span.AddEvent("trimmed recorded updates by 1")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.updates = append(r.updates, u)
|
|
||||||
span.AddEvent("recorded weather update")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package noop
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders"
|
|
||||||
)
|
|
||||||
|
|
||||||
type NoopRecorder struct{}
|
|
||||||
|
|
||||||
func (n *NoopRecorder) Init(context.Context, *recorders.RecorderOpts) {}
|
|
||||||
|
|
||||||
func (n *NoopRecorder) Set(context.Context, *weather.WeatherUpdate) error { return nil }
|
|
||||||
|
|
||||||
func (n *NoopRecorder) Get(context.Context, *pb.GetWeatherRequest) ([]*weather.WeatherUpdate, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *NoopRecorder) Count(context.Context) int { return 0 }
|
|
||||||
|
|
||||||
func (n *NoopRecorder) Ping(context.Context) error { return nil }
|
|
||||||
|
|
||||||
func (r *NoopRecorder) Name() string { return "no-op recorder" }
|
|
@ -1,24 +0,0 @@
|
|||||||
package recorders
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RecorderOpts struct {
|
|
||||||
RetainLast int
|
|
||||||
BaseCtx context.Context
|
|
||||||
AppConfig *config.AmbientLocalExporterConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type Recorder interface {
|
|
||||||
Init(context.Context, *RecorderOpts)
|
|
||||||
Set(context.Context, *weather.WeatherUpdate) error
|
|
||||||
Get(context.Context, *pb.GetWeatherRequest) ([]*weather.WeatherUpdate, error)
|
|
||||||
Count(context.Context) int // Best Effort
|
|
||||||
Ping(context.Context) error
|
|
||||||
Name() string
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package redis
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Count(ctx context.Context) int {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.count")
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
r.RLock()
|
|
||||||
defer r.RUnlock()
|
|
||||||
|
|
||||||
return r.count(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) count(ctx context.Context) int {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.count.redis", trace.WithAttributes(
|
|
||||||
attribute.String("updatesKey", r.Key())))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
count, err := r.redis.LLen(ctx, r.Key()).Result()
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, err.Error())
|
|
||||||
r.log.Err(err).Send()
|
|
||||||
return int(count)
|
|
||||||
}
|
|
||||||
|
|
||||||
span.SetAttributes(attribute.Int64("updatesCount", count))
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
|
|
||||||
return int(count)
|
|
||||||
}
|
|
@ -1,98 +0,0 @@
|
|||||||
package redis
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"slices"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
pb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/util"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Get(ctx context.Context, req *pb.GetWeatherRequest) (
|
|
||||||
[]*weather.WeatherUpdate, error,
|
|
||||||
) {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.get", trace.WithAttributes(
|
|
||||||
attribute.Int("limit", util.GetLimitFromReq(req)),
|
|
||||||
))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
return r.get(ctx, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) get(ctx context.Context, req *pb.GetWeatherRequest) (
|
|
||||||
[]*weather.WeatherUpdate, error,
|
|
||||||
) {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.get.redis")
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
limit := util.GetLimitFromReq(req)
|
|
||||||
if limit < 1 {
|
|
||||||
limit = r.keep
|
|
||||||
}
|
|
||||||
|
|
||||||
span.SetAttributes(attribute.Int("limit", limit))
|
|
||||||
r.log.Debug().Int("limit", limit).Msg("getting updates from redis")
|
|
||||||
|
|
||||||
datas, err := r.redis.LRange(ctx, r.Key(), 0, int64(limit)-1).Result()
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, err.Error())
|
|
||||||
r.log.Err(err).Send()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
span.AddEvent("redis queried")
|
|
||||||
r.log.Debug().Int("results", len(datas)).Msg("redis queried")
|
|
||||||
|
|
||||||
updates, err := jsonDatasToUpdates(datas)
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, err.Error())
|
|
||||||
r.log.Err(err).Send()
|
|
||||||
} else {
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
span.AddEvent("results unmarshalled")
|
|
||||||
span.SetAttributes(attribute.Int("results", len(updates)))
|
|
||||||
|
|
||||||
filtered := util.ApplyOptsToUpdates(updates, limit, req.Opts)
|
|
||||||
|
|
||||||
span.AddEvent("results filtered")
|
|
||||||
span.SetAttributes(
|
|
||||||
attribute.Int("filteredResults", len(filtered)),
|
|
||||||
attribute.Int("resultsFiltered", len(updates)-len(filtered)),
|
|
||||||
)
|
|
||||||
|
|
||||||
r.log.Debug().
|
|
||||||
Int("updatesRetrieved", len(updates)).
|
|
||||||
Int("updatesAfterFiltering", len(filtered)).
|
|
||||||
Int("updatesFiltered", len(updates)-len(filtered)).
|
|
||||||
Msg("updates retrieved from redis")
|
|
||||||
|
|
||||||
return filtered, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func jsonDatasToUpdates(datas []string) ([]*weather.WeatherUpdate, error) {
|
|
||||||
var errs error
|
|
||||||
updates := make([]*weather.WeatherUpdate, 0, len(datas))
|
|
||||||
|
|
||||||
for _, data := range datas {
|
|
||||||
update := new(weather.WeatherUpdate)
|
|
||||||
err := json.Unmarshal([]byte(data), update)
|
|
||||||
errs = errors.Join(errs, err)
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
updates = append(updates, update)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return slices.Clip(updates), errs
|
|
||||||
}
|
|
@ -1,136 +0,0 @@
|
|||||||
package redis
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
|
||||||
"fmt"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
redis "github.com/redis/go-redis/v9"
|
|
||||||
"github.com/rs/zerolog"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/config"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/util"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/recorder/recorders"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
DEF_TTL = "24h"
|
|
||||||
DEF_RETAIN = 120
|
|
||||||
UPDATES_KEY = "weatherUpdates"
|
|
||||||
NAME = "redis recorder"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RedisRecorder struct {
|
|
||||||
baseCtx context.Context
|
|
||||||
keyTTL time.Duration
|
|
||||||
tracer trace.Tracer
|
|
||||||
redis *redis.Client
|
|
||||||
config *config.AmbientLocalExporterConfig
|
|
||||||
log *zerolog.Logger
|
|
||||||
appKey string // prefix for redis keys, uses app name, environment, and version
|
|
||||||
keep int
|
|
||||||
*sync.RWMutex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Ping(ctx context.Context) error {
|
|
||||||
_, err := r.redis.Ping(ctx).Result()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Init(ctx context.Context, opts *recorders.RecorderOpts) {
|
|
||||||
r.baseCtx = opts.BaseCtx
|
|
||||||
r.log = zerolog.Ctx(r.baseCtx)
|
|
||||||
|
|
||||||
if opts.AppConfig.RecorderConfig.RedisConfig == nil {
|
|
||||||
r.log.Panic().Msg("refusing to init redis recorder with no redisConfig")
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.RetainLast < 1 {
|
|
||||||
opts.RetainLast = DEF_RETAIN
|
|
||||||
}
|
|
||||||
|
|
||||||
r.config = opts.AppConfig
|
|
||||||
r.keep = opts.RetainLast
|
|
||||||
r.RWMutex = &sync.RWMutex{}
|
|
||||||
|
|
||||||
keyTTL := opts.AppConfig.RecorderConfig.RedisConfig.RedisKeyTTL
|
|
||||||
if keyTTL == "" {
|
|
||||||
keyTTL = DEF_TTL
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
|
||||||
r.keyTTL, err = time.ParseDuration(keyTTL)
|
|
||||||
if err != nil {
|
|
||||||
r.log.Panic().Str("redisKeyTTL", keyTTL).Err(err).
|
|
||||||
Msg("invalid redis key ttl provided")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.tracer = otel.GetTracer(r.baseCtx, "redisRecorder")
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.init", trace.WithAttributes(
|
|
||||||
attribute.String("redisHost", opts.AppConfig.RecorderConfig.RedisConfig.RedisHost),
|
|
||||||
attribute.Int("retainLast", opts.RetainLast),
|
|
||||||
attribute.Int("redisPort", opts.AppConfig.RecorderConfig.RedisConfig.RedisPort),
|
|
||||||
attribute.Bool("tls", opts.AppConfig.RecorderConfig.RedisConfig.RedisTLS),
|
|
||||||
attribute.String("keyTTL", r.keyTTL.String()),
|
|
||||||
))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
// Unique key prefix for this version/env/name of exporter
|
|
||||||
// will be consistent across replicas, but resets on upgrade
|
|
||||||
// as it is using version
|
|
||||||
r.appKey = util.GetAppHash(r.config.AppConfig)
|
|
||||||
|
|
||||||
r.MustInitRedis(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) MustInitRedis(ctx context.Context) {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.init.redis")
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
rc := r.config.RecorderConfig.RedisConfig
|
|
||||||
|
|
||||||
var tlsConfig *tls.Config
|
|
||||||
if rc.RedisTLS {
|
|
||||||
tlsConfig = &tls.Config{
|
|
||||||
ServerName: rc.RedisHost,
|
|
||||||
InsecureSkipVerify: rc.RedisTLSInsecure,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
r.redis = redis.NewClient(&redis.Options{
|
|
||||||
Addr: fmt.Sprintf("%s:%d", rc.RedisHost, rc.RedisPort),
|
|
||||||
ClientName: fmt.Sprintf("%s-%s", r.config.Name, r.config.Environment),
|
|
||||||
Username: rc.RedisUser,
|
|
||||||
Password: rc.RedisPassword,
|
|
||||||
DB: rc.RedisDB,
|
|
||||||
TLSConfig: tlsConfig,
|
|
||||||
})
|
|
||||||
|
|
||||||
span.AddEvent("redis client ready")
|
|
||||||
|
|
||||||
resp := r.redis.Ping(ctx)
|
|
||||||
if resp.Err() != nil {
|
|
||||||
span.RecordError(resp.Err())
|
|
||||||
span.SetStatus(codes.Error, resp.Err().Error())
|
|
||||||
r.log.Fatal().Err(resp.Err()).Msg("failed to ping redis")
|
|
||||||
}
|
|
||||||
|
|
||||||
span.AddEvent("redis client ping ok")
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
|
|
||||||
r.log.Info().Str("appKey", r.appKey).
|
|
||||||
Msg("redis ping ok, client ready")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Key() string {
|
|
||||||
return fmt.Sprintf("%s:%s", r.appKey, UPDATES_KEY)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Name() string { return NAME }
|
|
@ -1,75 +0,0 @@
|
|||||||
package redis
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/codes"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/util"
|
|
||||||
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *RedisRecorder) Set(ctx context.Context, u *weather.WeatherUpdate) error {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.set", trace.WithAttributes(
|
|
||||||
attribute.String("stationName", u.GetStationName()),
|
|
||||||
attribute.String("stationType", util.DerefStr(u.StationType)),
|
|
||||||
))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
r.Lock()
|
|
||||||
defer r.Unlock()
|
|
||||||
|
|
||||||
// First ensure we can prepare our payload
|
|
||||||
data, err := json.Marshal(u)
|
|
||||||
if err != nil {
|
|
||||||
span.RecordError(err)
|
|
||||||
span.SetStatus(codes.Error, err.Error())
|
|
||||||
|
|
||||||
r.log.Err(err).Send()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.set(ctx, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *RedisRecorder) set(ctx context.Context, data []byte) error {
|
|
||||||
ctx, span := r.tracer.Start(ctx, "redisRecorder.set.push", trace.WithAttributes(
|
|
||||||
attribute.Int("updateBytes", len(data)),
|
|
||||||
))
|
|
||||||
defer span.End()
|
|
||||||
|
|
||||||
// Atomic, push and trim
|
|
||||||
var count *redis.IntCmd
|
|
||||||
rErr, err := r.redis.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
|
|
||||||
pipe.LPush(ctx, r.Key(), data)
|
|
||||||
pipe.LTrim(ctx, r.Key(), 0, int64(r.keep)-1)
|
|
||||||
count = pipe.LLen(ctx, r.Key())
|
|
||||||
pipe.Expire(ctx, r.Key(), r.keyTTL)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
for _, cmd := range rErr {
|
|
||||||
span.RecordError(cmd.Err())
|
|
||||||
}
|
|
||||||
span.SetStatus(codes.Error, err.Error())
|
|
||||||
r.log.Err(err).Send()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get new update count
|
|
||||||
|
|
||||||
r.log.Debug().
|
|
||||||
Int("updateBytes", len(data)).
|
|
||||||
Int64("updateCount", count.Val()).
|
|
||||||
Str("redis", r.redis.String()).
|
|
||||||
Str("key", r.Key()).
|
|
||||||
Msg("pushed update to redis")
|
|
||||||
|
|
||||||
span.SetAttributes(attribute.Int64("updateCount", count.Val()))
|
|
||||||
span.SetStatus(codes.Ok, "")
|
|
||||||
return nil
|
|
||||||
}
|
|
41
pkg/weather/state/state.go
Normal file
41
pkg/weather/state/state.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
|
||||||
|
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WeatherState struct {
|
||||||
|
updates []*weather.WeatherUpdate
|
||||||
|
keep int
|
||||||
|
ctx context.Context
|
||||||
|
tracer trace.Tracer
|
||||||
|
meter metric.Meter
|
||||||
|
*sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
type Opts struct {
|
||||||
|
Ctx context.Context
|
||||||
|
KeepLast int
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWeatherState(opts *Opts) *WeatherState {
|
||||||
|
if opts.KeepLast < 1 {
|
||||||
|
opts.KeepLast = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return &WeatherState{
|
||||||
|
updates: make([]*weather.WeatherUpdate, 0),
|
||||||
|
keep: opts.KeepLast,
|
||||||
|
ctx: opts.Ctx,
|
||||||
|
tracer: otel.GetTracer(opts.Ctx, "weatherState"),
|
||||||
|
meter: otel.GetMeter(opts.Ctx, "weatherState"),
|
||||||
|
}
|
||||||
|
}
|
87
pkg/weather/state/state_get.go
Normal file
87
pkg/weather/state/state_get.go
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Returns last requested number of weather updates
|
||||||
|
func (w *WeatherState) Get(ctx context.Context, last int) (
|
||||||
|
[]*weather.WeatherUpdate, error,
|
||||||
|
) {
|
||||||
|
if last < 1 {
|
||||||
|
last = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, span := w.tracer.Start(ctx, "getWeatherState")
|
||||||
|
span.SetAttributes(
|
||||||
|
attribute.Int("last", last),
|
||||||
|
attribute.Int("keep", w.keep),
|
||||||
|
attribute.Int("currentSize", w.Count()),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
|
updates, err := w.get(ctx, last)
|
||||||
|
if err != nil {
|
||||||
|
span.RecordError(err)
|
||||||
|
span.SetStatus(codes.Error, err.Error())
|
||||||
|
} else {
|
||||||
|
span.SetStatus(codes.Ok, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
return updates, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WeatherState) get(ctx context.Context, last int) (
|
||||||
|
[]*weather.WeatherUpdate, error,
|
||||||
|
) {
|
||||||
|
span := trace.SpanFromContext(ctx)
|
||||||
|
|
||||||
|
w.RLock()
|
||||||
|
defer w.Unlock()
|
||||||
|
|
||||||
|
span.AddEvent("acquired lock on state cache")
|
||||||
|
|
||||||
|
updates := w.updates
|
||||||
|
|
||||||
|
if w.count() == 0 {
|
||||||
|
err := errors.New("no state to get")
|
||||||
|
span.RecordError(err)
|
||||||
|
return nil, err
|
||||||
|
} else if w.count() <= last {
|
||||||
|
span.RecordError(errors.New("requested more state than exists"))
|
||||||
|
} else {
|
||||||
|
updates = updates[len(updates)-last:]
|
||||||
|
}
|
||||||
|
|
||||||
|
span.SetAttributes(attribute.Int("retrieved", len(updates)))
|
||||||
|
span.SetStatus(codes.Ok, "")
|
||||||
|
|
||||||
|
return updates, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns count of retained weather updates
|
||||||
|
func (w *WeatherState) Count() int {
|
||||||
|
_, span := w.tracer.Start(w.ctx, "countWeatherState")
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
|
count := w.count()
|
||||||
|
|
||||||
|
span.SetAttributes(attribute.Int("count", count))
|
||||||
|
span.SetStatus(codes.Ok, "")
|
||||||
|
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WeatherState) count() int {
|
||||||
|
w.RLock()
|
||||||
|
defer w.RUnlock()
|
||||||
|
|
||||||
|
return len(w.updates)
|
||||||
|
}
|
35
pkg/weather/state/state_set.go
Normal file
35
pkg/weather/state/state_set.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
|
||||||
|
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (w *WeatherState) Set(ctx context.Context, u *weather.WeatherUpdate) error {
|
||||||
|
_, span := w.tracer.Start(ctx, "setWeatherState")
|
||||||
|
span.SetAttributes(
|
||||||
|
attribute.Int("countWeatherUpdates", w.Count()),
|
||||||
|
attribute.Int("keepUpdates", w.keep),
|
||||||
|
)
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
|
return w.set(span, u)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WeatherState) set(span trace.Span, u *weather.WeatherUpdate) error {
|
||||||
|
w.Lock()
|
||||||
|
defer w.Unlock()
|
||||||
|
|
||||||
|
if len(w.updates) > w.keep {
|
||||||
|
w.updates = w.updates[1:]
|
||||||
|
span.AddEvent("trimmed state updates by 1")
|
||||||
|
}
|
||||||
|
|
||||||
|
w.updates = append(w.updates, u)
|
||||||
|
span.AddEvent("recorded weather state")
|
||||||
|
return nil
|
||||||
|
}
|
@ -9,88 +9,81 @@ import (
|
|||||||
// Stable intermediate struct containing superset of fields
|
// Stable intermediate struct containing superset of fields
|
||||||
// between AWN and Wunderground style updates from Ambient devices
|
// between AWN and Wunderground style updates from Ambient devices
|
||||||
type WeatherUpdate struct {
|
type WeatherUpdate struct {
|
||||||
DateUTC *time.Time `json:"dateUTC,omitempty"`
|
DateUTC *time.Time
|
||||||
StationConfig *config.WeatherStation `json:"stationConfig,omitempty"`
|
StationConfig *config.WeatherStation
|
||||||
StationID *string `json:"stationID,omitempty"`
|
StationID *string
|
||||||
StationType *string `json:"stationType,omitempty"`
|
StationType *string
|
||||||
TempOutdoorF *float64 `json:"tempOutdoorF,omitempty"`
|
TempOutdoorF *float64
|
||||||
TempIndoorF *float64 `json:"tempIndoorF,omitempty"`
|
TempIndoorF *float64
|
||||||
HumidityOudoor *int `json:"humidityOudoor,omitempty"`
|
HumidityOudoor *int
|
||||||
HumidityIndoor *int `json:"humidityIndoor,omitempty"`
|
HumidityIndoor *int
|
||||||
WindSpeedMPH *float64 `json:"windSpeedMPH,omitempty"`
|
WindSpeedMPH *float64
|
||||||
WindGustMPH *float64 `json:"windGustMPH,omitempty"`
|
WindGustMPH *float64
|
||||||
MaxDailyGust *float64 `json:"maxDailyGust,omitempty"`
|
MaxDailyGust *float64
|
||||||
WindDir *int `json:"windDir,omitempty"`
|
WindDir *int
|
||||||
WindDirAvg10m *int `json:"windDirAvg10M,omitempty"`
|
WindDirAvg10m *int
|
||||||
UV *int `json:"uv,omitempty"`
|
UV *int
|
||||||
SolarRadiation *float64 `json:"solarRadiation,omitempty"`
|
SolarRadiation *float64
|
||||||
HourlyRainIn *float64 `json:"hourlyRainIn,omitempty"`
|
HourlyRainIn *float64
|
||||||
EventRainIn *float64 `json:"eventRainIn,omitempty"`
|
EventRainIn *float64
|
||||||
DailyRainIn *float64 `json:"dailyRainIn,omitempty"`
|
DailyRainIn *float64
|
||||||
WeeklyRainIn *float64 `json:"weeklyRainIn,omitempty"`
|
WeeklyRainIn *float64
|
||||||
MonthlyRainIn *float64 `json:"monthlyRainIn,omitempty"`
|
MonthlyRainIn *float64
|
||||||
YearlyRainIn *float64 `json:"yearlyRainIn,omitempty"`
|
YearlyRainIn *float64
|
||||||
TotalRainIn *float64 `json:"totalRainIn,omitempty"`
|
TotalRainIn *float64
|
||||||
Batteries []BatteryStatus `json:"batteries,omitempty"`
|
Batteries []BatteryStatus
|
||||||
BaromRelativeIn *float64 `json:"baromRelativeIn,omitempty"`
|
BaromRelativeIn *float64
|
||||||
BaromAbsoluteIn *float64 `json:"baromAbsoluteIn,omitempty"`
|
BaromAbsoluteIn *float64
|
||||||
// These fields may be calculated
|
// These fields may be calculated
|
||||||
// if not otherwise set
|
// if not otherwise set
|
||||||
DewPointF *float64 `json:"dewPointF,omitempty"`
|
DewPointF *float64
|
||||||
WindChillF *float64 `json:"windChillF,omitempty"`
|
WindChillF *float64
|
||||||
// Extra Temp+Humidity Sensors
|
// Extra Temp+Humidity Sensors
|
||||||
TempHumiditySensors []*TempHumiditySensor `json:"tempHumiditySensors,omitempty"`
|
TempHumiditySensors []*TempHumiditySensor
|
||||||
// Lightning Data
|
|
||||||
LightningDay *int `json:"lightningDay,omitempty"` // Count of detections
|
|
||||||
LightningDistance *int `json:"lightningDistance,omitempty"` // Last detection distance [kilometers]
|
|
||||||
LightningLastTime *int `json:"lightningLastTime,omitempty"` // Last detection time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type TempHumiditySensor struct {
|
type TempHumiditySensor struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string
|
||||||
TempF *float64 `json:"tempF,omitempty"`
|
TempF *float64
|
||||||
Humidity *int `json:"humidity,omitempty"`
|
Humidity *int
|
||||||
}
|
}
|
||||||
|
|
||||||
type BatteryStatus struct {
|
type BatteryStatus struct {
|
||||||
Component string `json:"component,omitempty"`
|
Component string
|
||||||
Status *int `json:"status,omitempty"`
|
Status *int
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHORE: Maintain this, used to check against
|
// CHORE: Maintain this, used to check against
|
||||||
// keep and drop lists
|
// keep and drop lists
|
||||||
// TODO: Use refelct/ast to generate code
|
// TODO: Use refelct/ast to generate code
|
||||||
const (
|
const (
|
||||||
FieldDateUTC = "DateUTC"
|
FieldDateUTC = "DateUTC"
|
||||||
FieldStationType = "StationType"
|
FieldStationType = "StationType"
|
||||||
FieldTempOutdoorF = "TempOutdoorF"
|
FieldTempOutdoorF = "TempOutdoorF"
|
||||||
FieldTempIndoorF = "TempIndoorF"
|
FieldTempIndoorF = "TempIndoorF"
|
||||||
FieldHumidityOudoor = "HumidityOudoor"
|
FieldHumidityOudoor = "HumidityOudoor"
|
||||||
FieldHumidityIndoor = "HumidityIndoor"
|
FieldHumidityIndoor = "HumidityIndoor"
|
||||||
FieldWindSpeedMPH = "WindSpeedMPH"
|
FieldWindSpeedMPH = "WindSpeedMPH"
|
||||||
FieldWindGustMPH = "WindGustMPH"
|
FieldWindGustMPH = "WindGustMPH"
|
||||||
FieldMaxDailyGust = "MaxDailyGust"
|
FieldMaxDailyGust = "MaxDailyGust"
|
||||||
FieldWindDir = "WindDir"
|
FieldWindDir = "WindDir"
|
||||||
FieldWindDirAvg10m = "WindDirAvg10m"
|
FieldWindDirAvg10m = "WindDirAvg10m"
|
||||||
FieldUV = "UV"
|
FieldUV = "UV"
|
||||||
FieldSolarRadiation = "SolarRadiation"
|
FieldSolarRadiation = "SolarRadiation"
|
||||||
FieldHourlyRainIn = "HourlyRainIn"
|
FieldHourlyRainIn = "HourlyRainIn"
|
||||||
FieldEventRainIn = "EventRainIn"
|
FieldEventRainIn = "EventRainIn"
|
||||||
FieldDailyRainIn = "DailyRainIn"
|
FieldDailyRainIn = "DailyRainIn"
|
||||||
FieldWeeklyRainIn = "WeeklyRainIn"
|
FieldWeeklyRainIn = "WeeklyRainIn"
|
||||||
FieldMonthlyRainIn = "MonthlyRainIn"
|
FieldMonthlyRainIn = "MonthlyRainIn"
|
||||||
FieldYearlyRainIn = "YearlyRainIn"
|
FieldYearlyRainIn = "YearlyRainIn"
|
||||||
FieldTotalRainIn = "TotalRainIn"
|
FieldTotalRainIn = "TotalRainIn"
|
||||||
FieldBatteries = "Batteries"
|
FieldBatteries = "Batteries"
|
||||||
FieldBaromRelativeIn = "BaromRelativeIn"
|
FieldBaromRelativeIn = "BaromRelativeIn"
|
||||||
FieldBaromAbsoluteIn = "BaromAbsoluteIn"
|
FieldBaromAbsoluteIn = "BaromAbsoluteIn"
|
||||||
FieldDewPointF = "DewPointF"
|
FieldDewPointF = "DewPointF"
|
||||||
FieldWindChillF = "WindChillF"
|
FieldWindChillF = "WindChillF"
|
||||||
FieldSensorTempF = "SensorTempF"
|
FieldSensorTempF = "SensorTempF"
|
||||||
FieldSensorHumidity = "SensorHumidity"
|
FieldSensorHumidity = "SensorHumidity"
|
||||||
FieldLightningDay = "LightningDay"
|
|
||||||
FieldLightningDistance = "LightningDistance"
|
|
||||||
FieldLightningLastTime = "LightningLastTime"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (u *WeatherUpdate) GetStationName() string {
|
func (u *WeatherUpdate) GetStationName() string {
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 53ca65d540dd1a7cb4746687daa87208dc9ea437
|
|
@ -5,72 +5,60 @@ import "google/protobuf/timestamp.proto";
|
|||||||
|
|
||||||
option go_package = "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather";
|
option go_package = "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather";
|
||||||
|
|
||||||
message CountWeatherUpdatesRequest {
|
|
||||||
GetWeatherOpts opts = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CountWeatherUpdatesResponse {
|
|
||||||
int32 count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GetWeatherRequest {
|
message GetWeatherRequest {
|
||||||
GetWeatherOpts opts = 1;
|
GetWeatherOpts opts = 1;
|
||||||
optional int32 limit = 2;
|
optional int32 limit = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetWeatherResponse {
|
message GetWeatherResponse{
|
||||||
google.protobuf.Timestamp last_updated = 1;
|
google.protobuf.Timestamp last_updated = 1;
|
||||||
repeated WeatherUpdate weather_updates = 2;
|
repeated WeatherUpdate weather_updates = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetWeatherOpts {
|
message GetWeatherOpts {
|
||||||
optional string station_name = 1;
|
optional string station_name = 1;
|
||||||
optional string station_type = 2;
|
optional string station_type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WeatherUpdate {
|
message WeatherUpdate {
|
||||||
string station_name = 1;
|
string station_name = 1;
|
||||||
string station_type = 2;
|
string station_type = 2;
|
||||||
string station_id = 3;
|
string station_id = 3;
|
||||||
optional double temp_outdoor_f = 4;
|
optional double temp_outdoor_f = 4;
|
||||||
optional double temp_indoor_f = 5;
|
optional double temp_indoor_f = 5;
|
||||||
optional int32 humidity_outdoor = 6;
|
optional int32 humidity_outdoor = 6;
|
||||||
optional int32 humidity_indoor = 7;
|
optional int32 humidity_indoor = 7;
|
||||||
optional double wind_speed_mph = 8;
|
optional double wind_speed_mph = 8;
|
||||||
optional double wind_gust_mph = 9;
|
optional double wind_gust_mph = 9;
|
||||||
optional double max_daily_gust = 10;
|
optional double max_daily_gust = 10;
|
||||||
optional int32 wind_dir = 11;
|
optional int32 wind_dir = 11;
|
||||||
optional int32 wind_dir_avg_10m = 12;
|
optional int32 wind_dir_avg_10m = 12;
|
||||||
optional int32 uv = 13;
|
optional int32 uv = 13;
|
||||||
optional double solar_radiation = 14;
|
optional double solar_radiation = 14;
|
||||||
optional double hourly_rain_in = 15;
|
optional double hourly_rain_in = 15;
|
||||||
optional double event_rain_in = 16;
|
optional double event_rain_in = 16;
|
||||||
optional double daily_rain_in = 17;
|
optional double daily_rain_in = 17;
|
||||||
optional double weekly_rain_in = 18;
|
optional double weekly_rain_in = 18;
|
||||||
optional double monthly_rain_in = 19;
|
optional double monthly_rain_in = 19;
|
||||||
optional double yearly_rain_in = 20;
|
optional double yearly_rain_in = 20;
|
||||||
optional double total_rain_in = 21;
|
optional double total_rain_in = 21;
|
||||||
repeated BatteryStatus batteries = 22;
|
repeated BatteryStatus batteries = 22;
|
||||||
optional double barom_relative_in = 23;
|
optional double barom_relative_in = 23;
|
||||||
optional double barom_absolute_in = 24;
|
optional double barom_absolute_in = 24;
|
||||||
optional double dew_point_f = 25;
|
optional double dew_point_f = 25;
|
||||||
optional double wind_chill_f = 26;
|
optional double wind_chill_f = 26;
|
||||||
repeated TempHumiditySensor temp_humidity_sensors = 27;
|
repeated TempHumiditySensor temp_humidity_sensors = 27;
|
||||||
google.protobuf.Timestamp update_timestamp = 28;
|
|
||||||
optional int32 lightning_day = 29;
|
|
||||||
optional int32 lightning_distance = 30;
|
|
||||||
optional google.protobuf.Timestamp lightning_last_time = 31;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a temperature and humidity sensor
|
// Represents a temperature and humidity sensor
|
||||||
message TempHumiditySensor {
|
message TempHumiditySensor {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
optional double temp_f = 2;
|
optional double temp_f = 2;
|
||||||
optional int32 humidity = 3;
|
optional int32 humidity = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents battery status for different components
|
// Represents battery status for different components
|
||||||
message BatteryStatus {
|
message BatteryStatus {
|
||||||
string component = 1;
|
string component = 1;
|
||||||
optional int32 status = 2;
|
optional int32 status = 2;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package ambient.weather;
|
package ambient.weather;
|
||||||
|
|
||||||
import "google/api/annotations.proto";
|
|
||||||
import "weather/weather.proto";
|
import "weather/weather.proto";
|
||||||
|
|
||||||
option go_package = "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather";
|
option go_package = "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather";
|
||||||
|
|
||||||
service AmbientLocalWeatherService {
|
service AmbientLocalWeatherService {
|
||||||
rpc GetWeather(GetWeatherRequest) returns (GetWeatherResponse) {
|
rpc GetWeather(GetWeatherRequest) returns (GetWeatherResponse);
|
||||||
option (google.api.http) = {get: "/v1/weather"};
|
|
||||||
}
|
|
||||||
rpc CountWeatherUpdates(CountWeatherUpdatesRequest) returns (CountWeatherUpdatesResponse) {
|
|
||||||
option (google.api.http) = {get: "/v1/count"};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user