Billy D. 35912d5844 feat: add e2e tests, perf benchmarks, and infrastructure improvements
- messages/bench_test.go: serialization benchmarks (msgpack map vs struct vs protobuf)
- clients/clients_test.go: HTTP client tests with pooling verification (20 tests)
- natsutil/natsutil_test.go: encode/decode roundtrip + binary data tests
- handler/handler_test.go: handler dispatch tests + benchmark
- config/config.go: live reload via fsnotify + RWMutex getter methods
- clients/clients.go: SharedTransport + sync.Pool buffer pooling
- messages/messages.go: typed structs with msgpack+json tags
- messages/proto/: protobuf schema + generated code

Benchmark baseline (ChatRequest roundtrip):
  MsgpackMap:    2949 ns/op, 36 allocs
  MsgpackStruct: 2030 ns/op, 13 allocs (31% faster, 64% fewer allocs)
  Protobuf:       793 ns/op,  8 allocs (73% faster, 78% fewer allocs)
2026-02-20 06:44:37 -05:00
2026-02-02 01:35:14 +00:00

handler-base

Go module providing shared infrastructure for NATS-based handler services.

Packages

Package Purpose
config Environment-based configuration via struct fields
health HTTP health/readiness server for Kubernetes probes
natsutil NATS/JetStream client with msgpack serialization
telemetry OpenTelemetry tracing and metrics setup
clients HTTP clients for LLM, embeddings, reranker, STT, TTS
handler Base Handler runner wiring NATS + health + telemetry

Usage

package main

import (
    "context"
    "git.daviestechlabs.io/daviestechlabs/handler-base/config"
    "git.daviestechlabs.io/daviestechlabs/handler-base/handler"
    "github.com/nats-io/nats.go"
)

func main() {
    cfg := config.Load()
    cfg.ServiceName = "my-service"

    h := handler.New("my.subject", cfg)
    h.OnMessage(func(ctx context.Context, msg *nats.Msg, data map[string]any) (map[string]any, error) {
        return map[string]any{"ok": true}, nil
    })
    h.Run()
}

Testing

go test ./...
Description
No description provided
Readme MIT 903 KiB
Languages
Go 100%