I’ve been reading a bit the tracing crate documentation, trying to find out if there’s a way to rate limit logs.

What I refer with rate limiting, is that once a particular log has shown up with some frequency (x amount of times in a given time) then it won’t be captured or shown anymore, until certain amount of time… This to avoid getting the logs space/buffer being eaten by just one, or a few high frequency errors for example.

Thanks !

This would most certainty be part of the used subscriber. I’m not sure if any of the existing subscribers support it, but in the worst case you can write your own subscriber that wraps an existing one.

@kixik@lemmy.ml
creator
link
fedilink
11Y

Yeap, I was thinking if perhaps any subscriber would support it, but didn’t find any which documents it. Perhaps you’re right and subscriber wrapper is needed.

TehPers
link
fedilink
11Y

One thing to keep in mind is that tracing works on spans/events, so rather than the subscriber receiving a string log message, it’s receiving some metadata and a collection of field/value pairs, where values can be a lot of different types. You may need to determine ahead of time which fields you want deduped (or which you don’t want deduped).

@kixik@lemmy.ml
creator
link
fedilink
11Y

yeap, thanks !

Lexxy
link
fedilink
21Y

AFAIK it will just print out all the logs it gets. There is no rate limiting. I guess for such a feature someone may need some postprocessing or filtering :/

@kixik@lemmy.ml
creator
link
fedilink
11Y

OK, thanks !

Rust Programming
!rust@lemmy.ml
    • 0 users online
    • 2 users / day
    • 2 users / week
    • 2 users / month
    • 74 users / 6 months
    • 1 subscriber
    • 258 Posts
    • 707 Comments
    • Modlog