Description
openedon Jun 22, 2022
Current behaviour
Rails callbacks (before/after) are not a part of the action span.
In the before_action
callback, active_span is:
SpanOperation(name:rack.request,sid:1008860920845926479,tid:1866324838581500214,pid:0)
But in the action call:
SpanOperation(name:rails.action_controller,sid:3701457545195306293,tid:1866324838581500214,pid:1008860920845926479)
Expected behaviour
active_pack spans should include the callbacks. That could be done either through a separate span or by extending the current one.
I'm raising this as a bug rather than a feature request, because otherwise we end up in situations where (for example) rack seems to own spans from active_record
, which is not true:
Those queries are made in the before_action
on the controller.
This is also very important when trying to name the spans something more specific - for example when a top level ApiController that other things inherit knows how to label the span in before_action
, but delegating that to all specific Api implementations would be extremely repetitive.
Steps to reproduce
class SomeController < ApplicationController
before_action :bar
def foo
Datadog::Tracing.trace("this.goes.in.controller") {}
end
private
def bar
Datadog::Tracing.trace("this.goes.in.rack") {}
end
end
Environment
- ddtrace version: 1.1.0
- Configuration block (
Datadog.configure ...
):
c.tracing.instrument :rails, service_name: 'marketplace'
c.tracing.instrument :rack, request_queuing: true, web_service_name: 'marketplace-rack'
- Ruby version: 2.7
- Operating system: linux
- Relevant library versions: