Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Peeking into Rails apps using OpenTelemetry

Peeking into Rails apps using OpenTelemetry

While Rails makes getting the application out quickly without losing the developer productivity, it needs Observability once it hits production. Because we don’t want the business to suffer in case the application performance suffers. Learn how OpenTelemetry offers the best open standards to observe a Rails app by allowing you to ask complex, improvement-focused questions before your customers ask you about them.

Prathamesh Sonpatki

January 25, 2023
Tweet

More Decks by Prathamesh Sonpatki

Other Decks in Programming

Transcript

  1. Peeking into Rails apps
    using OpenTelemetry 💎🔭
    1
    Prathamesh Sonpatki
    @last9io
    Ruby on Rails Global Summit’23

    View full-size slide

  2. 2
    Instrumentation? 🤔 🤨

    View full-size slide

  3. 3
    Instrumentation? 🤔 🤨
    - How do you know your application is running as expected?

    View full-size slide

  4. 4
    Instrumentation? 🤔 🤨
    - How do you know your application is running as expected?
    - Service Level Agreements(SLA)

    View full-size slide

  5. 5
    Instrumentation? 🤔 🤨
    - How do you know your application is running as expected?
    - Service Level Agreements(SLA)
    - Good night’s sleep 😴 💤

    View full-size slide

  6. 💡“Hope is not a strategy!”
    6
    https://sre.google/sre-book/introduction/

    View full-size slide

  7. 💡A Reliability mandate starts with
    Instrumentation
    You can only improve what you measure.
    7

    View full-size slide

  8. 🌈 Landscape of the Instrumentation
    8

    View full-size slide

  9. 🌈 Landscape of the Instrumentation
    9
    - Your application is not standalone

    View full-size slide

  10. 🌈 Landscape of the Instrumentation
    10
    - Your application is not standalone
    - It’s actually a 🍔

    View full-size slide

  11. 🌈 Landscape of the Instrumentation
    11
    - Your application is not standalone
    - It’s actually a 🍔
    - The Bun(Cloud/VM)
    - Patty(application)
    - Along with Mayo sauce(RDS/DB)
    - And Ketchup(Third party services)

    View full-size slide

  12. 🌈 The Landscape of Instrumentation
    12
    - Your application is not standalone
    - It’s actually a 🍔
    - The Bun(Cloud/VM)
    - Patty(application)
    - Along with Mayo sauce(RDS/DB)
    - And Ketchup(Third party services)
    “Full stack observability” FTW!

    View full-size slide

  13. 💡Modern applications are like living
    organisms that grow and shrink in all
    possible directions.
    And also communicate with their peers!
    13

    View full-size slide

  14. Agenda 📄
    14
    - Need of instrumentation/observability
    - Basic Terminology
    - What is OpenTelemetry
    - Otel Architecture
    - Otel + Rails
    - Way forward

    View full-size slide

  15. Basic Terminology 󰣖
    15

    View full-size slide

  16. Observability 🪩
    16
    The measurement and attribution of performance in a complex software
    environment is called Observability.
    @realmeson10

    View full-size slide

  17. Telemetry 📊
    17
    Collection of measurements or data at remote points and their automatic
    transmission to receiving equipment (telecommunication) for monitoring.

    View full-size slide

  18. Logs ⛈
    18
    - Why is something wrong??
    - Structured vs unstructured
    - Easier to adopt but consistency is hard
    Started GET "/posts" for 192.168.0.102 at 2023-01-25 11:53:32 +0530
    Processing by PostsController#index as HTML
    Post Load (0.3ms) SELECT "posts".* FROM "posts"
    Rendered posts/index.html.erb within layouts/application (3.0ms)
    Completed 200 OK in 16ms (Views: 14.0ms | ActiveRecord: 0.3ms)

    View full-size slide

  19. Metrics 📊
    19
    - What is wrong?
    - Overview via aggregates
    - Consistency and adoption
    - Visualization using external tools
    https://guides.rubyonrails.org/active_support_instrumentation.html

    View full-size slide

  20. Traces 󰙪
    20
    - Entire journey of a workflow.
    - Data that tracks an application request as it flows through the various
    parts of an application.
    - Provides context for what exactly happened
    “Tracing is just structured logging at DEBUG level.
    Would you run production logs on debug level? NO! ” - @nishantmodak

    View full-size slide

  21. Span 🔧
    21
    - Basic building block of a trace
    - Span is equivalent to an event happening.
    - A tree of spans make a trace
    Image credit https://docs.splunk.com/Observability/apm/apm-spans-traces/traces-spans.html

    View full-size slide

  22. Observability back-ends 📇
    22
    - A tool/service that gets the telemetry data and presents way of
    visualization, aggregation, alerting, notifications.

    View full-size slide

  23. Standardization Challenges 📜
    23
    - Different vendors
    - Different formats
    - Agents
    - Nomenclature
    https://last9.io/blog/observability-is-dead-long-live-observability/

    View full-size slide

  24. OpenCensus 💻
    OpenTracing 🪞
    24

    View full-size slide

  25. OpenTelemetry 🔭
    25
    https://www.cncf.io/blog/2021/08/26/opentelemetry-becomes-a-cncf-incubating-project/

    View full-size slide

  26. What OpenTelemetry is not ⛔
    26
    OpenTelemetry is not an observability back-end.

    View full-size slide

  27. Architecture 🏛
    27

    View full-size slide

  28. Architecture Demo󰙥
    28

    View full-size slide

  29. Architecture 🏛
    29

    View full-size slide

  30. Architecture 🏛
    30

    View full-size slide

  31. Architecture 🏛
    31
    https://lightstep.com/blog/opentelemetry-collector-design-and-
    architecture

    View full-size slide

  32. OTLP 🧬
    - Describes the encoding, transport, and delivery mechanism of telemetry
    data between telemetry sources, intermediate nodes such as collectors
    and backends.
    - gRPC and HTTP implementations
    https://opentelemetry.io/docs/reference/specification/protocol/
    32

    View full-size slide

  33. Automatic and Manual instrumentations ⚒
    - Automatic instrumentation by just
    including relevant gems.
    - Out of the box telemetry data.
    - Common bases are covered.
    - Don’t have application specific data.
    - Getting started with
    auto-instrumentation is easiest.
    33

    View full-size slide

  34. Automatic and Manual instrumentations ⚒
    - Automatic instrumentation by just
    including relevant gems.
    - Out of the box telemetry data.
    - Common bases are covered.
    - Don’t have application specific data.
    - Getting started with
    auto-instrumentation is easiest.
    34
    - Deeper insights into application.
    - Custom metadata.
    - More control.
    - Needs application code change.

    View full-size slide

  35. Way forward 🛣
    35

    View full-size slide

  36. Way forward 🛣
    36
    - Ruby Otel SDK Complete support for traces
    - WIP for logs and metrics
    - https://github.com/open-telemetry/opentelemetry-ruby
    - https://opentelemetry.io/docs/instrumentation/ruby/

    View full-size slide

  37. Who are already onboard on the Otel Train 🚝
    37
    - GitHub
    - Shopify
    - Heroku
    - Puppet
    - Dropbox
    - You??

    View full-size slide

  38. Recap 💹
    38
    - Need for standardized instrumentation
    - What is the essence of OpenTelemetry?
    - Otel Architecture
    - Rails app using Otel
    - Automatic and Manual instrumentation
    - Way forward

    View full-size slide

  39. Thanks 🤝
    39
    Prathamesh Sonpatki
    Last9.io
    󰜼 prathamesh.tech
    🐧 twitter.com/_cha1tanya
    🐘hachyderm.io/@Prathamesh
    “Last9 of Reliability” Discord

    View full-size slide