6 minute read

Sauce: OpenTelemetry Sandbox Repo with code examples


UPD: There is a way to include sidekiq supspan into a calling parent Span. To override default instrumentation options, in OpenTelemetry::SDK.configure do |c| block you need to specify propagation style in the following format:

c.use 'OpenTelemetry::Instrumentation::Sidekiq', {
  propagation_style:  :child
}

Action Plan

  • Part I
    1. Observabitiy
    2. “Open Telemetry” OS project
    3. It’s components
  • Part II - Demo:
    1. Basic implementation with vanilla Ruby
    2. Ruby with multiple gems

About me

class Friendlyantz
  def initialize
    @name = 'Anton Panteleev'
    @dob = '1987-04-01T04:15:00'
    @title = 'Engineer, Software Stuntman and aspiring Dev Advocate, Saul Goodman of Tech'
    @hobbies = [ 'Kitesurfing', 
                 'Camping',
                 'Art Photography',
                 'Motorcycling',
                 'Longboarding' ]
  end

  def current_location
    'Melbourne, Australia'
  end

https://friendlyantz.me/


A bit of theory and why I decided to do this talk

observability-so-hot


Distributed Tracing

  • Tender Driven Development
  • Signals are not very useful when they are isolated
  • Context Propagation

Spans

image


OpenTelemetry

OpenTelemetry is:

  • a collection of tools, APIs, and SDKs.
  • Use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) to help you analyze your software’s performance and behavior

  • It started as a merger of OpenCensus and openTracing
  • open-source, vendor agnostic
  • It is part on CNCF since 2019 and 2nd most active project after Kubernetes.
  • many popular languages are supported
  • a lot of high-calibre contributors (GitHub, Shopify, Google, etc)

OT Components

A bit confusing and constantly evolving, but some of the basic concepts are:

image


Specification


Instrumentation, Language-specific API & SDK implementations


image


Demo

listen


Basic Single Span:

bundle
ruby basic_single_span/basic_operation.rb

Complex Multi Span

Spin up ‘Jaeger’

docker run -d --name jaeger \            
  -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
  -p 5775:5775/udp \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 14268:14268 \
  -p 14250:14250 \
  -p 9411:9411 \
  jaegertracing/all-in-one

Spin up Sidekiq in a tab

# DO NOT forget ./ in front of the required filepath)
sidekiq -r ./multi_span/job.rb

# if this doesn't work you might need to spin up redis-server if it is not running already
redis-server  

Run demo script in another tab

ruby multi_span/complex_operations.rb 

and observe Sidekiq tab


go to Jaeger UI to observe observabity observing our app

http://localhost:16686


Summary

yes


Summary

  • OT can be Automatic and Manual
  • Future Adoption
  • Still in active development
  • Traces are implemented, Metrics & Logs yet to come
  • challenge Anton to match a talk

Resources:

  1. https://opentelemetry.io/
  2. https://www.jaegertracing.io/ - backend for above (optional, you can use your own existing compatible provider, i.e DataDog, Splunk, etc)
  3. https://youtu.be/Txe4ji4EDUA - fantastic tutorial by NGNIX, which this talk is based on
  4. https://github.com/open-telemetry/opentelemetry-demo - official demo of a shopping app using various languages (mail service is in Ruby)
  5. https://github.com/friendlyantz/open-telemetry-sandbox - my sandbox

Leave a comment