-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(tracing-limit): group info!(message = "foo") and info!("foo") in same bucket
#24077
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
base: master
Are you sure you want to change the base?
fix(tracing-limit): group info!(message = "foo") and info!("foo") in same bucket
#24077
Conversation
|
Hi @thomasqueirozb , I noticed that this PR needs some CI checks to be approved. . Just wanted to check is there anything needs to be modified? I'm happy to rebase on the current main branch if needed Thanks for your time and feedback! |
Hi @WaterWhisperer, please resolve any merge conflicts. We recently made changes to this library. |
thomasqueirozb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
I looked at this PR before and thought it needed some modifications but looking closely into it, it seems that everything is right. I'm just holding off on an approval because some further discussion is needed but everything looks good
| match field.name() { | ||
| COMPONENT_ID_FIELD => self.component_id = Some(value), | ||
| MESSAGE_FIELD => self.message = Some(value), | ||
| _ => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that field.name() matches MESSAGE_FIELD both when info!("a") and info!(message="a"). Is this correct? I looked into tracing's code and it looks like info!("a") ends up being the same as info!(message="a") after a bunch of macro magic happens but I haven't verified this by testing it myself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have the same idea, that info!("a") and info!(message="a") are identical meaning that they can be using interchangeably.
| component_id: Option<TraceValue>, | ||
| message: Option<TraceValue>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we hash this to decrease memory usage? I think we'd run into issues of memory usage vs efficiency.
I'm worried about memory usage. With this change we'd now store the message in RateLimitedSpanKeys. Currently only component_id is stored and that isn't used in many places. Not sure if this is going to significantly impact us or not.
cc @pront
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a valid concern. Is there any upper bound on how many of these we have to store at a give point in time? Are ever they removed?
Regarding hashing, that introduces new complexity and it's slower. So I would like us to understand this area better and also do some benchmarking too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
I've just rebased on the latest master to resolve the merge conflicts.
Regarding the memory usage concern: I understand that storing the full message string might increase memory usage. Since I'm relatively new to this codebase, I opted for the most straightforward solution first. If you think hashing the message or another optimization is necessary right now, I'd be happy to try implementing it with some guidance. Otherwise, I'm open to benchmarking if you have a preferred way to do that.
|
Also @WaterWhisperer, does this affect your pipelines in production? Trying to understand a bit better the motivation behind this solution. |
f10d37a to
c893a7f
Compare
@pront, thanks for asking! To be honest, I'm not running this in a production environment yet. I'm a Rust enthusiast and a new contributor looking to improve my skills by solving issues in open-source projects. I found this issue interesting because the behavior of I hope this fix helps make vector's internal logging more predictable! |
Summary
Previously, these two equivalent log formats were treated as separate rate limit groups due to different callsite identifiers. Now, rate limiting is based on message content and contextual fields (like component_id) rather than callsite.
Vector configuration
N/A - This is an internal library change to the tracing-limit crate. No Vector configuration is required for testing.
How did you test this PR?
message_field_explicit_vs_implicit_same_bucketthat verifies bothinfo!(message = "Hello")andinfo!("Hello")are grouped under the same rate limit bucketcargo test -p tracing-limitto verify no regressionscargo clippy -p tracing-limitwith no warningsChange Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
info!(message = "foo")andinfo!("foo")are not grouped under the same bucket #24054Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details here.