How bubunis/test-sre works
This repository implements a token-issuance service: a calling backend submits an email and bearer JWT to the Python API, which authenticates and rate-limits the caller, checks permissions in Postgres, then requests token minting from the Go gRPC service. Go validates the request and lifetime, stores the expiring token in Redis, and returns it through the API. A Redis Stream supports asynchronous audit events. The README also documents Kubernetes deployment, security controls, and an OpenTelemetry/Grafana observability stack; some of those connections are documented rather than verified from sampled implementation.
Main entry points: main.py Python API · main.go Go gRPC service · config.yaml OTel collector · dashboards.yaml Grafana dashboards
Components 16
Request API
- Python API
python-service/main.py - JWT verification
python-service/auth.py - Caller rate limit
python-service/ratelimit.py - Postgres pool
python-service/db_pool.py
Token Issuance
- Go gRPC service
golang-service/main.go - Token input policy
golang-service/internal/tokenpolicy/email.go - Lifetime policy
golang-service/internal/tokenpolicy/ttl.go - Audit event worker
golang-service/queue.go
Persistence
- Permissions database
database/init.sql - Token and event store
golang-service/main.go
Observability
- OTel collector
observability/otel-collector/config.yaml - Trace storage
observability/tempo/tempo.yaml - Log storage
observability/loki/loki.yaml - Metrics collection
observability/prometheus/prometheus.yml - Grafana dashboards
observability/grafana/provisioning/dashboards/dashboards.yaml
Other components
- Calling service
Connections 20
- Calling service → Python API: requests token
README.md - Python API → JWT verification: verifies caller
python-service/main.py - Python API → Caller rate limit: checks quota
python-service/main.py - Python API → Postgres pool: queries permissions
python-service/main.py - Postgres pool → Permissions database: reads permissions
README.md - Python API → Go gRPC service: requests mint
README.md - Go gRPC service → Token input policy: validates email
golang-service/main.go - Go gRPC service → Lifetime policy: checks lifetime
golang-service/main.go - Go gRPC service → Token and event store: stores token
golang-service/main.go - Go gRPC service → Audit event worker: enqueues audit
golang-service/main.go - Audit event worker → Token and event store: reads and acknowledges
golang-service/queue.go - Python API → OTel collector: exports telemetry
README.md - Go gRPC service → OTel collector: exports telemetry
README.md - OTel collector → Trace storage: sends traces
README.md - OTel collector → Log storage: sends logs
README.md - Metrics collection → Python API: scrapes metrics
README.md - Metrics collection → Go gRPC service: scrapes metrics
README.md - Grafana dashboards → Metrics collection: shows metrics
README.md - Grafana dashboards → Trace storage: shows traces
README.md - Grafana dashboards → Log storage: shows logs
README.md