-
Couldn't load subscription status.
- Fork 20
Stop printing stack traces in debug messages in the channel registry #1162
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
Conversation
Signed-off-by: Sahas Subramanian <[email protected]>
|
These stack traces only add noise, and when there are many components, there is a lot of noise. I have never looked into these for debugging, and I don't think others have either. Also, if we need them, all debug logs (or at least startup debug logs) should have them, but I'm not sure we need them because we can follow the stack trace by just following the code. |
|
They are useful when debugging issues with the channel registry. Luckily this doesn't happen often, but when it does, this trace could be fundamental to figure out what's going on. I do agree this is not needed 99.9% of the time and it is very noisy. What about printing them only if an environment variable is present? Maybe we can have something Another alternative would be to use a specific logger for this and disable it by default: _logger_chan_create = logging.getLogger(__name__ + ":channel_create")
if _logger_chan_create.level == NOT_SET:
_logger_chan_create.level = INFOI'm undecided, both have pros and cons. |
The problem is usually you see the issue when trying to retrieve a channel from the registry, and if it wasn't found (but you expected it to be found), or the other way around, a new one is created and you don't know who and where it was created or not before. You could use a debugger and put breaking points in every place where a channels is retrieved (or created), but that's a lot of work and easy to miss points. |
On the other hand, it seems like env vars are a much more common practice, almost all programming languages runtimes and libraries use this method for enabling debug info, even Python itself. |
|
env var sounds like a good idea, and it would give us more flexibility. Maybe we can even generalize it, by making a filter or similar for the logs. Maybe But I would make that a separate issue so that we can take this PR in now. |
|
I wouldn't remove it without a replacement, unless you are going to address it immediately after this is merged, otherwise it will be forgotten and we won't have it when we need it. I prefer to leave it in a hacky way (even About the env var name, for me debug makes sense because it is what's typically used, at least in Python. For example: But also other C libraries, like This could be used to enable extra logging but also to maybe include more expensive sanity checks, etc. We could call it To play devil's (Sahas') advocate, gRPC uses "trace" for tracing: I find |
|
I called it trace because it was about printing stack traces. But we could discuss this during the next meeting and try to come up with a comprehensive design. If you can walk me through the existing logging config mechanism (I haven't been following that), maybe we can find a way to integrate this in there as well. |
|
It is basically using Python standard logging facility. It is a complex subsystem to summarize in a few lines, but the main point is it is hierarchical and you can inherit config. So this approach I mentioned before would use that: _logger_chan_create = logging.getLogger(__name__ + ":channel_create")
if _logger_chan_create.level == NOT_SET:
_logger_chan_create.level = INFOThen users can configure logging at runtime, let's say There is even a whole "standard" configuration that can be done via [loggers."x:channel_create"]
level = "DEBUG"Could be used to enable this tracing. But this assumes a lot of work from the users side, so for these kind of "debugging" features, I think using an env var makes more sense. Also hardcoding default log levels is not a very common practice. Another solution would be to not change the default level, and let users set the log level for this particular tracing logging to |
I was thinking in the call, but this is good as well. :-) |
No description provided.