Microservices reference project with a Go-based user-service and Kubernetes deployment manifests for observability (Jaeger, OpenTelemetry), logging, and messaging.
- services/user-service — Go HTTP service (port 8080), Prometheus metrics (/metrics), Redis and RabbitMQ integrations, OpenTelemetry tracing
- kubernetes — Helm charts and manifests for deploying services and observability stack
- Go >= 1.26
- Docker
- Kubernetes cluster (minikube / kind / remote) and kubectl
- (Optional) Helm for installing operator charts
-
Change to the service directory:
cd services/user-service
-
Run with Go:
go run .
The service listens on port 8080. Endpoints:
- GET /user — returns a sample user JSON
- GET /metrics — Prometheus metrics
-
Useful environment variables (defaults shown in code):
- REDIS_ADDR — Redis address (default: redis-ha.redis.svc.cluster.local:6379)
- RABBITMQ_URL — RabbitMQ connection URL
- RABBITMQ_QUEUE — RabbitMQ queue name (default: user-events)
- OTEL_COLLECTOR_ENDPOINT — OpenTelemetry collector endpoint (default: opentelemetry-collector.monitoring.svc.cluster.local:4317)
- OTEL_INSECURE — set to
falseto disable insecure OTLP when needed
Build and run the container locally:
cd services/user-service
docker build -t user-service:local -f Dockerfile .
docker run --rm -p 8080:8080
-e REDIS_ADDR=<redis_addr>
-e RABBITMQ_URL=<rabbitmq_url>
-e OTEL_COLLECTOR_ENDPOINT=<otel_endpoint>
user-service:local
A set of manifests and Helm charts live in the kubernetes/ directory. To deploy the user service only:
kubectl apply -f kubernetes/user-service/deployment.yaml kubectl apply -f kubernetes/user-service/user.yaml
To bring up the observability stack, inspect kubernetes/jaeger-operator and other YAML/values files and follow those charts' READMEs.
- Traces are sent to an OpenTelemetry Collector (OTLP/gRPC) and can be routed to Jaeger.
- Prometheus metrics are exposed at
/metrics. - Structured JSON logs with trace/span IDs are emitted via slog + slog-otel.
- services/ — microservices source and Dockerfiles
- kubernetes/ — deployment manifests, Helm charts and values
This repository follows a cloud-native microservice architecture:
- user-service: Go HTTP service exposing /user and /metrics, integrates with Redis and RabbitMQ, and exports traces to an OpenTelemetry Collector.
- Messaging: RabbitMQ for async events; default queue:
user-events. - Data/Cache: Redis used for simple counters and ephemeral state.
- Observability: OpenTelemetry Collector + Jaeger for tracing, Prometheus for metrics, and structured JSON logs (slog + slog-otel).
Architecture diagram
-
Add diagrams or screenshots to
docs/images/(create this folder and commit images there). -
Recommended formats: PNG, SVG. Keep filenames short and descriptive (e.g.,
architecture.png). -
Example markdown to include an image in this README:
Contributions welcome. Open an issue or a PR with a clear description. Prefer small, focused changes. Add tests where appropriate.
- No LICENSE file included. Add a LICENSE at repository root if you want to specify terms.
- This README is a starting point; expand service-specific docs as features evolve.
