This repo serves as an exploratory point for instrumenting a Go app and visualizing telemetry data in Grafana Cloud.
- If you want to start by seeing traces in your logs, navigate to OpenTelemetry SDK setup and substitute in an stdout exporter, for example:
traceExporter, err := stdouttrace.New(stdouttrace.WithPrettyPrint())
. See an earlier commit. - Once you're ready to explore visualizing, you could start exporting to an OTLP endpoint. If you want to export to Grafana Cloud's OTLP endpoint, see instructions below.
Start bringing in the grpc exporters. See otel.go in the
main
branch, for example check out how the trace exporter is set up here.
docker-compose up
Changes to the golang code are live reloaded with https://github.com/air-verse/air.curl http://localhost:8080/github-api
a few times to create activity. You have a 1 in 2 chance of hitting a fake error- If you're visualizing with Grafana Cloud, navigate to your instance. My favorite way to visualize data is:
- left sidebar > Explore
- I choose
grafanacloud-shirley-traces
as my datasource (Tempo is the database for trace storage) - Click on "Search" for the Query type, this lets me see any traces that have come in.
- Clicking on a trace ID lets you visualize the spans and attributes.
- Explore logs and metrics by switching the datasource. Or check out the curated exploration apps: left sidebar > Explore > below Explore, you'll see Metrics, Logs, Traces...
- Create a free Grafana Cloud account. Go to grafana.com > My account.
- Click on your stack's name.
- Look for the OpenTelemetry box. Click Configure.
- You'll find:
- URL for the OTLP endpoint
- the Grafana Cloud instance ID
- You can generate a Password/API token
- Use these in the config placeholders in this repo.
Based on these docs: https://grafana.com/docs/grafana-cloud/send-data/otlp/send-data-otlp/#manual-opentelemetry-setup-for-advanced-users
Check out the beyla
branch.