Open verdie-g opened 8 months ago
Tagging subscribers to this area: @dotnet/area-extensions-logging See info in area-owners.md if you want to be subscribed.
Author: | verdie-g |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `untriaged`, `area-Extensions-Logging` |
Milestone: | - |
@geeknoid @joperezr is this something supported or plan to support in the extensions source gen?
CC @noahfalk @reyang @CodeBlanch
We are planning to augment the logging system with something that achieves the same goal, but in more flexible framework. In particular, we'll have config-time control over the sampling rate, there will be global vs. per-request sampling, and a few more bells and whistles. I'm hoping to have a proposal published on this front in the coming weeks.
Thanks @geeknoid. I'll transfer this issue to the extensions repo for tracking.
Background and motivation
When developing a web service, logs are usually added for unhappy path, for example, a database query failed because the remote server was unreachable. The code would look like this:
One subtle issue with that code that could have very nasty consequences is that if the database is down, all queries will induce an error log. That would create a huge spikes of logs that could overload the logs collector and make it drop logs that were crucial to understand the root cause of the issue.
Because this issue is easy to miss, I think would be great to integrate a token bucket rate limiter in the LoggerMessageAttribute.
https://github.com/dotnet/runtime/issues/82465 seems to be related.
API Proposal
If
LogsPerPeriod
orReplenishmentPeriod
are equal or less than 0 they should be both ignored.API Usage
Alternative Designs
No response
Risks
No response