implement econet exporter
Build and Publish / go-binaries (push) Has been skipped
Build and Publish / container-images (push) Has been skipped
Build and Publish / helm-release (push) Successful in 19s
Build and Publish / check-chart (push) Successful in 52s

This commit is contained in:
2026-07-04 17:22:31 -04:00
parent 8198e8cfee
commit b2ec72352a
44 changed files with 2226 additions and 1281 deletions
+4 -4
View File
@@ -5,17 +5,17 @@ on:
branches: ["main"]
env:
PACKAGE_NAME: go-server-with-otel
PACKAGE_NAME: econet-exporter
BINARY_PATH: bin
BINARY_NAME: go-server-with-otel
GO_MOD_PATH: gitea.libretechconsulting.com/rmcguire/go-server-with-otel
BINARY_NAME: econet-exporter
GO_MOD_PATH: gitea.libretechconsulting.com/rmcguire/econet-exporter
GO_GIT_HOST: gitea.libretechconsulting.com
VER_PKG: gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version
VERSION: ${{ github.ref_name }}
PLATFORMS: linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
DOCKER_REGISTRY: gitea.libretechconsulting.com
DOCKER_USER: rmcguire
DOCKER_REPO: rmcguire/go-server-with-otel
DOCKER_REPO: rmcguire/econet-exporter
DOCKER_IMG: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_REPO }}
CHART_DIR: helm/
+66
View File
@@ -0,0 +1,66 @@
# AGENTS.md — econet-exporter
Exporter for Rheem EcoNet / Rheemcloud water heaters, built on the
`go-app` framework (see the framework's own AGENTS.md for lifecycle details).
## Architecture
- `main.go` — go-app bootstrap. The **only** app-specific lines are the
`appServices` slice (registers `&econet.EconetService{}`) and the
`serviceConfig.LoadEnv()` call (see Config gotcha below).
- `pkg/econet/econet.go``EconetService` implements `service.AppService`.
It **owns the single `*rheemcloud.Client`** and shares it with the gRPC,
MCP, and metrics sub-servers. `Init` connects (fail-fast if creds missing);
the returned `ShutdownFunc` stops metrics and closes the client.
- `pkg/econet/econetgrpc/``EconetService` gRPC impl (`ListDevices`,
`GetDevice`) + `deviceToProto`. Does **not** own a client; it's injected.
- `pkg/econet/econetmcp/` — MCP server at `/api/mcp`; the `list_water_heaters`
tool delegates to the gRPC server.
- `pkg/econet/econetmetrics/` — OTEL observable gauges + a usage poller.
## Config gotcha (important)
go-app's `MustLoadConfigInto` applies env vars **only to the embedded
`AppConfig`**, not to custom `ServiceConfig` fields. So custom fields need an
explicit env pass: `ServiceConfig.LoadEnv()` (in `pkg/config/custom.go`) runs
`env.Parse` over the custom fields (it nils out the embedded `AppConfig` first
to preserve go-app's own precedence). `main.go` calls it right after
`MustLoadConfigInto`. If you add a custom config field with an `env:` tag,
that's all it takes — no extra wiring.
- `costPerKWH` is **US dollars per kWh** (0.18 = 18¢), feeding
`econet_energy_cost_dollars`.
## Metrics conventions
- Live state is read at scrape time inside a `RegisterCallback` over
`client.Devices()` (cheap, in-memory, always current — the rheemcloud client
keeps state fresh over MQTT). Usage (`EnergyUsage`/`WaterUsage`) is REST and
slow, so a background poller (`usageInterval`) caches it; the usage callback
reads the cache.
- **Attributes**: dotted/namespaced `econet.*` (semantic-convention style),
low-cardinality only (serial, device_id, friendly_name, type, generic_type,
mode, energy_type). **Never** put changing values (timestamps) in attributes
`econet_last_updated_seconds` is a metric *value*, and it's suppressed
until the first MQTT update so it never emits a garbage epoch.
- **Units live in metric names** (`_fahrenheit`, `_kwh`, `_gallons`,
`_dollars`), NOT via `metric.WithUnit` — the OTEL→Prometheus exporter would
otherwise append a second unit suffix (`..._fahrenheit_F`).
## Workflow
- Regenerate proto: `make proto` (buf; `PROTO_DIRS=proto/econet/v1alpha1/*`).
- Regenerate config schema after config changes: `make schema`.
- Build/test: `go build ./... && go test ./...`.
- The rheemcloud `*Device` has no exported constructor, so `deviceToProto`
isn't unit-testable in isolation; test the pure helpers (`summarizeDevices`,
`b2i`) and exercise the rest with a live run.
## Live verification (needs a real Rheem account)
Creds are configured via `ECONET_EMAIL` / `ECONET_PASSWORD`. Run
`go run . -config config.yaml`, then check: `/metrics` (grep `econet_`),
`/api/v1alpha1/devices` (REST), grpcurl on `:8081`, and MCP at `/api/mcp`
(streamable HTTP; POST to `/api/mcp/` with trailing slash — bare `/api/mcp`
307-redirects). The REST gateway needs `grpcGatewayPathStrip: true` in
config.yaml (otherwise the `/api` prefix isn't stripped and routes 404).
+2 -2
View File
@@ -7,7 +7,7 @@ ARG GOPROXY
ARG GONOSUMDB=gitea.libretechconsulting.com
ARG VER_PKG=gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version
ARG VERSION=(devel)
ARG APP_NAME=go-server-with-otel
ARG APP_NAME=econet-exporter
COPY ./go.mod ./go.sum ./
RUN go mod download
@@ -17,7 +17,7 @@ RUN go build -C . -v -ldflags "-extldflags '-static' -X ${VER_PKG}=${VERSION}" -
FROM alpine:latest
ARG APP_NAME=go-server-with-otel
ARG APP_NAME=econet-exporter
WORKDIR /app
USER 100:101
+3 -3
View File
@@ -1,14 +1,14 @@
.PHONY: all test build docker install clean proto check_protoc
CMD_NAME := go-server-with-otel
CMD_NAME := econet-exporter
VERSION ?= development
API_DIR := api/
SCHEMA_DIR := contrib/
PROTO_DIRS := $(wildcard proto/demo/app/*) # TODO: Update path (probably not demo)
PROTO_DIRS := $(wildcard proto/econet/v1alpha1/*)
PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
OUTPUT_DIR := bin
VER_PKG := gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version
GIT_REPO := gitea.libretechconsulting.com/rmcguire/go-server-with-otel
GIT_REPO := gitea.libretechconsulting.com/rmcguire/econet-exporter
all: proto test build docker
+57 -58
View File
@@ -1,74 +1,73 @@
# go-server-with-otel 🚀
# econet-exporter 🔥💧
A powerful and flexible template for building Go HTTP + GRPC servers with full OpenTelemetry (OTEL) support.
Bootstrapped with the go-app framework to provide all the bells and whistles right out of the box.
Ideal for rapidly creating production-ready microservices.
An exporter for **Rheem EcoNet / Rheemcloud** water-heater data. It keeps a
long-lived connection to the Rheem cloud (via
[`rheemcloud-go`](https://github.com/kevinburke/rheemcloud-go)) and exposes device
state and usage three ways:
Check out the [go-app framework](https://gitea.libretechconsulting.com/rmcguire/go-app) for more detail there.
- **OTEL metrics** served for Prometheus scraping at `/metrics` (live state +
energy/water usage, including a dollar-cost metric).
- A simple **gRPC API** (`ListDevices`, `GetDevice`) with a grpc-gateway REST
frontend under `/api`.
- An **MCP tool** (`list_water_heaters`) at `/api/mcp` that wraps the gRPC API.
## 🌟 Features
Built on the [go-app framework](https://gitea.libretechconsulting.com/rmcguire/go-app),
which provides OTEL, the Prometheus endpoint, gRPC + gateway, health checks,
config/env loading, and graceful shutdown.
- **📈 OpenTelemetry (OTEL) Metrics & Traces** Comprehensive observability with built-in support for metrics and traces.
- 📝 Logging with Zerolog High-performance structured logging with zerolog for ultra-fast, leveled logging.
- 💻 Local dev with air pre-configured (just run `air`)
- **💬 GRPC + GRPC-Gateway** Supports RESTful JSON APIs alongside gRPC with auto-generated Swagger (OpenAPI2) specs.
- 🌐 HTTP and GRPC Middleware Flexible middleware support for HTTP and GRPC to enhance request handling, authentication, and observability.
- **📦 Multi-Arch Builds** Robust Makefile that supports building for multiple architectures (amd64, arm64, etc.).
- **🐳 Docker Image Generation** Easily build Docker images using `make docker`.
- **📜 Config Schema Generation** Automatically generate JSON schemas for configuration validation.
- **📝 Proto Compilation** Seamlessly compile .proto files with `make proto`.
- **🔄 Project Renaming** Easily rename your project using `make rename NAME=your.gitremote.com/pathto/repo`.
- **📦 Helm Chart** Deploy your application with Kubernetes using the provided Helm chart.
- **🤖 Gitea CI Integration** Out-of-the-box Gitea CI pipeline configuration with `.gitea/workflows/ci.yaml`.
- **⚙️ Expandable Configuration** Extend your app-specific configuration with go-app's built-in logging, HTTP, and GRPC config support.
## ⚙️ Configuration
---
Config merges a YAML file (`-config config.yaml`), environment variables, and
go-app defaults. Custom fields (see `pkg/config/custom.go`):
## 📚 Getting Started
| Field | Env var | Notes |
|-------|---------|-------|
| `econetEmail` | `ECONET_EMAIL` | Rheem account email |
| `econetPassword` | `ECONET_PASSWORD` | Prefer the env var; keep out of config.yaml |
| `costPerKWH` | `ECONET_COST_PER_KWH` | **US dollars per kWh** (e.g. `0.18` = 18¢), not cents |
| `usageInterval` | `ECONET_USAGE_INTERVAL` | Energy/water poll interval (default `5m`) |
1. Install tools:
- Install make, protoc, and go using brew, apt, etc..
- Install protoc plugins (provided in go.mod tool()):
- `go get -v tool && go install -v tool`
Everything under the go-app `AppConfig` (logging, otel, http, grpc) is also
env-overridable with `APP_*` variables — see `env-sample`.
1. **Rename your package:**
```sh
make rename NAME=my.gitremote.com/pathto/repo
```
## 🚀 Running
1. **Review the config struct:**
Update and customize your app-specific configuration. This merges with go-app's configuration, providing logging, HTTP, and GRPC config for free.
```sh
export ECONET_EMAIL=you@example.com ECONET_PASSWORD=... ECONET_COST_PER_KWH=0.14
go run . -config config.yaml
```
1. **Generate a new JSON schema:**
```sh
make schema
```
- Ensure your structs have `yaml` and `json` tags.
- With the `yaml-language-server` LSP plugin, the schema will be auto-detected in your `config.yaml`.
Then:
- `curl localhost:8080/metrics | grep econet_`
- `curl localhost:8080/api/v1alpha1/devices` (REST via grpc-gateway)
- `grpcurl -plaintext localhost:8081 econet.v1alpha1.EconetService/ListDevices`
- MCP: point a client at `http://localhost:8080/api/mcp`
1. **Compile proto files:**
```sh
make proto
```
- Add paths under `proto/` as necessary.
## 📊 Metrics
1. **Implement your application logic.**
1. **Update Gitea CI configuration:**
Modify parameters in `.gitea/workflows/ci.yaml` as needed.
1. Tag your release: `git tag v0.1.0` and push `git push --tags`
---
Per-device gauges labeled `econet.serial`, `econet.device_id`,
`econet.friendly_name`: `econet_setpoint_fahrenheit`, `econet_connected`,
`econet_running`, `econet_enabled`, `econet_away`,
`econet_hot_water_availability_percent`, `econet_alert_count`,
`econet_wifi_signal_db`, `econet_device_info` (adds `type`/`generic_type`/`mode`).
Polled usage: `econet_energy_usage_kwh`, `econet_water_usage_gallons`,
`econet_energy_cost_dollars`.
## 📂 Project Structure
- `proto/` - Protobuf definitions and generated files.
- `api/` - Auto-generated code for proto, grpc-gateway, and OpenAPI2 spec
- `pkg/config/` - Custom config, merged with go-app configuration
- `pkg/demo(http|grpc)/` - HTTP and GRPC server implementations
- `helm/` - Helm chart for deploying your application to Kubernetes.
- `.gitea/workflows/` - CI pipelines for automated builds and tests.
- `proto/econet/v1alpha1/` - Protobuf definitions (source).
- `api/econet/v1alpha1/` - Generated proto, grpc, grpc-gateway code.
- `pkg/config/` - Custom config merged with go-app configuration.
- `pkg/econet/` - `EconetService` (owns the rheemcloud client) plus:
- `econetgrpc/` - gRPC `EconetService` implementation.
- `econetmcp/` - MCP server + tools.
- `econetmetrics/` - OTEL observable gauges + usage poller.
- `helm/` - Helm chart for Kubernetes deployment.
- `.gitea/workflows/` - CI pipelines.
---
## 🛠️ Development
## 🔥 Ready to build something awesome? Let's go! 🎉
- `make proto` - regenerate code from `proto/`.
- `make schema` - regenerate `contrib/schema.json` from the config struct.
- `make build` / `make docker` - multi-arch build / image.
See `AGENTS.md` for agent-oriented development notes.
-212
View File
@@ -1,212 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc (unknown)
// source: demo/app/v1alpha1/app.proto
package demo
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Options for random fact, in this case
// just a language
type GetDemoRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Language *string `protobuf:"bytes,1,opt,name=language,proto3,oneof" json:"language,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetDemoRequest) Reset() {
*x = GetDemoRequest{}
mi := &file_demo_app_v1alpha1_app_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetDemoRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetDemoRequest) ProtoMessage() {}
func (x *GetDemoRequest) ProtoReflect() protoreflect.Message {
mi := &file_demo_app_v1alpha1_app_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 GetDemoRequest.ProtoReflect.Descriptor instead.
func (*GetDemoRequest) Descriptor() ([]byte, []int) {
return file_demo_app_v1alpha1_app_proto_rawDescGZIP(), []int{0}
}
func (x *GetDemoRequest) GetLanguage() string {
if x != nil && x.Language != nil {
return *x.Language
}
return ""
}
// Returns a randome fact, because this is a demo app
// so what else do we do?
type GetDemoResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Fact string `protobuf:"bytes,2,opt,name=fact,proto3" json:"fact,omitempty"`
Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`
Language string `protobuf:"bytes,4,opt,name=language,proto3" json:"language,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetDemoResponse) Reset() {
*x = GetDemoResponse{}
mi := &file_demo_app_v1alpha1_app_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetDemoResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetDemoResponse) ProtoMessage() {}
func (x *GetDemoResponse) ProtoReflect() protoreflect.Message {
mi := &file_demo_app_v1alpha1_app_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 GetDemoResponse.ProtoReflect.Descriptor instead.
func (*GetDemoResponse) Descriptor() ([]byte, []int) {
return file_demo_app_v1alpha1_app_proto_rawDescGZIP(), []int{1}
}
func (x *GetDemoResponse) GetTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.Timestamp
}
return nil
}
func (x *GetDemoResponse) GetFact() string {
if x != nil {
return x.Fact
}
return ""
}
func (x *GetDemoResponse) GetSource() string {
if x != nil {
return x.Source
}
return ""
}
func (x *GetDemoResponse) GetLanguage() string {
if x != nil {
return x.Language
}
return ""
}
var File_demo_app_v1alpha1_app_proto protoreflect.FileDescriptor
const file_demo_app_v1alpha1_app_proto_rawDesc = "" +
"\n" +
"\x1bdemo/app/v1alpha1/app.proto\x12\x11demo.app.v1alpha1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"G\n" +
"\x0eGetDemoRequest\x12(\n" +
"\blanguage\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x02H\x00R\blanguage\x88\x01\x01B\v\n" +
"\t_language\"\x9c\x01\n" +
"\x0fGetDemoResponse\x128\n" +
"\ttimestamp\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\ttimestamp\x12\x12\n" +
"\x04fact\x18\x02 \x01(\tR\x04fact\x12\x16\n" +
"\x06source\x18\x03 \x01(\tR\x06source\x12#\n" +
"\blanguage\x18\x04 \x01(\tB\a\xbaH\x04r\x02\x10\x02R\blanguage2z\n" +
"\x0eDemoAppService\x12h\n" +
"\aGetDemo\x12!.demo.app.v1alpha1.GetDemoRequest\x1a\".demo.app.v1alpha1.GetDemoResponse\"\x16\x82\xd3\xe4\x93\x02\x10\x12\x0e/v1alpha1/demoB\xd5\x01\n" +
"\x15com.demo.app.v1alpha1B\bAppProtoP\x01ZLgitea.libretechconsulting.com/rmcguire/go-server-with-otel/api/v1alpha1/demo\xa2\x02\x03DAX\xaa\x02\x11Demo.App.V1alpha1\xca\x02\x11Demo\\App\\V1alpha1\xe2\x02\x1dDemo\\App\\V1alpha1\\GPBMetadata\xea\x02\x13Demo::App::V1alpha1b\x06proto3"
var (
file_demo_app_v1alpha1_app_proto_rawDescOnce sync.Once
file_demo_app_v1alpha1_app_proto_rawDescData []byte
)
func file_demo_app_v1alpha1_app_proto_rawDescGZIP() []byte {
file_demo_app_v1alpha1_app_proto_rawDescOnce.Do(func() {
file_demo_app_v1alpha1_app_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_demo_app_v1alpha1_app_proto_rawDesc), len(file_demo_app_v1alpha1_app_proto_rawDesc)))
})
return file_demo_app_v1alpha1_app_proto_rawDescData
}
var file_demo_app_v1alpha1_app_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_demo_app_v1alpha1_app_proto_goTypes = []any{
(*GetDemoRequest)(nil), // 0: demo.app.v1alpha1.GetDemoRequest
(*GetDemoResponse)(nil), // 1: demo.app.v1alpha1.GetDemoResponse
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
}
var file_demo_app_v1alpha1_app_proto_depIdxs = []int32{
2, // 0: demo.app.v1alpha1.GetDemoResponse.timestamp:type_name -> google.protobuf.Timestamp
0, // 1: demo.app.v1alpha1.DemoAppService.GetDemo:input_type -> demo.app.v1alpha1.GetDemoRequest
1, // 2: demo.app.v1alpha1.DemoAppService.GetDemo:output_type -> demo.app.v1alpha1.GetDemoResponse
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_demo_app_v1alpha1_app_proto_init() }
func file_demo_app_v1alpha1_app_proto_init() {
if File_demo_app_v1alpha1_app_proto != nil {
return
}
file_demo_app_v1alpha1_app_proto_msgTypes[0].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_demo_app_v1alpha1_app_proto_rawDesc), len(file_demo_app_v1alpha1_app_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_demo_app_v1alpha1_app_proto_goTypes,
DependencyIndexes: file_demo_app_v1alpha1_app_proto_depIdxs,
MessageInfos: file_demo_app_v1alpha1_app_proto_msgTypes,
}.Build()
File_demo_app_v1alpha1_app_proto = out.File
file_demo_app_v1alpha1_app_proto_goTypes = nil
file_demo_app_v1alpha1_app_proto_depIdxs = nil
}
-165
View File
@@ -1,165 +0,0 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: demo/app/v1alpha1/app.proto
/*
Package demo is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package demo
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_DemoAppService_GetDemo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
func request_DemoAppService_GetDemo_0(ctx context.Context, marshaler runtime.Marshaler, client DemoAppServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetDemoRequest
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = 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_DemoAppService_GetDemo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetDemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_DemoAppService_GetDemo_0(ctx context.Context, marshaler runtime.Marshaler, server DemoAppServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetDemoRequest
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_DemoAppService_GetDemo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetDemo(ctx, &protoReq)
return msg, metadata, err
}
// RegisterDemoAppServiceHandlerServer registers the http handlers for service DemoAppService to "mux".
// UnaryRPC :call DemoAppServiceServer 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 RegisterDemoAppServiceHandlerFromEndpoint 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 RegisterDemoAppServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoAppServiceServer) error {
mux.Handle(http.MethodGet, pattern_DemoAppService_GetDemo_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, "/demo.app.v1alpha1.DemoAppService/GetDemo", runtime.WithHTTPPathPattern("/v1alpha1/demo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_DemoAppService_GetDemo_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_DemoAppService_GetDemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterDemoAppServiceHandlerFromEndpoint is same as RegisterDemoAppServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDemoAppServiceHandlerFromEndpoint(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 RegisterDemoAppServiceHandler(ctx, mux, conn)
}
// RegisterDemoAppServiceHandler registers the http handlers for service DemoAppService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterDemoAppServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterDemoAppServiceHandlerClient(ctx, mux, NewDemoAppServiceClient(conn))
}
// RegisterDemoAppServiceHandlerClient registers the http handlers for service DemoAppService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DemoAppServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DemoAppServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "DemoAppServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterDemoAppServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoAppServiceClient) error {
mux.Handle(http.MethodGet, pattern_DemoAppService_GetDemo_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, "/demo.app.v1alpha1.DemoAppService/GetDemo", runtime.WithHTTPPathPattern("/v1alpha1/demo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_DemoAppService_GetDemo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_DemoAppService_GetDemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_DemoAppService_GetDemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1alpha1", "demo"}, ""))
)
var (
forward_DemoAppService_GetDemo_0 = runtime.ForwardResponseMessage
)
-119
View File
@@ -1,119 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: demo/app/v1alpha1/app.proto
package demo
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
DemoAppService_GetDemo_FullMethodName = "/demo.app.v1alpha1.DemoAppService/GetDemo"
)
// DemoAppServiceClient is the client API for DemoAppService service.
//
// 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 DemoAppServiceClient interface {
GetDemo(ctx context.Context, in *GetDemoRequest, opts ...grpc.CallOption) (*GetDemoResponse, error)
}
type demoAppServiceClient struct {
cc grpc.ClientConnInterface
}
func NewDemoAppServiceClient(cc grpc.ClientConnInterface) DemoAppServiceClient {
return &demoAppServiceClient{cc}
}
func (c *demoAppServiceClient) GetDemo(ctx context.Context, in *GetDemoRequest, opts ...grpc.CallOption) (*GetDemoResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetDemoResponse)
err := c.cc.Invoke(ctx, DemoAppService_GetDemo_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// DemoAppServiceServer is the server API for DemoAppService service.
// All implementations should embed UnimplementedDemoAppServiceServer
// for forward compatibility.
type DemoAppServiceServer interface {
GetDemo(context.Context, *GetDemoRequest) (*GetDemoResponse, error)
}
// UnimplementedDemoAppServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedDemoAppServiceServer struct{}
func (UnimplementedDemoAppServiceServer) GetDemo(context.Context, *GetDemoRequest) (*GetDemoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDemo not implemented")
}
func (UnimplementedDemoAppServiceServer) testEmbeddedByValue() {}
// UnsafeDemoAppServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DemoAppServiceServer will
// result in compilation errors.
type UnsafeDemoAppServiceServer interface {
mustEmbedUnimplementedDemoAppServiceServer()
}
func RegisterDemoAppServiceServer(s grpc.ServiceRegistrar, srv DemoAppServiceServer) {
// If the following call pancis, it indicates UnimplementedDemoAppServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&DemoAppService_ServiceDesc, srv)
}
func _DemoAppService_GetDemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDemoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoAppServiceServer).GetDemo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DemoAppService_GetDemo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoAppServiceServer).GetDemo(ctx, req.(*GetDemoRequest))
}
return interceptor(ctx, in, info, handler)
}
// DemoAppService_ServiceDesc is the grpc.ServiceDesc for DemoAppService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var DemoAppService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "demo.app.v1alpha1.DemoAppService",
HandlerType: (*DemoAppServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetDemo",
Handler: _DemoAppService_GetDemo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "demo/app/v1alpha1/app.proto",
}
+474
View File
@@ -0,0 +1,474 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: econet/v1alpha1/econet.proto
package v1alpha1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Device is the live state of a single Rheem EcoNet device
// (typically a water heater) as reported by the Rheem cloud.
type Device struct {
state protoimpl.MessageState `protogen:"open.v1"`
SerialNumber string `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`
DeviceId string `protobuf:"bytes,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`
FriendlyName string `protobuf:"bytes,3,opt,name=friendly_name,json=friendlyName,proto3" json:"friendly_name,omitempty"`
Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` // water_heater, thermostat, unknown
GenericType string `protobuf:"bytes,5,opt,name=generic_type,json=genericType,proto3" json:"generic_type,omitempty"` // e.g. heatpumpWaterHeater, gasWaterHeater
Connected bool `protobuf:"varint,6,opt,name=connected,proto3" json:"connected,omitempty"`
WifiSignal int32 `protobuf:"varint,7,opt,name=wifi_signal,json=wifiSignal,proto3" json:"wifi_signal,omitempty"` // dB, MQTT-only
Mode string `protobuf:"bytes,8,opt,name=mode,proto3" json:"mode,omitempty"` // kebab-case, e.g. heat-pump, energy-saving
Enabled bool `protobuf:"varint,9,opt,name=enabled,proto3" json:"enabled,omitempty"`
Running bool `protobuf:"varint,10,opt,name=running,proto3" json:"running,omitempty"`
RunningState string `protobuf:"bytes,11,opt,name=running_state,json=runningState,proto3" json:"running_state,omitempty"`
Setpoint int32 `protobuf:"varint,12,opt,name=setpoint,proto3" json:"setpoint,omitempty"` // degrees Fahrenheit
SetpointMin int32 `protobuf:"varint,13,opt,name=setpoint_min,json=setpointMin,proto3" json:"setpoint_min,omitempty"`
SetpointMax int32 `protobuf:"varint,14,opt,name=setpoint_max,json=setpointMax,proto3" json:"setpoint_max,omitempty"`
HotWaterAvailability int32 `protobuf:"varint,15,opt,name=hot_water_availability,json=hotWaterAvailability,proto3" json:"hot_water_availability,omitempty"` // 0/33/66/100, -1 unknown
AlertCount int32 `protobuf:"varint,16,opt,name=alert_count,json=alertCount,proto3" json:"alert_count,omitempty"`
Away bool `protobuf:"varint,17,opt,name=away,proto3" json:"away,omitempty"`
LastUpdated *timestamppb.Timestamp `protobuf:"bytes,18,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Device) Reset() {
*x = Device{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Device) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Device) ProtoMessage() {}
func (x *Device) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_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 Device.ProtoReflect.Descriptor instead.
func (*Device) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{0}
}
func (x *Device) GetSerialNumber() string {
if x != nil {
return x.SerialNumber
}
return ""
}
func (x *Device) GetDeviceId() string {
if x != nil {
return x.DeviceId
}
return ""
}
func (x *Device) GetFriendlyName() string {
if x != nil {
return x.FriendlyName
}
return ""
}
func (x *Device) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Device) GetGenericType() string {
if x != nil {
return x.GenericType
}
return ""
}
func (x *Device) GetConnected() bool {
if x != nil {
return x.Connected
}
return false
}
func (x *Device) GetWifiSignal() int32 {
if x != nil {
return x.WifiSignal
}
return 0
}
func (x *Device) GetMode() string {
if x != nil {
return x.Mode
}
return ""
}
func (x *Device) GetEnabled() bool {
if x != nil {
return x.Enabled
}
return false
}
func (x *Device) GetRunning() bool {
if x != nil {
return x.Running
}
return false
}
func (x *Device) GetRunningState() string {
if x != nil {
return x.RunningState
}
return ""
}
func (x *Device) GetSetpoint() int32 {
if x != nil {
return x.Setpoint
}
return 0
}
func (x *Device) GetSetpointMin() int32 {
if x != nil {
return x.SetpointMin
}
return 0
}
func (x *Device) GetSetpointMax() int32 {
if x != nil {
return x.SetpointMax
}
return 0
}
func (x *Device) GetHotWaterAvailability() int32 {
if x != nil {
return x.HotWaterAvailability
}
return 0
}
func (x *Device) GetAlertCount() int32 {
if x != nil {
return x.AlertCount
}
return 0
}
func (x *Device) GetAway() bool {
if x != nil {
return x.Away
}
return false
}
func (x *Device) GetLastUpdated() *timestamppb.Timestamp {
if x != nil {
return x.LastUpdated
}
return nil
}
type ListDevicesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListDevicesRequest) Reset() {
*x = ListDevicesRequest{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListDevicesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListDevicesRequest) ProtoMessage() {}
func (x *ListDevicesRequest) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_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 ListDevicesRequest.ProtoReflect.Descriptor instead.
func (*ListDevicesRequest) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{1}
}
type ListDevicesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Devices []*Device `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListDevicesResponse) Reset() {
*x = ListDevicesResponse{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListDevicesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListDevicesResponse) ProtoMessage() {}
func (x *ListDevicesResponse) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_proto_msgTypes[2]
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 ListDevicesResponse.ProtoReflect.Descriptor instead.
func (*ListDevicesResponse) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{2}
}
func (x *ListDevicesResponse) GetDevices() []*Device {
if x != nil {
return x.Devices
}
return nil
}
type GetDeviceRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
SerialNumber string `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetDeviceRequest) Reset() {
*x = GetDeviceRequest{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetDeviceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetDeviceRequest) ProtoMessage() {}
func (x *GetDeviceRequest) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_proto_msgTypes[3]
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 GetDeviceRequest.ProtoReflect.Descriptor instead.
func (*GetDeviceRequest) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{3}
}
func (x *GetDeviceRequest) GetSerialNumber() string {
if x != nil {
return x.SerialNumber
}
return ""
}
type GetDeviceResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetDeviceResponse) Reset() {
*x = GetDeviceResponse{}
mi := &file_econet_v1alpha1_econet_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetDeviceResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetDeviceResponse) ProtoMessage() {}
func (x *GetDeviceResponse) ProtoReflect() protoreflect.Message {
mi := &file_econet_v1alpha1_econet_proto_msgTypes[4]
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 GetDeviceResponse.ProtoReflect.Descriptor instead.
func (*GetDeviceResponse) Descriptor() ([]byte, []int) {
return file_econet_v1alpha1_econet_proto_rawDescGZIP(), []int{4}
}
func (x *GetDeviceResponse) GetDevice() *Device {
if x != nil {
return x.Device
}
return nil
}
var File_econet_v1alpha1_econet_proto protoreflect.FileDescriptor
const file_econet_v1alpha1_econet_proto_rawDesc = "" +
"\n" +
"\x1ceconet/v1alpha1/econet.proto\x12\x0feconet.v1alpha1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xde\x04\n" +
"\x06Device\x12#\n" +
"\rserial_number\x18\x01 \x01(\tR\fserialNumber\x12\x1b\n" +
"\tdevice_id\x18\x02 \x01(\tR\bdeviceId\x12#\n" +
"\rfriendly_name\x18\x03 \x01(\tR\ffriendlyName\x12\x12\n" +
"\x04type\x18\x04 \x01(\tR\x04type\x12!\n" +
"\fgeneric_type\x18\x05 \x01(\tR\vgenericType\x12\x1c\n" +
"\tconnected\x18\x06 \x01(\bR\tconnected\x12\x1f\n" +
"\vwifi_signal\x18\a \x01(\x05R\n" +
"wifiSignal\x12\x12\n" +
"\x04mode\x18\b \x01(\tR\x04mode\x12\x18\n" +
"\aenabled\x18\t \x01(\bR\aenabled\x12\x18\n" +
"\arunning\x18\n" +
" \x01(\bR\arunning\x12#\n" +
"\rrunning_state\x18\v \x01(\tR\frunningState\x12\x1a\n" +
"\bsetpoint\x18\f \x01(\x05R\bsetpoint\x12!\n" +
"\fsetpoint_min\x18\r \x01(\x05R\vsetpointMin\x12!\n" +
"\fsetpoint_max\x18\x0e \x01(\x05R\vsetpointMax\x124\n" +
"\x16hot_water_availability\x18\x0f \x01(\x05R\x14hotWaterAvailability\x12\x1f\n" +
"\valert_count\x18\x10 \x01(\x05R\n" +
"alertCount\x12\x12\n" +
"\x04away\x18\x11 \x01(\bR\x04away\x12=\n" +
"\flast_updated\x18\x12 \x01(\v2\x1a.google.protobuf.TimestampR\vlastUpdated\"\x14\n" +
"\x12ListDevicesRequest\"H\n" +
"\x13ListDevicesResponse\x121\n" +
"\adevices\x18\x01 \x03(\v2\x17.econet.v1alpha1.DeviceR\adevices\"@\n" +
"\x10GetDeviceRequest\x12,\n" +
"\rserial_number\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\fserialNumber\"D\n" +
"\x11GetDeviceResponse\x12/\n" +
"\x06device\x18\x01 \x01(\v2\x17.econet.v1alpha1.DeviceR\x06device2\x83\x02\n" +
"\rEconetService\x12s\n" +
"\vListDevices\x12#.econet.v1alpha1.ListDevicesRequest\x1a$.econet.v1alpha1.ListDevicesResponse\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/v1alpha1/devices\x12}\n" +
"\tGetDevice\x12!.econet.v1alpha1.GetDeviceRequest\x1a\".econet.v1alpha1.GetDeviceResponse\")\x82\xd3\xe4\x93\x02#\x12!/v1alpha1/devices/{serial_number}B\xcb\x01\n" +
"\x13com.econet.v1alpha1B\vEconetProtoP\x01ZJgitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1\xa2\x02\x03EXX\xaa\x02\x0fEconet.V1alpha1\xca\x02\x0fEconet\\V1alpha1\xe2\x02\x1bEconet\\V1alpha1\\GPBMetadata\xea\x02\x10Econet::V1alpha1b\x06proto3"
var (
file_econet_v1alpha1_econet_proto_rawDescOnce sync.Once
file_econet_v1alpha1_econet_proto_rawDescData []byte
)
func file_econet_v1alpha1_econet_proto_rawDescGZIP() []byte {
file_econet_v1alpha1_econet_proto_rawDescOnce.Do(func() {
file_econet_v1alpha1_econet_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_econet_v1alpha1_econet_proto_rawDesc), len(file_econet_v1alpha1_econet_proto_rawDesc)))
})
return file_econet_v1alpha1_econet_proto_rawDescData
}
var file_econet_v1alpha1_econet_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_econet_v1alpha1_econet_proto_goTypes = []any{
(*Device)(nil), // 0: econet.v1alpha1.Device
(*ListDevicesRequest)(nil), // 1: econet.v1alpha1.ListDevicesRequest
(*ListDevicesResponse)(nil), // 2: econet.v1alpha1.ListDevicesResponse
(*GetDeviceRequest)(nil), // 3: econet.v1alpha1.GetDeviceRequest
(*GetDeviceResponse)(nil), // 4: econet.v1alpha1.GetDeviceResponse
(*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp
}
var file_econet_v1alpha1_econet_proto_depIdxs = []int32{
5, // 0: econet.v1alpha1.Device.last_updated:type_name -> google.protobuf.Timestamp
0, // 1: econet.v1alpha1.ListDevicesResponse.devices:type_name -> econet.v1alpha1.Device
0, // 2: econet.v1alpha1.GetDeviceResponse.device:type_name -> econet.v1alpha1.Device
1, // 3: econet.v1alpha1.EconetService.ListDevices:input_type -> econet.v1alpha1.ListDevicesRequest
3, // 4: econet.v1alpha1.EconetService.GetDevice:input_type -> econet.v1alpha1.GetDeviceRequest
2, // 5: econet.v1alpha1.EconetService.ListDevices:output_type -> econet.v1alpha1.ListDevicesResponse
4, // 6: econet.v1alpha1.EconetService.GetDevice:output_type -> econet.v1alpha1.GetDeviceResponse
5, // [5:7] is the sub-list for method output_type
3, // [3:5] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_econet_v1alpha1_econet_proto_init() }
func file_econet_v1alpha1_econet_proto_init() {
if File_econet_v1alpha1_econet_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_econet_v1alpha1_econet_proto_rawDesc), len(file_econet_v1alpha1_econet_proto_rawDesc)),
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_econet_v1alpha1_econet_proto_goTypes,
DependencyIndexes: file_econet_v1alpha1_econet_proto_depIdxs,
MessageInfos: file_econet_v1alpha1_econet_proto_msgTypes,
}.Build()
File_econet_v1alpha1_econet_proto = out.File
file_econet_v1alpha1_econet_proto_goTypes = nil
file_econet_v1alpha1_econet_proto_depIdxs = nil
}
+229
View File
@@ -0,0 +1,229 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: econet/v1alpha1/econet.proto
/*
Package v1alpha1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package v1alpha1
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
)
func request_EconetService_ListDevices_0(ctx context.Context, marshaler runtime.Marshaler, client EconetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListDevicesRequest
metadata runtime.ServerMetadata
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.ListDevices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EconetService_ListDevices_0(ctx context.Context, marshaler runtime.Marshaler, server EconetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListDevicesRequest
metadata runtime.ServerMetadata
)
msg, err := server.ListDevices(ctx, &protoReq)
return msg, metadata, err
}
func request_EconetService_GetDevice_0(ctx context.Context, marshaler runtime.Marshaler, client EconetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetDeviceRequest
metadata runtime.ServerMetadata
err error
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["serial_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serial_number")
}
protoReq.SerialNumber, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serial_number", err)
}
msg, err := client.GetDevice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EconetService_GetDevice_0(ctx context.Context, marshaler runtime.Marshaler, server EconetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetDeviceRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["serial_number"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "serial_number")
}
protoReq.SerialNumber, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "serial_number", err)
}
msg, err := server.GetDevice(ctx, &protoReq)
return msg, metadata, err
}
// RegisterEconetServiceHandlerServer registers the http handlers for service EconetService to "mux".
// UnaryRPC :call EconetServiceServer 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 RegisterEconetServiceHandlerFromEndpoint 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 RegisterEconetServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EconetServiceServer) error {
mux.Handle(http.MethodGet, pattern_EconetService_ListDevices_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, "/econet.v1alpha1.EconetService/ListDevices", runtime.WithHTTPPathPattern("/v1alpha1/devices"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EconetService_ListDevices_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_EconetService_ListDevices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_EconetService_GetDevice_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, "/econet.v1alpha1.EconetService/GetDevice", runtime.WithHTTPPathPattern("/v1alpha1/devices/{serial_number}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EconetService_GetDevice_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_EconetService_GetDevice_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterEconetServiceHandlerFromEndpoint is same as RegisterEconetServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterEconetServiceHandlerFromEndpoint(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 RegisterEconetServiceHandler(ctx, mux, conn)
}
// RegisterEconetServiceHandler registers the http handlers for service EconetService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterEconetServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterEconetServiceHandlerClient(ctx, mux, NewEconetServiceClient(conn))
}
// RegisterEconetServiceHandlerClient registers the http handlers for service EconetService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EconetServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EconetServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "EconetServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterEconetServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EconetServiceClient) error {
mux.Handle(http.MethodGet, pattern_EconetService_ListDevices_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, "/econet.v1alpha1.EconetService/ListDevices", runtime.WithHTTPPathPattern("/v1alpha1/devices"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EconetService_ListDevices_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EconetService_ListDevices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_EconetService_GetDevice_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, "/econet.v1alpha1.EconetService/GetDevice", runtime.WithHTTPPathPattern("/v1alpha1/devices/{serial_number}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EconetService_GetDevice_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EconetService_GetDevice_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_EconetService_ListDevices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1alpha1", "devices"}, ""))
pattern_EconetService_GetDevice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "devices", "serial_number"}, ""))
)
var (
forward_EconetService_ListDevices_0 = runtime.ForwardResponseMessage
forward_EconetService_GetDevice_0 = runtime.ForwardResponseMessage
)
+161
View File
@@ -0,0 +1,161 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// source: econet/v1alpha1/econet.proto
package v1alpha1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
EconetService_ListDevices_FullMethodName = "/econet.v1alpha1.EconetService/ListDevices"
EconetService_GetDevice_FullMethodName = "/econet.v1alpha1.EconetService/GetDevice"
)
// EconetServiceClient is the client API for EconetService service.
//
// 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.
//
// EconetService exposes read-only access to Rheem EcoNet device state.
type EconetServiceClient interface {
ListDevices(ctx context.Context, in *ListDevicesRequest, opts ...grpc.CallOption) (*ListDevicesResponse, error)
GetDevice(ctx context.Context, in *GetDeviceRequest, opts ...grpc.CallOption) (*GetDeviceResponse, error)
}
type econetServiceClient struct {
cc grpc.ClientConnInterface
}
func NewEconetServiceClient(cc grpc.ClientConnInterface) EconetServiceClient {
return &econetServiceClient{cc}
}
func (c *econetServiceClient) ListDevices(ctx context.Context, in *ListDevicesRequest, opts ...grpc.CallOption) (*ListDevicesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListDevicesResponse)
err := c.cc.Invoke(ctx, EconetService_ListDevices_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *econetServiceClient) GetDevice(ctx context.Context, in *GetDeviceRequest, opts ...grpc.CallOption) (*GetDeviceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetDeviceResponse)
err := c.cc.Invoke(ctx, EconetService_GetDevice_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// EconetServiceServer is the server API for EconetService service.
// All implementations should embed UnimplementedEconetServiceServer
// for forward compatibility.
//
// EconetService exposes read-only access to Rheem EcoNet device state.
type EconetServiceServer interface {
ListDevices(context.Context, *ListDevicesRequest) (*ListDevicesResponse, error)
GetDevice(context.Context, *GetDeviceRequest) (*GetDeviceResponse, error)
}
// UnimplementedEconetServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedEconetServiceServer struct{}
func (UnimplementedEconetServiceServer) ListDevices(context.Context, *ListDevicesRequest) (*ListDevicesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListDevices not implemented")
}
func (UnimplementedEconetServiceServer) GetDevice(context.Context, *GetDeviceRequest) (*GetDeviceResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetDevice not implemented")
}
func (UnimplementedEconetServiceServer) testEmbeddedByValue() {}
// UnsafeEconetServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to EconetServiceServer will
// result in compilation errors.
type UnsafeEconetServiceServer interface {
mustEmbedUnimplementedEconetServiceServer()
}
func RegisterEconetServiceServer(s grpc.ServiceRegistrar, srv EconetServiceServer) {
// If the following call panics, it indicates UnimplementedEconetServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&EconetService_ServiceDesc, srv)
}
func _EconetService_ListDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListDevicesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EconetServiceServer).ListDevices(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EconetService_ListDevices_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EconetServiceServer).ListDevices(ctx, req.(*ListDevicesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _EconetService_GetDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDeviceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EconetServiceServer).GetDevice(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EconetService_GetDevice_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EconetServiceServer).GetDevice(ctx, req.(*GetDeviceRequest))
}
return interceptor(ctx, in, info, handler)
}
// EconetService_ServiceDesc is the grpc.ServiceDesc for EconetService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var EconetService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "econet.v1alpha1.EconetService",
HandlerType: (*EconetServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ListDevices",
Handler: _EconetService_ListDevices_Handler,
},
{
MethodName: "GetDevice",
Handler: _EconetService_GetDevice_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "econet/v1alpha1/econet.proto",
}
+1 -1
View File
@@ -22,7 +22,7 @@ plugins:
- remote: buf.build/grpc-ecosystem/openapiv2
out: contrib/
opt:
- merge_file_name=go-server-with-otel
- merge_file_name=econet-exporter
- allow_merge=true
inputs:
- directory: proto
+6 -6
View File
@@ -2,11 +2,11 @@
version: v2
deps:
- name: buf.build/bufbuild/protovalidate
commit: 6c6e0d3c608e4549802254a2eee81bc8
digest: b5:a7ca081f38656fc0f5aaa685cc111d3342876723851b47ca6b80cbb810cbb2380f8c444115c495ada58fa1f85eff44e68dc54a445761c195acdb5e8d9af675b6
commit: 50325440f8f24053b047484a6bf60b76
digest: b5:74cb6f5c0853c3c10aafc701614194bbd63326bdb8ef4068214454b8894b03ba4113e04b3a33a8321cdf05336e37db4dc14a5e2495db8462566914f36086ba31
- name: buf.build/googleapis/googleapis
commit: 61b203b9a9164be9a834f58c37be6f62
digest: b5:7811a98b35bd2e4ae5c3ac73c8b3d9ae429f3a790da15de188dc98fc2b77d6bb10e45711f14903af9553fa9821dff256054f2e4b7795789265bc476bec2f088c
commit: c17df5b2beca46928cc87d5656bd5343
digest: b5:648a01e0170d4512dea7d564016165decd1ed6e34bef79fe54753e51ad7e27545709ad9157d7551270147d551155c595a2fb0bf5bb33b1c83040ddbce915c604
- name: buf.build/grpc-ecosystem/grpc-gateway
commit: 4c5ba75caaf84e928b7137ae5c18c26a
digest: b5:c113e62fb3b29289af785866cae062b55ec8ae19ab3f08f3004098928fbca657730a06810b2012951294326b95669547194fa84476b9e9b688d4f8bf77a0691d
commit: 4836b6d552304e1bbe47e66a523f0daa
digest: b5:c3fefd4d3dfa9b0478bbb1a4ad87d7b38146e3ce6eff4214e32f2c5834c2e4afc3be218316f0fbd53e925a001c3ed1e2fc99fb76b3121ede642989f0d0d7c71c
+8 -7
View File
@@ -1,16 +1,16 @@
# yaml-language-server: $schema=contrib/schema.json
# Custom demo-app config
timezone: EST5EDT
opts:
factLang: en
factType: random
# Econet exporter config
# NOTE: Prefer setting econetPassword via the ECONET_PASSWORD env var
econetEmail: ""
costPerKWH: 0.0 # US dollars per kWh (e.g. 0.18 = 18 cents), not cents
usageInterval: 5m
# go-app config
name: Demo go-app
name: econet-exporter
logging:
format: console
level: trace
level: info
enabled: true
otel:
enabled: true
@@ -24,6 +24,7 @@ grpc:
enableReflection: true
listen: :8081
grpcGatewayPath: /api
grpcGatewayPathStrip: true # strip /api before the gateway mux matches routes
enableGRPCGateway: true
enableInstrumentation: true
enableProtovalidate: true
+195
View File
@@ -0,0 +1,195 @@
{
"swagger": "2.0",
"info": {
"title": "econet/v1alpha1/econet.proto",
"version": "version not set"
},
"tags": [
{
"name": "EconetService"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1alpha1/devices": {
"get": {
"operationId": "EconetService_ListDevices",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1alpha1ListDevicesResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"EconetService"
]
}
},
"/v1alpha1/devices/{serialNumber}": {
"get": {
"operationId": "EconetService_GetDevice",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1alpha1GetDeviceResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "serialNumber",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"EconetService"
]
}
}
},
"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"
}
}
}
},
"v1alpha1Device": {
"type": "object",
"properties": {
"serialNumber": {
"type": "string"
},
"deviceId": {
"type": "string"
},
"friendlyName": {
"type": "string"
},
"type": {
"type": "string",
"title": "water_heater, thermostat, unknown"
},
"genericType": {
"type": "string",
"title": "e.g. heatpumpWaterHeater, gasWaterHeater"
},
"connected": {
"type": "boolean"
},
"wifiSignal": {
"type": "integer",
"format": "int32",
"title": "dB, MQTT-only"
},
"mode": {
"type": "string",
"title": "kebab-case, e.g. heat-pump, energy-saving"
},
"enabled": {
"type": "boolean"
},
"running": {
"type": "boolean"
},
"runningState": {
"type": "string"
},
"setpoint": {
"type": "integer",
"format": "int32",
"title": "degrees Fahrenheit"
},
"setpointMin": {
"type": "integer",
"format": "int32"
},
"setpointMax": {
"type": "integer",
"format": "int32"
},
"hotWaterAvailability": {
"type": "integer",
"format": "int32",
"title": "0/33/66/100, -1 unknown"
},
"alertCount": {
"type": "integer",
"format": "int32"
},
"away": {
"type": "boolean"
},
"lastUpdated": {
"type": "string",
"format": "date-time"
}
},
"description": "Device is the live state of a single Rheem EcoNet device\n(typically a water heater) as reported by the Rheem cloud."
},
"v1alpha1GetDeviceResponse": {
"type": "object",
"properties": {
"device": {
"$ref": "#/definitions/v1alpha1Device"
}
}
},
"v1alpha1ListDevicesResponse": {
"type": "object",
"properties": {
"devices": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1alpha1Device"
}
}
}
}
}
}
-99
View File
@@ -1,99 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "demo/app/v1alpha1/app.proto",
"version": "version not set"
},
"tags": [
{
"name": "DemoAppService"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1alpha1/demo": {
"get": {
"operationId": "DemoAppService_GetDemo",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1alpha1GetDemoResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "language",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"DemoAppService"
]
}
}
},
"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"
}
}
}
},
"v1alpha1GetDemoResponse": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "date-time"
},
"fact": {
"type": "string"
},
"source": {
"type": "string"
},
"language": {
"type": "string"
}
},
"title": "Returns a randome fact, because this is a demo app\nso what else do we do?"
}
}
}
+30 -23
View File
@@ -1,22 +1,5 @@
{
"definitions": {
"ConfigDemoOpts": {
"properties": {
"factLang": {
"default": "en",
"type": "string"
},
"factType": {
"default": "random",
"enum": [
"today",
"random"
],
"type": "string"
}
},
"type": "object"
},
"ConfigGRPCConfig": {
"properties": {
"enableGRPCGateway": {
@@ -41,6 +24,10 @@
"default": "/grpc-api",
"type": "string"
},
"grpcGatewayPathStrip": {
"default": false,
"type": "boolean"
},
"listen": {
"type": "string"
},
@@ -52,6 +39,21 @@
},
"ConfigHTTPConfig": {
"properties": {
"corsAllowCredentials": {
"type": "boolean"
},
"corsAllowPrivateNetwork": {
"type": "boolean"
},
"corsAllowedOrigins": {
"items": {
"type": "string"
},
"type": "array"
},
"corsEnabled": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
@@ -121,6 +123,15 @@
}
},
"properties": {
"costPerKWH": {
"type": "number"
},
"econetEmail": {
"type": "string"
},
"econetPassword": {
"type": "string"
},
"environment": {
"type": "string"
},
@@ -136,15 +147,11 @@
"name": {
"type": "string"
},
"opts": {
"$ref": "#/definitions/ConfigDemoOpts"
},
"otel": {
"$ref": "#/definitions/ConfigOTELConfig"
},
"timezone": {
"default": "UTC",
"type": "string"
"usageInterval": {
"type": "integer"
},
"version": {
"type": "string"
+9 -3
View File
@@ -1,14 +1,20 @@
# App Config
APP_NAME="go-server-with-otel"
APP_LOG_LEVEL=trace ## For testing only
APP_NAME="econet-exporter"
APP_LOG_LEVEL=info ## trace, debug, info, warn, error
APP_LOG_FORMAT=console ## console, json
APP_LOG_TIME_FORMAT=long ## long, short, unix, rfc3339, off
# Econet exporter config
ECONET_EMAIL="you@example.com"
ECONET_PASSWORD="changeme"
ECONET_COST_PER_KWH=0.12 ## US dollars per kWh (0.12 = 12 cents), for econet_energy_cost_dollars
ECONET_USAGE_INTERVAL=5m ## how often to poll energy/water usage history
# App OTEL Config
APP_OTEL_STDOUT_ENABLED=true ## For testing only
APP_OTEL_METRIC_INTERVAL_SECS=15
# OTEL SDK Config
OTEL_EXPORTER_OTLP_ENDPOINT="otel-collector.otel.svc.cluster.local" # Set to your otel collector
OTEL_SERVICE_NAME="go-server-with-otel"
OTEL_SERVICE_NAME="econet-exporter"
OTEL_RESOURCE_ATTRIBUTES="env=development,service.version=(devel)"
+54 -48
View File
@@ -1,73 +1,79 @@
module gitea.libretechconsulting.com/rmcguire/go-server-with-otel
module gitea.libretechconsulting.com/rmcguire/econet-exporter
go 1.25
go 1.26
require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.8-20250717185734-6c6e0d3c608e.1
gitea.libretechconsulting.com/rmcguire/go-app v0.12.3
github.com/go-resty/resty/v2 v2.16.5
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2
github.com/modelcontextprotocol/go-sdk v0.3.1
github.com/rs/zerolog v1.34.0
go.opentelemetry.io/otel/trace v1.38.0
google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1
google.golang.org/grpc v1.75.0
google.golang.org/protobuf v1.36.8
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260415201107-50325440f8f2.1
gitea.libretechconsulting.com/rmcguire/go-app v0.17.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0
github.com/kevinburke/rheemcloud-go v0.1.1
github.com/modelcontextprotocol/go-sdk v1.6.1
github.com/rs/zerolog v1.35.1
go.opentelemetry.io/otel/metric v1.44.0
go.opentelemetry.io/otel/trace v1.44.0
google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7
google.golang.org/grpc v1.82.0
google.golang.org/protobuf v1.36.11
k8s.io/utils v0.0.0-20260626114624-be93311217bd
)
require (
github.com/caarlos0/env/v11 v11.3.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
github.com/swaggest/jsonschema-go v0.3.78 // indirect
github.com/caarlos0/env/v11 v11.4.1
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect
github.com/swaggest/jsonschema-go v0.3.79 // indirect
github.com/swaggest/refl v1.4.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
go.opentelemetry.io/otel v1.38.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect
go.opentelemetry.io/otel v1.44.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.44.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.66.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.44.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.44.0 // indirect
go.opentelemetry.io/otel/sdk v1.44.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.44.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
require (
buf.build/go/protovalidate v0.14.0 // indirect
cel.dev/expr v0.24.0 // indirect
buf.build/go/protovalidate v1.2.0 // indirect
cel.dev/expr v0.25.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/eclipse/paho.mqtt.golang v1.5.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/cel-go v0.26.1 // indirect
github.com/google/jsonschema-go v0.2.1-0.20250825175020-748c325cec76 // indirect
github.com/google/cel-go v0.29.1 // indirect
github.com/google/jsonschema-go v0.4.3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/kevinburke/rest v0.0.0-20260604005914-d145d8a0294b // indirect
github.com/mattn/go-colorable v0.1.15 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_golang v1.23.0 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.65.0 // indirect
github.com/prometheus/otlptranslator v0.0.2 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
github.com/stoewer/go-strcase v1.3.1 // indirect
github.com/prometheus/common v0.69.0 // indirect
github.com/prometheus/otlptranslator v1.0.0 // indirect
github.com/prometheus/procfs v0.21.1 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/segmentio/asm v1.2.1 // indirect
github.com/segmentio/encoding v0.5.4 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 // indirect
golang.org/x/exp v0.0.0-20260611194520-c48552f49976 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/text v0.38.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
)
+122 -122
View File
@@ -1,59 +1,62 @@
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.8-20250717185734-6c6e0d3c608e.1 h1:sjY1k5uszbIZfv11HO2keV4SLhNA47SabPO886v7Rvo=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.8-20250717185734-6c6e0d3c608e.1/go.mod h1:8EQ5GzyGJQ5tEIwMSxCl8RKJYsjCpAwkdcENoioXT6g=
buf.build/go/protovalidate v0.14.0 h1:kr/rC/no+DtRyYX+8KXLDxNnI1rINz0imk5K44ZpZ3A=
buf.build/go/protovalidate v0.14.0/go.mod h1:+F/oISho9MO7gJQNYC2VWLzcO1fTPmaTA08SDYJZncA=
cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY=
cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
gitea.libretechconsulting.com/rmcguire/go-app v0.12.1 h1:OWXz8S3NAlBAjIxY7G6ydO18t5/JiJ8f3EMKDeppEg8=
gitea.libretechconsulting.com/rmcguire/go-app v0.12.1/go.mod h1:T8K2vbmt0mApScJDGqfmNlvX5gdJSImjArUMpgfYs8U=
gitea.libretechconsulting.com/rmcguire/go-app v0.12.3 h1:sgSpPx6fkWqfBGsCAHqLOIQ6a1s+4nsG9kW24k+WYI8=
gitea.libretechconsulting.com/rmcguire/go-app v0.12.3/go.mod h1:+zDxLaJgxfPVWzp2YQrUYBFN9A1c7hZgsQkysWz+lSI=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260415201107-50325440f8f2.1 h1:s6hzCXtND/ICdGPTMGk7C+/BFlr2Jg5GyH0NKf4XGXg=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260415201107-50325440f8f2.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM=
buf.build/go/protovalidate v1.2.0 h1:DQVrUWkmGTBij+kOYv/x2LLxwcLaGKMdzShj1/6/3H0=
buf.build/go/protovalidate v1.2.0/go.mod h1:7rYiQEhqvAipoazpVNBBH2S2f8bjG4huMVy1V2Yofn4=
cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs=
cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
gitea.libretechconsulting.com/rmcguire/go-app v0.17.1 h1:OdUNAXRoDpB5sC3KdaJC7Rav8MmxiRZC0fRx9YNH1Ks=
gitea.libretechconsulting.com/rmcguire/go-app v0.17.1/go.mod h1:YBygVa9JBYAP+ibF8FevN1KUe3h5GHWxAdFyU6I8QgA=
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
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/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/dev v0.2.43 h1:yQ7qiZVef6WtCl2vDYU0Y+qSq+0aBrQzY8KXkklk9cQ=
github.com/bool64/dev v0.2.43/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/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/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4=
github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
github.com/caarlos0/env/v11 v11.4.1 h1:fYwH0sWEsBSMPG7t4e/PEfTFzrWrpjyygXyUnWiSwEw=
github.com/caarlos0/env/v11 v11.4.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
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/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE=
github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU=
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
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/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ=
github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
github.com/google/cel-go v0.29.1 h1:8Gx3S5HPop5XPOHtZI8vkaGk+DBW/nn9fkpNPbh5dBk=
github.com/google/cel-go v0.29.1/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8=
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/jsonschema-go v0.2.1-0.20250825175020-748c325cec76 h1:mBlBwtDebdDYr+zdop8N62a44g+Nbv7o2KjWyS1deR4=
github.com/google/jsonschema-go v0.2.1-0.20250825175020-748c325cec76/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0=
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
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/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248=
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk=
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0=
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns=
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs=
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/kevinburke/rest v0.0.0-20260604005914-d145d8a0294b h1:9ZWwhlz+lmPlXCz37dkRVMgK+iIwkFyQBogC2oWds/A=
github.com/kevinburke/rest v0.0.0-20260604005914-d145d8a0294b/go.mod h1:x35n2Fa5sM/IwpMDk6B9f7n6FkcBFX3yV9diIRfqxQc=
github.com/kevinburke/rheemcloud-go v0.1.1 h1:PsrpOso9rEeyATlAfDHjKx5E8C2TJseDwfeRvw4uzH4=
github.com/kevinburke/rheemcloud-go v0.1.1/go.mod h1:17QQqbT/YPQDnR3m+67EV7Wuve0onhKeiLAMcy1br1U=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -62,51 +65,46 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modelcontextprotocol/go-sdk v0.3.1 h1:0z04yIPlSwTluuelCBaL+wUag4YeflIU2Fr4Icb7M+o=
github.com/modelcontextprotocol/go-sdk v0.3.1/go.mod h1:whv0wHnsTphwq7CTiKYHkLtwLC06WMoY2KpO+RB9yXQ=
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/modelcontextprotocol/go-sdk v1.6.1 h1:0zOSupjKUxPKSocPT1Wtago+mUHU2/uZ4xSOY0FGReU=
github.com/modelcontextprotocol/go-sdk v1.6.1/go.mod h1:kzm3kzFL1/+AziGOE0nUs3gvPoNxMCvkxokMkuFapXQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc=
github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE=
github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
github.com/prometheus/otlptranslator v0.0.2 h1:+1CdeLVrRQ6Psmhnobldo0kTp96Rj80DRXRd5OSnMEQ=
github.com/prometheus/otlptranslator v0.0.2/go.mod h1:P8AwMgdD7XEr6QRUJ2QWLpiAZTgTE2UYgjlu3svompI=
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
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/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
github.com/prometheus/common v0.69.0 h1:OA85nJQS/T/MaYh/Q2CcgDKSGWqNIgrBDvDH85CuiNk=
github.com/prometheus/common v0.69.0/go.mod h1:ZzL3f6u94qUxh9p+tJTrF+FvBS1XXbbRAZCQkytAL0Y=
github.com/prometheus/otlptranslator v1.0.0 h1:s0LJW/iN9dkIH+EnhiD3BlkkP5QVIUVEoIwkU+A6qos=
github.com/prometheus/otlptranslator v1.0.0/go.mod h1:vRYWnXvI6aWGpsdY/mOT/cbeVRBlPWtBNDb7kGR3uKM=
github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=
github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=
github.com/rodaine/protogofakeit v0.1.1 h1:ZKouljuRM3A+TArppfBqnH8tGZHOwM/pjvtXe9DaXH8=
github.com/rodaine/protogofakeit v0.1.1/go.mod h1:pXn/AstBYMaSfc1/RqH3N82pBuxtWgejz1AlYpY1mI0=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI=
github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw=
github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0=
github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0=
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/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs=
github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
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.78 h1:5+YFQrLxOR8z6CHvgtZc42WRy/Q9zRQQ4HoAxlinlHw=
github.com/swaggest/jsonschema-go v0.3.78/go.mod h1:4nniXBuE+FIGkOGuidjOINMH7OEqZK3HCSbfDuLRI0g=
github.com/swaggest/jsonschema-go v0.3.79 h1:0TOShCbAJ9Xjt1e2W83l+QtMQSG2pbun2EkiYTyafCs=
github.com/swaggest/jsonschema-go v0.3.79/go.mod h1:GqVmJ+XNLeUHhFIhHNKc+C68euxfrl3a3aoZH4vTRl0=
github.com/swaggest/refl v1.4.0 h1:CftOSdTqRqs100xpFOT/Rifss5xBV/CT0S/FN60Xe9k=
github.com/swaggest/refl v1.4.0/go.mod h1:4uUVFVfPJ0NSX9FPwMPspeHos9wPFlCMGoPRllUbpvA=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
@@ -115,72 +113,74 @@ github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCO
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/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 h1:YH4g8lQroajqUwWbq/tr2QX1JFmEXaDLgG+ew9bLMWo=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0/go.mod h1:fvPi2qXDqFs8M4B4fmJhE92TyQs9Ydjlg3RvfUp+NbQ=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0/go.mod h1:GAXRxmLJcVM3u22IjTg74zWBrRCKq8BnOqUVLodpcpw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk=
go.opentelemetry.io/otel/exporters/prometheus v0.60.0 h1:cGtQxGvZbnrWdC2GyjZi0PDKVSLWP/Jocix3QWfXtbo=
go.opentelemetry.io/otel/exporters/prometheus v0.60.0/go.mod h1:hkd1EekxNo69PTV4OWFGZcKQiIqg0RfuWExcPKFvepk=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 h1:wm/Q0GAAykXv83wzcKzGGqAnnfLFyFe7RslekZuv+VI=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0/go.mod h1:ra3Pa40+oKjvYh+ZD3EdxFZZB0xdMfuileHAm4nNN7w=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 h1:kJxSDN4SgWWTjG/hPp3O7LCGLcHXFlvS2/FFOrwL+SE=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0/go.mod h1:mgIOzS7iZeKJdeB8/NYHrJ48fdGc71Llo5bJ1J4DWUE=
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0 h1:2yEATaop1/a1I4psnSLgWVPLWwCzkqWakgJy7xTDVy0=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0/go.mod h1:D7J12YRapIekYyPWgGPlA/23pRmpSEZC5xJC/TTLI9U=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI=
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.44.0 h1:SUplec5dp06reu1zaXmOXdvqH398taqrDXqUl99jxSc=
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.44.0/go.mod h1:ho2g4N+ane+swq5I/VBkKWnRDY4kUINH3FuqyZqX/Ug=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 h1:4YsVu3B8+3qtWYYrsUYgn0OG78pN0rnNPRGX4SbokQI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0/go.mod h1:+wnlSn0mD1ADVMe3v9Z/WIaiz6q6gL2J/ejaAmdmv80=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 h1:qazEJlUOQzhCpzQpFETGby7EdqjI1wsd0W+6Gg1SCTU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0/go.mod h1:fOD2Yefuxixkx3ahVNf0O/PERb6r4OlbxfATVnYvzCo=
go.opentelemetry.io/otel/exporters/prometheus v0.66.0 h1:vkrK8PAznv2NKt2r+kdu252ccGzkEqLc2aSXbQIALYQ=
go.opentelemetry.io/otel/exporters/prometheus v0.66.0/go.mod h1:V/UB6D3vMF/UBOL5igAsAYnk1nG/bzYYTzvsB16cy7o=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.44.0 h1:hqxVTu/GtBF+vJ8d1fzW7fRxZFvgoDjWcxwwCaFDYpU=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.44.0/go.mod h1:z5fVEF4X5v0ESvlJqBrrFlBVoj5EQuefZpzsu7R+x5Q=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.44.0 h1:bl2S7Ubua0Nms+D/gAmznQTd4dxxMA93aKbcpKqiTCs=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.44.0/go.mod h1:L0hRV50XdVIODHUfWEqGRCXQvj2rV82STVo12FMFBU0=
go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
go.opentelemetry.io/otel/metric/x v0.66.0 h1:YkCrx1zLOChi9ZcZ6euupOcsgzbVlec7D/xoEU1+cTA=
go.opentelemetry.io/otel/metric/x v0.66.0/go.mod h1:d1+BDj9t96do0/1LoU1ayfCv79ZgNE41qbhBvnMOBZk=
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
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.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
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/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 h1:APHvLLYBhtZvsbnpkfknDZ7NyH4z5+ub/I0u8L3Oz6g=
google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1/go.mod h1:xUjFWUnWDpZ/C0Gu0qloASKFb6f8/QXiiXhSPFsD668=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 h1:pmJpJEvT846VzausCQ5d7KreSROcDqmO388w5YbnltA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og=
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
golang.org/x/exp v0.0.0-20260611194520-c48552f49976 h1:X8Hz2ImujgbmetVuW+w2YkyZChE3cBpZi2P158rTG9M=
golang.org/x/exp v0.0.0-20260611194520-c48552f49976/go.mod h1:vnf4pv9iKZXY58sQE1L86zmNWJ4159e1RkcWiLCkeEY=
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE=
golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4=
golang.org/x/tools v0.46.0 h1:7jTurBkPZu4moS/Uy4OQT1M+QBlsj3wejyZwsT8Z7rk=
golang.org/x/tools v0.46.0/go.mod h1:FrD85F8l+NWL+9XWBSyVSHO6Ne4jutsfIFba7AWQ5Ys=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 h1:jQ9p21COKWjP3VwuFrNRiiOTMh3mPpN45R7SLrH/HUU=
google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7/go.mod h1:KqHwBx2upmfa1XSi1WuRvC+2VGCLtooKkfmyvRbUmqA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7 h1:eM/YSd5bBFagF51o1E745Ta7RwzpW0h+z+QDNZOgmQ8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.82.0 h1:vguDnZUPjE26w09A63VoxZPnvPjB5Riyc0mkXPFmAIU=
google.golang.org/grpc v1.82.0/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
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/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d h1:wAhiDyZ4Tdtt7e46e9M5ZSAJ/MnPGPs+Ki1gHw4w1R0=
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20260626114624-be93311217bd h1:Ea7fgQ5we8Y9T0OX5o0dAHzQOBRI07D/dEYRaB9ZZEs=
k8s.io/utils v0.0.0-20260626114624-be93311217bd/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
+1 -1
View File
@@ -1,5 +1,5 @@
apiVersion: v2
name: go-server-with-otel
name: econet-exporter
description: Golang HTTP and GRPC server with OTEL
# A chart can be either an 'application' or a 'library' chart.
+9 -9
View File
@@ -1,15 +1,15 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/vidispine/hull/refs/heads/main/hull/values.schema.json
hull:
config:
## go-server-with-otel custom settings (config.yaml)
## econet-exporter custom settings (config.yaml)
appConfig:
# Custom app config
timezone: EST5EDT
opts:
factLang: en
factType: random
# NOTE: Prefer supplying econetPassword via the ECONET_PASSWORD env var
econetEmail: ""
costPerKWH: 0.0
usageInterval: 5m
# go-app config
name: Demo go-app
name: econet-exporter
logging:
format: json
level: debug
@@ -32,7 +32,7 @@ hull:
## Chart settings
settings:
resources: {} # Applies to the app container
repo: gitea.libretechconsulting.com/rmcguire/go-server-with-otel
repo: gitea.libretechconsulting.com/rmcguire/econet-exporter
tag: _HT**Chart.AppVersion
httpPort: 8080 # Should match appConfig http.listen
@@ -54,8 +54,8 @@ hull:
gatewayName: istio-ingressgateway
gatewayNamespace: istio-system
otelServiceName: go-server-with-otel
otelResourceAttributes: app=go-server-with-otel
otelServiceName: econet-exporter
otelResourceAttributes: app=econet-exporter
otlpEndpoint: http://otel.otel.svc.cluster.local:4317 # Replace me
serviceType: ClusterIP
+11 -7
View File
@@ -27,14 +27,14 @@ import (
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/app"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/service"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/config"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/econet"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/service"
)
const (
terminationGracePeriod = 30 * time.Second
appName = "demo-app"
appName = "econet-exporter"
)
var (
@@ -43,7 +43,7 @@ var (
// NOTE: At least one service needs to add a dial option
// for transport credentials, otherwise you will have to do it here
appServices = []service.AppService{
&demo.DemoService{},
&econet.EconetService{},
}
flagSchema bool
@@ -54,9 +54,13 @@ func main() {
defer cncl()
// Load configuration and setup logging. The go-app framework
// will handle loading config and environment into our demo
// app config struct which embeds app.AooConfig
// loads config file + environment into the embedded AppConfig; env
// overrides for our custom ServiceConfig fields are the caller's
// responsibility, hence the LoadEnv call below.
ctx, serviceConfig := app.MustLoadConfigInto(ctx, &config.ServiceConfig{})
if err := serviceConfig.LoadEnv(); err != nil {
panic(err)
}
// Print schema if that's all we have to do
if flagSchema {
+36 -11
View File
@@ -5,12 +5,30 @@
package config
import (
"time"
"github.com/caarlos0/env/v11"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/config"
)
// DefaultUsageInterval is used when UsageInterval is unset. Rheem's
// energy/water history only updates hourly, so polling faster is wasteful.
const DefaultUsageInterval = 5 * time.Minute
type ServiceConfig struct {
Timezone string `yaml:"timezone" json:"timezone,omitempty" default:"UTC"`
Opts *DemoOpts `yaml:"opts" json:"opts,omitempty"`
// Rheem EcoNet cloud credentials. Prefer supplying the password via
// the ECONET_PASSWORD environment variable rather than config.yaml.
EconetEmail string `yaml:"econetEmail" json:"econetEmail,omitempty" env:"ECONET_EMAIL"`
EconetPassword string `yaml:"econetPassword" json:"econetPassword,omitempty" env:"ECONET_PASSWORD"`
// CostPerKWH is the electricity price in US dollars per kWh (e.g. 0.18
// means 18 cents/kWh, NOT 18). It derives the econet_energy_cost_dollars
// metric from kWh energy usage.
CostPerKWH float64 `yaml:"costPerKWH" json:"costPerKWH,omitempty" env:"ECONET_COST_PER_KWH"`
// UsageInterval controls how often energy/water usage history is polled.
UsageInterval time.Duration `yaml:"usageInterval" json:"usageInterval,omitempty" env:"ECONET_USAGE_INTERVAL"`
// Embeds go-app config, used by go-app to
// merge custom config into go-app config, and to produce
@@ -18,14 +36,21 @@ type ServiceConfig struct {
*config.AppConfig
}
type DemoOpts struct {
FactLang string `yaml:"factLang" json:"factLang,omitempty" default:"en"`
FactType FactType `yaml:"factType" json:"factType,omitempty" default:"random" enum:"today,random"`
// LoadEnv applies environment-variable overrides to the custom ServiceConfig
// fields. go-app's MustLoadConfigInto only handles env for the embedded
// AppConfig, so the caller must apply env for custom fields. The embedded
// AppConfig is skipped here to preserve go-app's own env/yaml precedence.
func (c *ServiceConfig) LoadEnv() error {
appConfig := c.AppConfig
c.AppConfig = nil
defer func() { c.AppConfig = appConfig }()
return env.Parse(c)
}
type FactType string
const (
TypeToday FactType = "today"
TypeRandom FactType = "random"
)
// GetUsageInterval returns the configured usage poll interval or the default.
func (c *ServiceConfig) GetUsageInterval() time.Duration {
if c.UsageInterval <= 0 {
return DefaultUsageInterval
}
return c.UsageInterval
}
-58
View File
@@ -1,58 +0,0 @@
// Package demo provides a reference implementation
// of service.AppService. It packages out the GRPC and HTTP
// functionality, for the sake of structure.
package demo
import (
"context"
optsgrpc "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
optshttp "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demogrpc"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demohttp"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demomcp"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/service"
)
type DemoService struct {
ctx context.Context
config *config.ServiceConfig
http *demohttp.DemoHTTPServer
grpc *demogrpc.DemoGRPCServer
mcp *demomcp.DemoMCPServer
}
func (d *DemoService) Init(ctx context.Context, config *config.ServiceConfig,
) (service.ShutdownFunc, error) {
d.config = config
d.ctx = ctx
// These don't HAVE to be split into separate packages
// This is, after all, a demo app. Just implement the interface.
d.http = demohttp.NewDemoHTTPServer(ctx, config)
d.grpc = demogrpc.NewDemoGRPCServer(ctx, config)
d.mcp = demomcp.NewDemoMCPServer(ctx, config)
// TODO: This should actually do shutdown stuff
return func(_ context.Context) (string, error) {
return "DemoService", nil
}, nil
}
func (d *DemoService) GetGRPC() *optsgrpc.AppGRPC {
return &optsgrpc.AppGRPC{
Services: d.grpc.GetServices(),
GRPCDialOpts: d.grpc.GetDialOpts(),
}
}
func (d *DemoService) GetHTTP() *optshttp.AppHTTP {
return &optshttp.AppHTTP{
Ctx: d.ctx,
Funcs: d.http.GetHandleFuncs(),
Handlers: d.mcp.GetHandlers(),
HealthChecks: d.http.GetHealthCheckFuncs(),
}
}
-86
View File
@@ -1,86 +0,0 @@
package demogrpc
import (
"context"
"fmt"
"github.com/go-resty/resty/v2"
"github.com/rs/zerolog"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
grpccodes "google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
pb "gitea.libretechconsulting.com/rmcguire/go-server-with-otel/api/demo/app/v1alpha1"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
)
const (
defaultFactType = config.TypeRandom
factsBaseURI = "https://uselessfacts.jsph.pl/api/v2/facts"
)
type DemoGRPCServer struct {
tracer trace.Tracer
ctx context.Context
cfg *config.ServiceConfig
client *resty.Client
pb.UnimplementedDemoAppServiceServer
}
func NewDemoGRPCServer(ctx context.Context, cfg *config.ServiceConfig) *DemoGRPCServer {
if cfg.Opts == nil {
cfg.Opts = &config.DemoOpts{}
}
if cfg.Opts.FactType == "" {
cfg.Opts.FactType = config.TypeRandom
}
return &DemoGRPCServer{
ctx: ctx,
cfg: cfg,
tracer: otel.GetTracer(ctx, "demoGRPCServer"),
client: resty.New().SetBaseURL(factsBaseURI),
}
}
func (d *DemoGRPCServer) GetDemo(ctx context.Context, req *pb.GetDemoRequest) (
*pb.GetDemoResponse, error,
) {
ctx, span := d.tracer.Start(ctx, "getDemo", trace.WithAttributes(
attribute.String("language", req.GetLanguage()),
))
defer span.End()
r := d.client.R().SetContext(ctx)
if req.GetLanguage() != "" {
r = r.SetQueryParam("language", req.GetLanguage())
}
fact := new(RandomFact)
r.SetResult(fact)
resp, err := r.Get(fmt.Sprintf("/%s", d.cfg.Opts.FactType))
if err != nil {
span.SetStatus(codes.Error, err.Error())
span.RecordError(err)
zerolog.Ctx(d.ctx).Err(err).Send()
return nil, status.Errorf(grpccodes.Unknown, "%s: %s",
err.Error(), string(resp.Body()))
}
span.SetAttributes(attribute.String("fact", fact.Text))
span.SetStatus(codes.Ok, "")
zerolog.Ctx(d.ctx).Debug().Str("fact", fact.Text).Msg("retrieved fact")
return fact.FactToProto(), nil
}
-25
View File
@@ -1,25 +0,0 @@
package demogrpc
import (
"google.golang.org/protobuf/types/known/timestamppb"
pb "gitea.libretechconsulting.com/rmcguire/go-server-with-otel/api/demo/app/v1alpha1"
)
type RandomFact struct {
ID string `json:"id,omitempty"`
Text string `json:"text,omitempty"`
Source string `json:"source,omitempty"`
SourceURL string `json:"source_url,omitempty"`
Language string `json:"language,omitempty"`
Permalink string `json:"permalink,omitempty"`
}
func (f *RandomFact) FactToProto() *pb.GetDemoResponse {
return &pb.GetDemoResponse{
Timestamp: timestamppb.Now(),
Fact: f.Text,
Source: f.SourceURL,
Language: f.Language,
}
}
-44
View File
@@ -1,44 +0,0 @@
package demohttp
import (
"context"
"net/http"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
)
type DemoHTTPServer struct {
ctx context.Context
cfg *config.ServiceConfig
}
func NewDemoHTTPServer(ctx context.Context, cfg *config.ServiceConfig) *DemoHTTPServer {
return &DemoHTTPServer{
ctx: ctx,
cfg: cfg,
}
}
func (dh *DemoHTTPServer) GetHandleFuncs() []opts.HTTPFunc {
// TODO: Implement real http handle funcs
return []opts.HTTPFunc{
{
Path: "/test",
HandlerFunc: func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotImplemented)
w.Write([]byte("unimplemented demo app"))
},
},
}
}
func (dh *DemoHTTPServer) GetHealthCheckFuncs() []opts.HealthCheckFunc {
return []opts.HealthCheckFunc{
func(ctx context.Context) error {
// TODO: Implement real health checks
return nil
},
}
}
-70
View File
@@ -1,70 +0,0 @@
/*
Package demomcp contains a simple reference implementation of returning a
HTTPHandler for an MCP server with a single tool used to retrieve random facts
*/
package demomcp
import (
"context"
"net/http"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/rs/zerolog"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/demo/demogrpc"
)
var DemoMCPImpl = &mcp.Implementation{
Name: "Demo MCP Server",
Title: "Demo MCP",
}
type DemoMCPServer struct {
ctx context.Context
cfg *config.ServiceConfig
log *zerolog.Logger
server *mcp.Server
demoGRPC *demogrpc.DemoGRPCServer
}
func NewDemoMCPServer(ctx context.Context, cfg *config.ServiceConfig) *DemoMCPServer {
return &DemoMCPServer{
ctx: ctx,
cfg: cfg,
log: zerolog.Ctx(ctx),
demoGRPC: demogrpc.NewDemoGRPCServer(ctx, cfg),
server: mcp.NewServer(DemoMCPImpl, &mcp.ServerOptions{
Instructions: "Call this demo MCP tool if the user asks useless questions or wants a random fact",
HasTools: true,
}),
}
}
func (d *DemoMCPServer) GetHandlers() []opts.HTTPHandler {
// NOTE: Add other tools here
d.addDemoRandomFactTool()
demoHandler := mcp.NewStreamableHTTPHandler(func(*http.Request) *mcp.Server {
return d.server
}, &mcp.StreamableHTTPOptions{})
d.log.Debug().Msg("Demo MCP Tool Ready")
return []opts.HTTPHandler{
{
Prefix: "/api/mcp",
Handler: demoHandler,
},
}
}
func (d *DemoMCPServer) GetHealthCheckFuncs() []opts.HealthCheckFunc {
return []opts.HealthCheckFunc{
func(ctx context.Context) error {
// TODO: Implement real health checks
return nil
},
}
}
-60
View File
@@ -1,60 +0,0 @@
package demomcp
import (
"context"
"github.com/modelcontextprotocol/go-sdk/mcp"
"k8s.io/utils/ptr"
demo "gitea.libretechconsulting.com/rmcguire/go-server-with-otel/api/demo/app/v1alpha1"
)
var DemoTool = &mcp.Tool{
Name: "Demo Tool",
Title: "Demo Random Fact Tool",
Description: "Returns a random fact for demo or boredom purposes",
Annotations: &mcp.ToolAnnotations{
ReadOnlyHint: true,
OpenWorldHint: ptr.To(true),
},
}
type DemoToolParams struct {
Language string `json:"language,omitempty" jsonschema:"Random Fact Language Abbreviation (e.g. en)"`
}
func (d *DemoMCPServer) addDemoRandomFactTool() {
d.server.AddTool(
mcp.ToolFor(DemoTool, d.demoToolHandler),
)
}
func (d *DemoMCPServer) demoToolHandler(ctx context.Context, req *mcp.CallToolRequest, args *DemoToolParams) (
*mcp.CallToolResult, any, error,
) {
d.log.Debug().Str("language", args.Language).Msg("demo fact tool called")
fact, err := d.demoGRPC.GetDemo(ctx, &demo.GetDemoRequest{
Language: &args.Language,
})
if err != nil {
return &mcp.CallToolResult{
IsError: true,
Meta: mcp.Meta{
"error": err,
},
}, nil, err
}
return &mcp.CallToolResult{
Meta: mcp.Meta{
"language": fact.GetLanguage(),
"source": fact.GetSource(),
},
Content: []mcp.Content{
&mcp.TextContent{
Text: fact.GetFact(),
},
},
}, nil, nil
}
+94
View File
@@ -0,0 +1,94 @@
// Package econet provides EconetService, a service.AppService that connects
// to the Rheem EcoNet cloud and exposes device state via gRPC, an MCP tool,
// and OTEL metrics served for Prometheus scraping.
package econet
import (
"context"
"fmt"
"log/slog"
rheemcloud "github.com/kevinburke/rheemcloud-go"
optsgrpc "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
optshttp "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/config"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/econet/econetgrpc"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/econet/econetmcp"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/econet/econetmetrics"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/service"
)
type EconetService struct {
ctx context.Context
config *config.ServiceConfig
client *rheemcloud.Client
grpc *econetgrpc.EconetGRPCServer
mcp *econetmcp.EconetMCPServer
metrics *econetmetrics.Collector
}
func (e *EconetService) Init(ctx context.Context, cfg *config.ServiceConfig) (service.ShutdownFunc, error) {
e.ctx = ctx
e.config = cfg
client, err := connect(ctx, cfg)
if err != nil {
return nil, err
}
e.client = client
e.grpc = econetgrpc.NewEconetGRPCServer(ctx, cfg, client)
e.mcp = econetmcp.NewEconetMCPServer(ctx, cfg, e.grpc)
e.metrics = econetmetrics.NewCollector(ctx, cfg, client)
if err := e.metrics.Start(); err != nil {
return nil, err
}
return e.shutdown, nil
}
func connect(ctx context.Context, cfg *config.ServiceConfig) (*rheemcloud.Client, error) {
if cfg.EconetEmail == "" || cfg.EconetPassword == "" {
return nil, fmt.Errorf("econet: email and password required (set ECONET_EMAIL / ECONET_PASSWORD)")
}
client, err := rheemcloud.Connect(ctx, cfg.EconetEmail, cfg.EconetPassword, &rheemcloud.Config{
Logger: slog.Default(),
})
if err != nil {
return nil, fmt.Errorf("econet: connect failed: %w", err)
}
return client, nil
}
func (e *EconetService) shutdown(_ context.Context) (string, error) {
e.metrics.Stop()
return "EconetService", e.client.Close()
}
func (e *EconetService) GetGRPC() *optsgrpc.AppGRPC {
return &optsgrpc.AppGRPC{
Services: e.grpc.GetServices(),
GRPCDialOpts: e.grpc.GetDialOpts(),
}
}
func (e *EconetService) GetHTTP() *optshttp.AppHTTP {
return &optshttp.AppHTTP{
Ctx: e.ctx,
Handlers: e.mcp.GetHandlers(),
HealthChecks: e.healthChecks(),
}
}
func (e *EconetService) healthChecks() []optshttp.HealthCheckFunc {
return []optshttp.HealthCheckFunc{
func(_ context.Context) error {
if len(e.client.Devices()) == 0 {
return fmt.Errorf("econet: no devices loaded")
}
return nil
},
}
}
+32
View File
@@ -0,0 +1,32 @@
package econetgrpc
import (
rheemcloud "github.com/kevinburke/rheemcloud-go"
"google.golang.org/protobuf/types/known/timestamppb"
pb "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1"
)
func deviceToProto(d *rheemcloud.Device) *pb.Device {
min, max := d.SetpointLimits()
return &pb.Device{
SerialNumber: d.SerialNumber(),
DeviceId: d.DeviceID(),
FriendlyName: d.FriendlyName(),
Type: d.Type().String(),
GenericType: d.GenericType(),
Connected: d.Connected(),
WifiSignal: int32(d.WiFiSignal()),
Mode: d.Mode().String(),
Enabled: d.Enabled(),
Running: d.Running(),
RunningState: d.RunningState(),
Setpoint: int32(d.Setpoint()),
SetpointMin: int32(min),
SetpointMax: int32(max),
HotWaterAvailability: int32(d.HotWaterAvailability()),
AlertCount: int32(d.AlertCount()),
Away: d.Away(),
LastUpdated: timestamppb.New(d.LastUpdated),
}
}
+72
View File
@@ -0,0 +1,72 @@
// Package econetgrpc implements the EconetService gRPC API over a shared
// rheemcloud.Client, exposing read-only device state.
package econetgrpc
import (
"context"
rheemcloud "github.com/kevinburke/rheemcloud-go"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
grpccodes "google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
pb "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/config"
)
type EconetGRPCServer struct {
tracer trace.Tracer
ctx context.Context
cfg *config.ServiceConfig
client *rheemcloud.Client
pb.UnimplementedEconetServiceServer
}
func NewEconetGRPCServer(ctx context.Context, cfg *config.ServiceConfig, client *rheemcloud.Client) *EconetGRPCServer {
return &EconetGRPCServer{
ctx: ctx,
cfg: cfg,
client: client,
tracer: otel.GetTracer(ctx, "econetGRPCServer"),
}
}
func (s *EconetGRPCServer) ListDevices(ctx context.Context, _ *pb.ListDevicesRequest) (
*pb.ListDevicesResponse, error,
) {
_, span := s.tracer.Start(ctx, "listDevices")
defer span.End()
devices := s.client.Devices()
resp := &pb.ListDevicesResponse{Devices: make([]*pb.Device, 0, len(devices))}
for _, d := range devices {
resp.Devices = append(resp.Devices, deviceToProto(d))
}
span.SetAttributes(attribute.Int("devices", len(resp.Devices)))
span.SetStatus(codes.Ok, "")
return resp, nil
}
func (s *EconetGRPCServer) GetDevice(ctx context.Context, req *pb.GetDeviceRequest) (
*pb.GetDeviceResponse, error,
) {
_, span := s.tracer.Start(ctx, "getDevice", trace.WithAttributes(
attribute.String("serialNumber", req.GetSerialNumber()),
))
defer span.End()
d := s.client.Device(req.GetSerialNumber())
if d == nil {
err := status.Errorf(grpccodes.NotFound, "no device with serial %q", req.GetSerialNumber())
span.SetStatus(codes.Error, err.Error())
return nil, err
}
span.SetStatus(codes.Ok, "")
return &pb.GetDeviceResponse{Device: deviceToProto(d)}, nil
}
@@ -1,14 +1,14 @@
package demogrpc
package econetgrpc
import (
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
demoAppPb "gitea.libretechconsulting.com/rmcguire/go-server-with-otel/api/demo/app/v1alpha1"
econetPb "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1"
)
func (ds *DemoGRPCServer) GetDialOpts() []grpc.DialOption {
func (s *EconetGRPCServer) GetDialOpts() []grpc.DialOption {
return []grpc.DialOption{
// NOTE: Necessary for grpc-gateway to connect to grpc server
// Update if grpc service has credentials, tls, etc..
@@ -16,14 +16,14 @@ func (ds *DemoGRPCServer) GetDialOpts() []grpc.DialOption {
}
}
func (ds *DemoGRPCServer) GetServices() []*opts.GRPCService {
func (s *EconetGRPCServer) GetServices() []*opts.GRPCService {
return []*opts.GRPCService{
{
Name: "Demo App",
Type: &demoAppPb.DemoAppService_ServiceDesc,
Service: ds,
Name: "Econet Exporter",
Type: &econetPb.EconetService_ServiceDesc,
Service: s,
GwRegistrationFuncs: []opts.GwRegistrationFunc{
demoAppPb.RegisterDemoAppServiceHandler,
econetPb.RegisterEconetServiceHandler,
},
},
}
+64
View File
@@ -0,0 +1,64 @@
/*
Package econetmcp exposes an MCP server, mounted as an HTTP handler at
/api/mcp, whose tools wrap the EconetService gRPC API.
*/
package econetmcp
import (
"context"
"net/http"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/rs/zerolog"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/config"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/econet/econetgrpc"
)
var EconetMCPImpl = &mcp.Implementation{
Name: "Econet MCP Server",
Title: "Econet Exporter MCP",
}
type EconetMCPServer struct {
ctx context.Context
cfg *config.ServiceConfig
log *zerolog.Logger
server *mcp.Server
econetGRPC *econetgrpc.EconetGRPCServer
}
func NewEconetMCPServer(ctx context.Context, cfg *config.ServiceConfig,
grpc *econetgrpc.EconetGRPCServer,
) *EconetMCPServer {
return &EconetMCPServer{
ctx: ctx,
cfg: cfg,
log: zerolog.Ctx(ctx),
econetGRPC: grpc,
server: mcp.NewServer(EconetMCPImpl, &mcp.ServerOptions{
Instructions: "Use these tools to inspect Rheem EcoNet water heaters: " +
"current mode, setpoint, hot water availability, connectivity, and alerts.",
HasTools: true,
}),
}
}
func (m *EconetMCPServer) GetHandlers() []opts.HTTPHandler {
// NOTE: Add other tools here
m.addListDevicesTool()
handler := mcp.NewStreamableHTTPHandler(func(*http.Request) *mcp.Server {
return m.server
}, &mcp.StreamableHTTPOptions{})
m.log.Debug().Msg("Econet MCP tools ready")
return []opts.HTTPHandler{
{
Prefix: "/api/mcp",
Handler: handler,
},
}
}
+76
View File
@@ -0,0 +1,76 @@
package econetmcp
import (
"context"
"fmt"
"strings"
"github.com/modelcontextprotocol/go-sdk/mcp"
"k8s.io/utils/ptr"
pb "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1"
)
var ListDevicesTool = &mcp.Tool{
Name: "list_water_heaters",
Title: "List EcoNet Water Heaters",
Description: "Lists Rheem EcoNet devices and their current state (mode, setpoint, " +
"hot water availability, connectivity). Optionally filter to one serial number.",
Annotations: &mcp.ToolAnnotations{
ReadOnlyHint: true,
OpenWorldHint: ptr.To(true),
},
}
type ListDevicesParams struct {
SerialNumber string `json:"serial_number,omitempty" jsonschema:"Optional device serial number to return a single device"`
}
func (m *EconetMCPServer) addListDevicesTool() {
mcp.AddTool(m.server, ListDevicesTool, m.listDevicesHandler)
}
func (m *EconetMCPServer) listDevicesHandler(ctx context.Context, _ *mcp.CallToolRequest, args *ListDevicesParams) (
*mcp.CallToolResult, any, error,
) {
m.log.Debug().Str("serial", args.SerialNumber).Msg("list water heaters tool called")
devices, err := m.lookup(ctx, args.SerialNumber)
if err != nil {
return &mcp.CallToolResult{IsError: true, Meta: mcp.Meta{"error": err.Error()}}, nil, err
}
return &mcp.CallToolResult{
Content: []mcp.Content{&mcp.TextContent{Text: summarizeDevices(devices)}},
}, nil, nil
}
func (m *EconetMCPServer) lookup(ctx context.Context, serial string) ([]*pb.Device, error) {
if serial != "" {
resp, err := m.econetGRPC.GetDevice(ctx, &pb.GetDeviceRequest{SerialNumber: serial})
if err != nil {
return nil, err
}
return []*pb.Device{resp.GetDevice()}, nil
}
resp, err := m.econetGRPC.ListDevices(ctx, &pb.ListDevicesRequest{})
if err != nil {
return nil, err
}
return resp.GetDevices(), nil
}
func summarizeDevices(devices []*pb.Device) string {
if len(devices) == 0 {
return "No EcoNet devices found."
}
var b strings.Builder
for _, d := range devices {
fmt.Fprintf(&b, "%s (%s, serial %s): mode=%s setpoint=%d°F running=%t connected=%t hotWater=%d%% alerts=%d\n",
d.GetFriendlyName(), d.GetGenericType(), d.GetSerialNumber(),
d.GetMode(), d.GetSetpoint(), d.GetRunning(), d.GetConnected(),
d.GetHotWaterAvailability(), d.GetAlertCount())
}
return strings.TrimRight(b.String(), "\n")
}
+38
View File
@@ -0,0 +1,38 @@
package econetmcp
import (
"strings"
"testing"
pb "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1"
)
func TestSummarizeDevices(t *testing.T) {
tests := []struct {
name string
devices []*pb.Device
want string // substring that must appear
}{
{"empty", nil, "No EcoNet devices found."},
{
name: "single",
devices: []*pb.Device{{
FriendlyName: "Garage",
GenericType: "heatpumpWaterHeater",
SerialNumber: "ABC123",
Mode: "heat-pump",
Setpoint: 125,
}},
want: "Garage (heatpumpWaterHeater, serial ABC123): mode=heat-pump setpoint=125",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := summarizeDevices(tt.devices)
if !strings.Contains(got, tt.want) {
t.Errorf("summarizeDevices() = %q, want substring %q", got, tt.want)
}
})
}
}
+41
View File
@@ -0,0 +1,41 @@
package econetmetrics
import "go.opentelemetry.io/otel/metric"
// gaugeBuilder creates observable gauges, accumulating them for a single
// RegisterCallback and short-circuiting on the first creation error.
//
// Units are intentionally baked into the metric names (Prometheus idiom)
// rather than set via metric.WithUnit — the OTEL→Prometheus exporter would
// otherwise append a second unit suffix (e.g. econet_setpoint_fahrenheit_F).
type gaugeBuilder struct {
m metric.Meter
obs []metric.Observable
err error
}
func (b *gaugeBuilder) i64(name, desc string) metric.Int64ObservableGauge {
if b.err != nil {
return nil
}
g, err := b.m.Int64ObservableGauge(name, metric.WithDescription(desc))
if err != nil {
b.err = err
return nil
}
b.obs = append(b.obs, g)
return g
}
func (b *gaugeBuilder) f64(name, desc string) metric.Float64ObservableGauge {
if b.err != nil {
return nil
}
g, err := b.m.Float64ObservableGauge(name, metric.WithDescription(desc))
if err != nil {
b.err = err
return nil
}
b.obs = append(b.obs, g)
return g
}
+132
View File
@@ -0,0 +1,132 @@
package econetmetrics
import (
"context"
rheemcloud "github.com/kevinburke/rheemcloud-go"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
)
// registerLive wires the per-device live-state gauges to a single callback
// that snapshots client.Devices() once per scrape (cheap, in-memory).
func (c *Collector) registerLive() error {
b := &gaugeBuilder{m: c.meter}
g := &liveGauges{
setpoint: b.i64("econet_setpoint_fahrenheit", "Target water temperature (°F)"),
setpointMin: b.i64("econet_setpoint_min_fahrenheit", "Minimum allowed setpoint (°F)"),
setpointMax: b.i64("econet_setpoint_max_fahrenheit", "Maximum allowed setpoint (°F)"),
connected: b.i64("econet_connected", "1 if the device is connected"),
running: b.i64("econet_running", "1 if the device is actively heating"),
enabled: b.i64("econet_enabled", "1 if the device is enabled"),
away: b.i64("econet_away", "1 if away mode is on"),
hotWater: b.i64("econet_hot_water_availability_percent", "Hot water availability (%)"),
alerts: b.i64("econet_alert_count", "Number of active alerts"),
wifi: b.i64("econet_wifi_signal_db", "WiFi signal strength (dB)"),
lastUpdated: b.i64("econet_last_updated_seconds", "Unix time of last MQTT state update"),
info: b.i64("econet_device_info", "Device metadata (value is always 1)"),
}
if b.err != nil {
return b.err
}
_, err := c.meter.RegisterCallback(func(_ context.Context, o metric.Observer) error {
for _, d := range c.client.Devices() {
g.observe(o, d)
}
return nil
}, b.obs...)
return err
}
// registerUsage wires the polled energy/water gauges, reading the cache the
// poller refreshes (the underlying REST calls are too slow for a callback).
func (c *Collector) registerUsage() error {
b := &gaugeBuilder{m: c.meter}
g := &usageGauges{
energy: b.f64("econet_energy_usage_kwh", "Energy used today (kWh)"),
cost: b.f64("econet_energy_cost_dollars", "Energy cost today in US dollars (kWh * costPerKWH)"),
water: b.f64("econet_water_usage_gallons", "Water used today (gallons)"),
}
if b.err != nil {
return b.err
}
_, err := c.meter.RegisterCallback(func(_ context.Context, o metric.Observer) error {
c.mu.RLock()
defer c.mu.RUnlock()
for serial, u := range c.usage {
g.observe(o, serial, u, c.cfg.CostPerKWH)
}
return nil
}, b.obs...)
return err
}
type liveGauges struct {
setpoint, setpointMin, setpointMax metric.Int64ObservableGauge
connected, running, enabled, away metric.Int64ObservableGauge
hotWater, alerts, wifi, lastUpdated metric.Int64ObservableGauge
info metric.Int64ObservableGauge
}
func (g *liveGauges) observe(o metric.Observer, d *rheemcloud.Device) {
set := metric.WithAttributes(deviceAttrs(d)...)
min, max := d.SetpointLimits()
o.ObserveInt64(g.setpoint, int64(d.Setpoint()), set)
o.ObserveInt64(g.setpointMin, int64(min), set)
o.ObserveInt64(g.setpointMax, int64(max), set)
o.ObserveInt64(g.connected, b2i(d.Connected()), set)
o.ObserveInt64(g.running, b2i(d.Running()), set)
o.ObserveInt64(g.enabled, b2i(d.Enabled()), set)
o.ObserveInt64(g.away, b2i(d.Away()), set)
o.ObserveInt64(g.hotWater, int64(d.HotWaterAvailability()), set)
o.ObserveInt64(g.alerts, int64(d.AlertCount()), set)
o.ObserveInt64(g.wifi, int64(d.WiFiSignal()), set)
// LastUpdated is zero until the first MQTT update lands; skip it then
// rather than emit a nonsensical negative epoch.
if !d.LastUpdated.IsZero() {
o.ObserveInt64(g.lastUpdated, d.LastUpdated.Unix(), set)
}
o.ObserveInt64(g.info, 1, metric.WithAttributes(infoAttrs(d)...))
}
type usageGauges struct {
energy, cost, water metric.Float64ObservableGauge
}
func (g *usageGauges) observe(o metric.Observer, serial string, u usage, costPerKWH float64) {
set := metric.WithAttributes(attribute.String("econet.serial", serial))
o.ObserveFloat64(g.energy, u.energyKWH, metric.WithAttributes(
attribute.String("econet.serial", serial),
attribute.String("econet.energy_type", u.energyType),
))
o.ObserveFloat64(g.water, u.waterGallons, set)
if u.energyType == "KWH" {
o.ObserveFloat64(g.cost, u.energyKWH*costPerKWH, set)
}
}
// deviceAttrs are low-cardinality identity attributes safe for every series.
// They follow OTEL semantic-convention style (namespaced, dotted keys) and
// deliberately exclude anything that changes over time (e.g. timestamps).
func deviceAttrs(d *rheemcloud.Device) []attribute.KeyValue {
return []attribute.KeyValue{
attribute.String("econet.serial", d.SerialNumber()),
attribute.String("econet.device_id", d.DeviceID()),
attribute.String("econet.friendly_name", d.FriendlyName()),
}
}
func infoAttrs(d *rheemcloud.Device) []attribute.KeyValue {
return append(deviceAttrs(d),
attribute.String("econet.type", d.Type().String()),
attribute.String("econet.generic_type", d.GenericType()),
attribute.String("econet.mode", d.Mode().String()),
)
}
func b2i(b bool) int64 {
if b {
return 1
}
return 0
}
+12
View File
@@ -0,0 +1,12 @@
package econetmetrics
import "testing"
func TestB2I(t *testing.T) {
if got := b2i(true); got != 1 {
t.Errorf("b2i(true) = %d, want 1", got)
}
if got := b2i(false); got != 0 {
t.Errorf("b2i(false) = %d, want 0", got)
}
}
+123
View File
@@ -0,0 +1,123 @@
// Package econetmetrics registers OTEL observable gauges for Rheem EcoNet
// device state and periodically polls energy/water usage history so the
// values are available at Prometheus scrape time.
package econetmetrics
import (
"context"
"sync"
"time"
rheemcloud "github.com/kevinburke/rheemcloud-go"
"github.com/rs/zerolog"
"go.opentelemetry.io/otel/metric"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/config"
)
// usage holds the most recent polled energy/water totals for a device.
type usage struct {
energyKWH float64
energyType string
waterGallons float64
}
type Collector struct {
ctx context.Context
cfg *config.ServiceConfig
log *zerolog.Logger
client *rheemcloud.Client
meter metric.Meter
mu sync.RWMutex
usage map[string]usage // keyed by serial number
stop chan struct{}
}
func NewCollector(ctx context.Context, cfg *config.ServiceConfig, client *rheemcloud.Client) *Collector {
return &Collector{
ctx: ctx,
cfg: cfg,
log: zerolog.Ctx(ctx),
client: client,
meter: otel.GetMeter(ctx, "econet"),
usage: make(map[string]usage),
stop: make(chan struct{}),
}
}
// Start registers the gauge callbacks and launches the usage poller and
// event drain goroutines. The rheemcloud client keeps live state fresh over
// MQTT; draining its event channel keeps the cap-64 buffer from filling.
func (c *Collector) Start() error {
if err := c.registerLive(); err != nil {
return err
}
if err := c.registerUsage(); err != nil {
return err
}
go c.drainEvents()
go c.pollUsage()
return nil
}
func (c *Collector) Stop() { close(c.stop) }
func (c *Collector) drainEvents() {
events := c.client.Subscribe()
for {
select {
case <-c.stop:
return
case <-c.ctx.Done():
return
case ev, ok := <-events:
if !ok {
return
}
c.log.Debug().Str("event", ev.Kind.String()).Msg("econet event")
}
}
}
func (c *Collector) pollUsage() {
c.refreshUsage()
t := time.NewTicker(c.cfg.GetUsageInterval())
defer t.Stop()
for {
select {
case <-c.stop:
return
case <-c.ctx.Done():
return
case <-t.C:
c.refreshUsage()
}
}
}
// refreshUsage polls each device's energy/water usage for the current day
// and caches the totals for the usage gauge callback to read.
func (c *Collector) refreshUsage() {
now := time.Now()
start := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
for serial, d := range c.client.Devices() {
u := usage{}
if e, err := c.client.EnergyUsage(c.ctx, d, start, now); err == nil {
u.energyKWH, u.energyType = e.Total, e.EnergyType
} else {
c.log.Debug().Err(err).Str("serial", serial).Msg("energy usage poll failed")
}
if w, err := c.client.WaterUsage(c.ctx, d, start, now); err == nil {
u.waterGallons = w.Total
} else {
c.log.Debug().Err(err).Str("serial", serial).Msg("water usage poll failed")
}
c.mu.Lock()
c.usage[serial] = u
c.mu.Unlock()
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ package service
import (
"context"
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
"gitea.libretechconsulting.com/rmcguire/econet-exporter/pkg/config"
optsgrpc "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
optshttp "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
-29
View File
@@ -1,29 +0,0 @@
syntax = "proto3";
package demo.app.v1alpha1;
import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option go_package = "gitea.libretechconsulting.com/rmcguire/go-server-with-otel/api/v1alpha1/demo";
// Options for random fact, in this case
// just a language
message GetDemoRequest {
optional string language = 1 [(buf.validate.field).string.min_len = 2];
}
// Returns a randome fact, because this is a demo app
// so what else do we do?
message GetDemoResponse {
google.protobuf.Timestamp timestamp = 1;
string fact = 2;
string source = 3;
string language = 4 [(buf.validate.field).string.min_len = 2];
}
service DemoAppService {
rpc GetDemo(GetDemoRequest) returns (GetDemoResponse) {
option (google.api.http) = {get: "/v1alpha1/demo"}; // grpc-gateway endpoint
}
}
+55
View File
@@ -0,0 +1,55 @@
syntax = "proto3";
package econet.v1alpha1;
import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option go_package = "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1";
// Device is the live state of a single Rheem EcoNet device
// (typically a water heater) as reported by the Rheem cloud.
message Device {
string serial_number = 1;
string device_id = 2;
string friendly_name = 3;
string type = 4; // water_heater, thermostat, unknown
string generic_type = 5; // e.g. heatpumpWaterHeater, gasWaterHeater
bool connected = 6;
int32 wifi_signal = 7; // dB, MQTT-only
string mode = 8; // kebab-case, e.g. heat-pump, energy-saving
bool enabled = 9;
bool running = 10;
string running_state = 11;
int32 setpoint = 12; // degrees Fahrenheit
int32 setpoint_min = 13;
int32 setpoint_max = 14;
int32 hot_water_availability = 15; // 0/33/66/100, -1 unknown
int32 alert_count = 16;
bool away = 17;
google.protobuf.Timestamp last_updated = 18;
}
message ListDevicesRequest {}
message ListDevicesResponse {
repeated Device devices = 1;
}
message GetDeviceRequest {
string serial_number = 1 [(buf.validate.field).string.min_len = 1];
}
message GetDeviceResponse {
Device device = 1;
}
// EconetService exposes read-only access to Rheem EcoNet device state.
service EconetService {
rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) {
option (google.api.http) = {get: "/v1alpha1/devices"};
}
rpc GetDevice(GetDeviceRequest) returns (GetDeviceResponse) {
option (google.api.http) = {get: "/v1alpha1/devices/{serial_number}"};
}
}