Sha256: d5264b9c9b916ba6286db0acdcbd4f04cf9c5f49f84fa8a1ce25032ca42745af
Contents?: true
Size: 1.25 KB
Versions: 5
Compression:
Stored size: 1.25 KB
Contents
# typed: ignore require_relative 'ext' require_relative '../../metadata/ext' module Datadog module Tracing module Contrib module Hanami # Hanami Instrumentation for `hanami.render` module RendererPolicyTracing def render(env, response) action = env['hanami.action'] # env['hanami.action'] could be empty for endpoints without an action # # For example in config/routes.rb: # get '/hello', to: ->(env) { [200, {}, ['Hello from Hanami!']] } action_klass = (action && action.class) || ::Hanami::Routing::Default::NullAction Tracing.trace( Ext::SPAN_RENDER, service: configuration[:service_name], resource: action_klass.to_s, span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND ) do |span_op, _trace_op| span_op.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span_op.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RENDER) super end end def configuration Datadog.configuration.tracing[:hanami] end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems