-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rack.request
span that are stopped in middleware or before action doesn't have resource set
#3482
Comments
Hey @beauraF about this:
are you referring to this?
|
Hello @lloeki 👋 Yes, I think so! |
That's interesting, does this mean you're overriding the
FYI it's becoming less of a theory now: we're working on adding routing information to the What the PR does is tag the composite (because of nested apps/engines and their intermediate resolvers) route, but the same hooking process could also get and tag the target of the last route as resolved by a route resolver, which you could peruse.
I'd argue that including I can definitely see an argument for:
This is probably not actionable for you right now, but does any of this sound useful to have for you in the future? |
Yes, with a It look something like that: module Doctolib
module Datadog
module SpanProcessors
class ServiceSpanProcessor
ENGINE_REGEX = %r{\A/engines/(?<engine>\w+)/}.freeze
TARGETS = %w[method.call rack.request resque.job].freeze
def call(trace)
trace.spans.each do |span|
next if TARGETS.none? { |target| span.name == target }
service = inferred_service_name_for(span)
span.service = service if !service.nil?
end
trace
end
# ...
end
end
end
end
Ah, that's good news!
It would be awesome!
Kinda a grey area to me. I could agree with you for class UsersController < ApplicationController
before_action :set_user, only: %i[ show update destroy ]
# ...
end
Yes, clearly. A good part of our latency come from middleware and hooks. So we built some custom instrumentation to track middleware "in" and "out" and callbacks. I have a feature request open about that: #3483 Thanks for looking into all this @lloeki, much appreciated 🙏 |
Hello everyone 👋
I'm opening a dedicated bug report following this discussion.
This has a significant impact on the monitoring and alerting systems implemented by our teams. Since these spans have no resources, it is not possible to infer a team from them. This broke the reporting of dashboard built by team, and also our custom code that set a service to a
rack.request
based on the resource.I've already seen several teams remove
before_action
, by calling directly into the controller's action to workaround this behavior ; after often spending several hours before understanding this subtlety.@delner you made a proposal in the initial discussion, is that's still the direction you want to go in?
Current behaviour
rack.request
span that are stopped in middleware or before action doesn't have resource setExpected behaviour
rack.request
span that are stopped in before action have resource set. Middleware also?Environment
The text was updated successfully, but these errors were encountered: