-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
trace: What level should spans default to? #952
Comments
I think @davidbarsky may also have an opinion on verbosity levels... :P My primary motivation for making spans default to the trace level is that they typically will incur more overhead than events (although this depends on the subscriber implementation), since subscribers might want to store data associated with the span over the course of its lifetime. With that said, it does mean that if you set the log level to |
My issue is that in my use case as far as I can see, I will want to filter between info, debug, and trace. This would require me then to have to set each span to |
Is there a reason why |
@carllerche there's a reason, but I'm not convinced it's a good reason --- I had wanted to reserve the name I'm open to changing the span macro API to work this way, though --- it would certainly be more consistent with the |
it seems like |
(with that said, it's worth noting that @LucioFranco's issues around span filtering were actually due to a bug in the |
Yes, I actually am in favor of closing this now, I think it makes sense to default to trace and let the sub choose who to enable. |
I don't think that's the right thing to do, for several reasons:
|
Personally, I think the right thing to do is to make the Even if we don't do this, I'm not convinced |
Bikeshedding! I think Regarding enabling (My view is that sampling/downsizing volume should be handled by the service responsible for collecting instrumentation data and that applications shouldn't really be concerned with this problem—hence my opinion that only |
log 100% used to automatically disable debug / log in release mode. I'm pretty surprised they don't. That said, log allows the end user to configure the static filtering, which is pretty important. We should definitely not end up in a matrix scenario where you have |
It should be possible to statically filter out at least trace & debug level spans when compiling with release mode. |
@carllerche I agree that it would probably be good to add some support for static filtering. With that said, it's worth noting that |
logs strategy results in LLVM optimizing the code out. I don't think this would require |
Ah, yeah, good point. We should definitely have a static max level as well, then.
Yup, this isn't blocking core 0.1. |
Now that PR #987 has added static level filtering for debug and release mode, I'm less concerned about reserving the name Note that this would break any existing code using the |
I'm not too sure, honestly, I would rather spans move away from the info, trace, debug setup. It seems wrong for me to create a span that I always want active as For example I have this code: self.send_body(buf.into())
.instrument(span!(level: tokio_trace::Level::ERROR, "s3_request")) I really dislike having to label this as error :( |
@LucioFranco Why is that not info level? |
@carllerche because I want that span active in every case. aka I want it to always be |
Its currently used for collecting s3 request duration metrics. |
@LucioFranco why are the two related? You should be able to have it as info AND have it always active? |
@carllerche right thats actually what my metrics subscriber does, I guess my issue was more around reading the code spans having levels has always kinda confused me. That said, it may just be my view of it, im totally fine with these macros and the breaking change 👍 |
Okay, I've come around to this, I'm happy with this change and I am happy with keeping the terminology the same as log. |
@LucioFranco since it seems like we'll all in agreement now, I've opened #1013 for actually changing the macros. |
…macro (#1025) ## Motivation Was determined that having the span! macro default to the TRACE level is probably not ideal (see discussion on #952). Closes #1013 ## Solution Remove default trace level and make log lvl mandatory on span! macro, and add the respective `trace_span!`, `debug_span!`, `info_span!`, `warn_span!` and `error_span!` macros that behave as span! macro, but with defined log levels ## Notes I think this is it, also removed some captures that were repeated, and some testcases that also seemed repeated after adding the mandatory log level, but please review it, if more tests or examples are needed happy to provide (tried to find a way to get the generated macros log level, but didn't find one, if there is a way i can add tests to assert that the generated macro has the matching log level ). thanks
…macro (#1025) ## Motivation Was determined that having the span! macro default to the TRACE level is probably not ideal (see discussion on #952). Closes #1013 ## Solution Remove default trace level and make log lvl mandatory on span! macro, and add the respective `trace_span!`, `debug_span!`, `info_span!`, `warn_span!` and `error_span!` macros that behave as span! macro, but with defined log levels ## Notes I think this is it, also removed some captures that were repeated, and some testcases that also seemed repeated after adding the mandatory log level, but please review it, if more tests or examples are needed happy to provide (tried to find a way to get the generated macros log level, but didn't find one, if there is a way i can add tests to assert that the generated macro has the matching log level ). thanks
Description
Currently, spans default to a trace level, meaning if you'd like to log them at a debug or higher level you must manually set the level like so:
This would allow you to filter it via
app[my span]=debug
, I initially found this to be something that I did not understand properly and was a source for confusion. I think that spans should default on aninfo
level and then the user must lower this level based on expected verbosity.cc @hawkw @carllerche
The text was updated successfully, but these errors were encountered: