production

command
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package main demonstrates a production-ready OpenTelemetry tracing setup with comprehensive configuration, error handling, and best practices for real-world applications.

This example shows: 1. Advanced configuration with environment-based setup 2. Proper error handling and recovery 3. Health checks and metrics endpoints 4. Graceful shutdown handling 5. Structured logging with trace correlation 6. Production-ready middleware stack 7. Database tracing with connection pooling 8. Circuit breaker pattern for resilience

Usage:

go run main.go
curl http://localhost:8080/api/users
curl http://localhost:8080/health
curl http://localhost:8080/metrics

Environment Variables:

OTEL_SERVICE_NAME=production-service
OTEL_SERVICE_VERSION=1.0.0
OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317
OTEL_TRACES_SAMPLER=probabilistic
OTEL_TRACES_SAMPLER_ARG=0.1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL