- Add bootstrap package to initialize application components including logger, tracer, and HTTP server. - Create config package to load runtime settings from environment variables. - Implement observability features including logging, metrics, and tracing. - Add health check and hello use cases with corresponding HTTP handlers. - Introduce middleware for request ID, access logging, metrics, and recovery. - Set up HTTP router with defined routes for health and hello endpoints. - Include tests for health and hello endpoints to ensure proper functionality. - Add OpenTelemetry collector configuration for trace exporting.
24 lines
542 B
YAML
24 lines
542 B
YAML
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
PORT: "8080"
|
|
SERVICE_NAME: "switchbot-api"
|
|
ENV: "local"
|
|
LOG_LEVEL: "info"
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: "otel-collector:4317"
|
|
ports:
|
|
- "8080:8080"
|
|
depends_on:
|
|
- otel-collector
|
|
|
|
otel-collector:
|
|
image: otel/opentelemetry-collector:0.93.0
|
|
command: ["--config=/etc/otelcol/config.yaml"]
|
|
volumes:
|
|
- ./otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
|
|
ports:
|
|
- "4317:4317"
|