How alexrios/opentelemetry-go works
Project type and purpose
• This is a Go library (not an end-user application) that implements the OpenTelemetry specification. It provides:
• API packages for tracing, metrics, baggage, attributes, and propagation
• An SDK that implements these APIs, buffer and batch processing, and exporters
• Bridges to legacy systems (OpenCensus, OpenTracing)
• A suite of exporters (OTLP/gRPC, OTLP/HTTP, Prometheus, Jaeger, Zipkin, stdout)
• Example applications demonstrating usage
File structure
• Top-level API modules:
• attribute/, baggage/, propagation/, trace.go, metric/
• SDK implementation:
• sdk/ (providers, processors, controllers, exporters interface)
• Exporters:
• exporters/metric/prometheus, exporters/otlp, exporters/trace/{jaeger, zipkin}, exporters/stdout
• Bridges:
• bridge/opencensus, bridge/opentracing
• Examples:
• example/* demonstrating full pipelines
• Internal tooling:
• internal/ (global state, test harnesses)
• internal/tools (semconv code generator, crosslink)
• Build and CI:
• go.mod/go.sum, Makefile, GitHub workflows
README for additional insights
• Core functionality: instrument an application via API → configure exporter → send telemetry
• Relationship between API, SDK, and exporters is central
• Examples show end-to-end pipelines
Diagramming conventions and required elements
• Use clear, descriptive labels for each component (e.g., “BatchSpanProcessor”, “OTLP/gRPC Exporter”)
• Application → API → Provider → SDK Processor → Exporter → External System
• API packages (e.g., blue rectangles)
• SDK components (e.g., green rectangles)
• Exporters (e.g., orange trapezoids)
• Related modules into containers:
• “Core API”, “SDK”, “Exporters”, “Bridges”, “Examples/Tools”
Final advice
• Every logical component, even if it’s a small utility (propagators, attribute sets)
• How global state ties API calls to concrete implementations