dd-trace-rb icon indicating copy to clipboard operation
dd-trace-rb copied to clipboard

Add Hanami 1.x instrumentation

Open TonyCTHsu opened this issue 3 years ago • 2 comments

Setup Guide

Install

in Gemfile

gem 'ddtrace', require: 'ddtrace/auto_instrument'

Configuration

in config/initializers/datadog.rb

Datadog.configure do |c|
  # Do your custom configuration
end

What does this Hanami instrumentation provide?

Instrument Hanami 1.x, internally activating rack to instrument rack, which is usually the root span and could handle distributing tracing.

3 spans are generated by a Hanami instrumentation, which are routing, action, render.

  • routing starts recording from endpoint lookup til the response is returned
  • action covers the time for an action execution, including callbacks such as before and after
  • render describes the duration when an output is provided(from action or rack middleware) to be rendered.

https://github.com/DataDog/dd-trace-rb/issues/979

The example flamegraph pattern looks like below

Screenshot 2022-08-22 at 12 24 53

TonyCTHsu avatar Aug 19 '22 13:08 TonyCTHsu

Since this PR is already big as-is, here's a suggestion: consider doing a separate PR to just add Hanami as a test app (even if it doesn't work until we actually add the instrumentation).

That way we can focus more on the actual changes and how instrumentation looks vs getting lost in the noise of bootstrapping an example Hanami application. 😄

ivoanjo avatar Aug 19 '22 13:08 ivoanjo

Codecov Report

:exclamation: No coverage uploaded for pull request base (feature/hanami-integration-app@295858e). Click here to learn what that means. The diff coverage is n/a.

@@                        Coverage Diff                        @@
##             feature/hanami-integration-app    #2230   +/-   ##
=================================================================
  Coverage                                  ?   97.59%           
=================================================================
  Files                                     ?     1106           
  Lines                                     ?    57541           
  Branches                                  ?        0           
=================================================================
  Hits                                      ?    56156           
  Misses                                    ?     1385           
  Partials                                  ?        0           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Sep 09 '22 17:09 codecov-commenter