-
Notifications
You must be signed in to change notification settings - Fork 872
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
Request: Facility for telling Spring Scheduling instrumentation not to trace individual @Scheduled methods #5008
Comments
hi @GrahamLea! I recently added It looks like we should do the same for spring scheduling spans. Though that still requires writing an agent extension to add and configure such a sampler, see #1060 (comment) if you want to go down that route. |
I think it's interesting that in the few cases where I've seen similar filtering requests mentioned, the advice offered is often that a From my quick look at the code around I'm sure there's a number of factors to consider in deciding which way to implement these things, but I would have thought that, generally, if it's possible to not instrument something rather than to instrument it and then throw the data away, the first would probably be preferable. 🤷🏻♂️ |
As said in our documentation:
|
@iNikem Thanks. Would you mind helping me connect your highlighting of that para to what I've said above? Is it that the approach used by |
Yes, it is easier to break instrumentation by using |
Hi @trask. Am I right in thinking that, to employ selective filtering of Spring
Any guidance you can give would be very appreciated! 🙏 |
Okay, found another comment here that seems to say the RuleBasedRoutingSampler needs to be packaged into an agent extension, with the configuration already baked in. Is that right? |
And on my configuration question, I see that the comments in |
Okay, I've got a good way with this so far. I've built a
However, the custom Sampler never gets called. (A |
hi @GrahamLea! i'm not sure why the sampler is not getting called. I updated the example extension to use the (better) |
Thanks for the reply, Trask. |
Yep. Honeycomb's HoneycombAutoConfigurationCustomizerProvider calls |
Okay, I've now got my Filter Sampler working (using a fork of the Honeycomb agent - hopefully temporary). But... with a lot of these
When I get to
But I'm not seeing those appear in my telemetry. (And my sampling is set to 100%) Is that because it's within a Is there an easy way for me to start a new trace within a Span that's been generated by the agent instrumentation and then dropped by a |
yes, exactly. the default samplers are all "parent-based" which means they respect the decision of the parent (which includes the parent's decision to drop). try changing your sampler to explicitly "record" the nested span instead of delegating to the underlying (parent-based) sampler |
Thanks. I need to check I'm understanding, and what the solution is... I believe what you're saying is I should change my filter to detect those spans and give them a So, is there an obvious way for me to detect when something is a manual span created under my DROPped spans? Or do I need to create one, e.g. add a custom Span attribute that tells my filter to record a Span instead of looking at the parent Span's sampling? Or should I just assume that if there's another INTERNAL under one of my DROPped spans that it's manual and I should sample it? So many questions. Feel free to point me at some docs if this is explained well somewhere. (I tried searching, but all explanations I found of custom Samplers are pretty high level.) |
Is your feature request related to a problem? Please describe.
Spring Scheduling instrumentation can only be either on or off. A method
@Scheduled
to run every second gets traced every second, even if it does nothing interesting. There is no way (that I can tell) to ask the instrumentation not to trace individual methods.Describe the solution you'd like
It'd be great to be able to annotate a
@Scheduled
method with something like@NoTracing
and have it not be traced.Describe alternatives you've considered
I have a hack where I use an aspect over
TaskScheduler.schedule*(..)
to unwrap the originalRunnable
from aScheduledMethodRunnable
if the wrapped runnable is aScheduledMethodRunnable
and I can see a specific annotation on the method.The text was updated successfully, but these errors were encountered: