Skip to content

thomas-pearson-mattr/otel-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open-telemetry example

# Start up  
yarn docker:dev:up

yarn start:dev:pino

Predict someones age from their name 🔮, and take a look at the logs 🪵

You will see the x-request-id is propagated through each span's attributes & you'll get an understanding how logs or "Events" are attached to each Span.

export NAME="thomas"
curl http://localhost:5001/predict\?name\=$NAME -H "x-request-id: 12343" | jq
curl http://localhost:5001/error -H "x-request-id: 12343" | jq

You've predicted an age off someones name! And generated a mock error. Now lets take a look at the traces!

Open up the local running Jaeger in your browser, select a service and hit "Find Traces". Once you've done that you should be able to click into your trace to see the span break down.

Search Jaeger

I've also proved that this kind of open-telemetry can be used with DataDog you will need to setup an account to use this integration. I created with a personal account with a 14day trial using a Docker integration for logs & APM.

# Remove dev containers as ports may conflict
yarn docker:dev:down

# Set Datadog vars
export DD_API_KEY='YOUR_API_KEY'
export DD_SITE="$REGION.datadoghq.com"

# Start up the docker containers
yarn docker:datadog:up

Generate some more traces

export NAME="john"
curl http://localhost:5001/predict\?name\=$NAME -H "x-request-id: 12343" | jq
curl http://localhost:5001/error -H "x-request-id: 12343" | jq

Head over to your DataDog account under APM->Traces->otel-age-predict

DataDog

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published