Getting Started with OpenTelemetry Go
Snippets that will guide you through instrumenting Go applications with OpenTelemetry Go API and SDK. You'll learn how to implement both manual and automatic instrumentation to emit traces, metrics, and logs to console/OTLP backends.
OpenTelemetry Go in a nutshell
- opentelemetry-go main repository which implements and delivers the core packages:
- go.opentelemetry.io/otel - Core API for creating telemetry data
- go.opentelemetry.io/otel/sdk - Default SDK implementation
- go.opentelemetry.io/otel/semconv - Standard attribute keys and values
- go.opentelemetry.io/otel/exporters/otlp - OTLP protocol exporters
- opentelemetry-go-contrib contrib repository which implements and delivers auto-instrumentation, instrumentation packages and custom implementations:
- go.opentelemetry.io/contrib/instrumentation - Auto-instrumentation for popular Go libraries
- go.opentelemetry.io/contrib/detectors - Resource detectors for various environments
Prerequisites
Before starting with this tutorial, ensure you have the following tools installed on your system:
- Go - The Go programming language
- Download from go.dev
-
Or install via package manager:
brew install go
(macOS) orapt install golang-go
(Ubuntu) -
Docker - For running OpenTelemetry Collector and observability backends
- Download from docker.com
List of snippets
Following is a list of all available OpenTelemetry Go snippets:
basics
Congratulations! You now have a solid foundation for instrumenting Go applications with OpenTelemetry. Start with the simple examples and gradually add more sophisticated instrumentation as your observability needs grow.