otel-collector

command module
v0.0.0-...-8118236 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

README

OpenTelemetry Collector Example

This example illustrates how to export trace and metric data from the OpenTelemetry-Go SDK to the OpenTelemetry Collector. From there, we bring the trace data to Jaeger and the metric data to Prometheus The complete flow is:

                                          -----> Jaeger (trace)
App + SDK ---> OpenTelemetry Collector ---|
                                          -----> Prometheus (metrics)

Prerequisites

You will need Docker Compose V2 installed for this demo.

Deploying to docker compose

This command will bring up the OpenTelemetry Collector, Jaeger, and Prometheus, and expose the necessary ports for you to view the data.

docker compose up -d

Running the code

You can find the complete code for this example in the main.go file. To run it, ensure you have a somewhat recent version of Go (preferably >= 1.13) and do

go run main.go

The example simulates an application, hard at work, computing for ten seconds then finishing.

Viewing instrumentation data

Now the exciting part! Let's check out the telemetry data generated by our sample application

Jaeger UI

The Jaeger UI is available at http://localhost:16686. Navigate there in your favorite web-browser to view the generated traces.

Prometheus

The Prometheus UI is available at http://localhost:9090. Navigate there in your favorite web-browser to view the generated metrics, for instance, testapp_run_total.

Shutting down

To shut down and clean the example, run

docker compose down

Documentation

Overview

Example using OTLP exporters + collector + third-party backends. For information about using the exporter, see: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp?tab=doc#example-package-Insecure

Jump to

Keyboard shortcuts

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