Debugging with OpenTelemetry
August 18th 2023
Tracing - like Logging, just better
A few words about myself
Chief Architect at Torq.io
Love early stage startups 🫶 at my 4th one atm
Love espressos - 17g in 34g out, 25 seconds.
I love reducing CI build times 😅
Windows Internals and Low Level background
Check out my blog at kostyay.com
Torq.io
Trusted by the the world’s best security teams
Our Background
About Torq
3
Tech Stack
How do you debug applications?
We can debug with..
In a properly instrumented application you should be able to understand a problem without having to add more instrumentation.
Logs are great, but..
Shortcomings of logs
What is Distributed Tracing
Distributed Calculator
1
2
3
4
5
6
Service 1
Service 2
span
Distributed trace
A view on the lifespan of a request
A collection of spans
An excellent tool to debug production issues
OpenTelemetry
What is Open Telemetry?
OpenTelemetry reference architecture
(source: Documentation)
Tracing basics
Why should you trace?
1 - Initialize a Tracer in Go
otel.Tracer(“MyTracer”)
Rate
Service Metadata
Destination
2 - Create a Span
Create a span
End a span
Record Errors
Trace Visualization
Trace Viewer - Google Cloud
Traces
Spans
Span Attributes
Span Tree
Attributes
Linked Logs and Events
CloudSQL – Query Insignts Integration
Adopting Traces
Adopting traces in your team
Using Middleware - The key to adoption
OpenTelemetry has a big community.
There is tracing support for many popular Go packages.
Example: Tracing in mux
> go get go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux
Use Traces in Tests
Trace based E2E tests – tracetest.io
Async Calculator
REST API
Presentation + Code Samples
Thank you
August 18th 2023