-
Notifications
You must be signed in to change notification settings - Fork 718
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
A logger.metric() method #1292
Comments
Hi @mrkmcnamee. :) That's an interesting idea. I've encountered similar concerns at work, where log messages evolve into product requirements and so must remain unchanged. However, thinking about it further, I feel this falls outside the scope of a logging library like Loguru. Metrics are a different type of observability data. That being said, if you prefer to use the |
Hi @Delgan ! I hadn't thought about there being a framework for this, but of course, and I immediately found one called PyMetrics which would probably fit the bill. Still, the
Thanks, |
Hi Delgan!
I have a suggestion for a
logger.metric()
method. Currently we uselogger.info()
to publish metrics as part of the "extra" data. This works fine. However, as the code is maintained over time, other developers may modify or delete these logger calls, breaking the the monitoring tools that depend on them. We could of course add warning comments to the code, but it would be nice to be able to distinguish between plain old log messages and messages that are emitted specifically for metric monitoring.At a minimum the
logger.metric()
method would just be an alias forlogger.info()
, but it would be a clear signal to developers that external tools could be relying on it. It could also be useful to have a distinct level name, i.e.METRIC
, which would be a signal in the other direction to the Operations people looking for metrics to monitor in the log message flow. Now that I write that, it seems that a metric method could be used as a handshake between developers and operations, i.e. here is what you can reliably monitor and we promise to try to not break it.Cheers,
Kevin
The text was updated successfully, but these errors were encountered: