Getting Started
The OpenTelemetry Collector receives traces, metrics and logs, processes the telemetry, and exports it to a wide variety of observability backends using its components. For a conceptual overview of the Collector, read the introduction.
The following tutorial shows how to deploy the OpenTelemetry Collector and send telemetry to it using the default configuration and the telemetrygen utility.
Prerequisites
To follow this tutorial you need the following
- Go 1.20 or higher
Test the OpenTelemetry Collector in five minutes
Pull the OpenTelemetry Collector Docker image and run the collector in a container:
docker pull otel/opentelemetry-collector:0.88.0 docker run -p 127.0.0.1:4317:4317 -p 127.0.0.1:55679:55679 otel/opentelemetry-collector:0.88.0
Download and install the
telemetrygen
utility from the opentelemetry-collector-contrib repository:go install github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen@latest
The command should install
telemetrygen
inside the localgo/bin
directory.The
telemetrygen
command generates dummy telemetry for testing. In a new terminal window, send some traces to the collector:telemetrygen traces --otlp-insecure --duration 5s
After five seconds,
telemetrygen
stops and shows the sended messages in the console:2023-10-23T12:58:19.835+0200 INFO traces/worker.go:88 traces generated {"worker": 0, "traces": 994418} 2023-10-23T12:58:19.835+0200 INFO traces/traces.go:79 stop the batch span processor
In the terminal window, running the Collector container, logs should show activity related to the trace ingest similar to this:
Span #434 Trace ID : ba7ef95fce7499811ca72158350c907c Parent ID : 1d3c9f49b3f2cf47 ID : 7609079dc6253034 Name : okey-dokey Kind : Server Start time : 2023-10-23 11:01:29.53251 +0000 UTC End time : 2023-10-23 11:01:29.532634 +0000 UTC Status code : Unset Status message :
Open
http://localhost:55679/debug/tracez
in your browser and select one of the samples in the table to see the traces you’ve just generated.
Next steps
In this tutorial you’ve started the OpenTelemetry Collector and sent telemetry to it. As next steps, consider doing the following:
- Explore different ways to install the Collector.
- Learn about the different modes of the Collector in Deployment Methods.
- Familiarize yourself with the Collector configuration files and structure.
- Explore available components in the registry
- Learn how to build a custom Collector with the OpenTelemetry Collector Builder (OCB)