Skip to content

A small golang example using OpenTelemetry (OTEL) to demonstrate the basics of traces, spans and events.

License

Notifications You must be signed in to change notification settings

virtualandy/otel-simple-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is it?

The otel dice demo from https://opentelemetry.io/docs/languages/go/getting-started/

Getting Started

Follow the instructions at the OpenTelemetry go page.

Using this Repo

  • Run the getting-started branch to run without any otel.
  • Run the otel-with-stdout branch to run and have the otel exported to stdout. The output will be noisy so we'll want something better.
  • Run the otel-with-viz branch to run with OpenTelemetry traces (and metrics). See below for more.

Visualizing Traces with Jaeger

Run the otel-with-viz branch to see traces in Jaeger.

First, run the docker container for Jaeger:

docker run -d --name jaeger \
-e COLLECTOR_OTLP_ENABLED=true \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \ jaegertracing/all-in-one:latest

Then, build + run the code:

OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 go run main.go rolldice.go otel.go

Note: You'll need OTEL_EXPORTER_OTLP_ENDPOINT pointed to the Jaeger container. The default for golang is https://localhost:4318 which won't work if you run jaeger as above since it's listening on plain ol' http://.

Todo:

  • Create a branch same code but with basic logs instead of OTel
  • Create a branch (main) with OTel
  • Add Jaeger or Honeycomb or a visualizer

About

A small golang example using OpenTelemetry (OTEL) to demonstrate the basics of traces, spans and events.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages