Skip to content

henrod/opentelemetry-example

Repository files navigation

OpenTelemetry Example

Objective

Write an example on how to use OpenTelemetry with:

  1. HTTP Client
  2. gRPC Server
  3. Postgres Client
  4. Redis Client

This example consists of a Cat API, where cats are registered along with cat facts.

Running

Start Jaeger, Postgres and Redis:

make deps
make migrations

Run the application:

make run

Call the API:

Create a cat:

grpcurl \
  -d '{ "cat": { "name": "Tom", "id": "tom" } }' \
  -plaintext localhost:8080 \
  api.v1.CatService/CreateCat

Create another cat (if within 10s, the same cat fact will be used from cache):

grpcurl \
  -d '{ "cat": { "name": "Garfield", "id": "garfield" } }' \
  -plaintext localhost:8080 \
  api.v1.CatService/CreateCat

List cats:

grpcurl \
  -plaintext localhost:8080 \
  api.v1.CatService/ListCats

Find the traces in Jaeger UI:

  • List cats List cats

  • Create cat Create cat

  • Create already existing cat Create already existing cat

About

Have examples on how to use OpenTelemetry in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published