-
Notifications
You must be signed in to change notification settings - Fork 105
feat(processor): Fast path rate limiting for trace attachments #5475
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?
Changes from all commits
bf8aa53
25538ec
f678302
5e277de
188c74a
4c01632
d1dfc51
6278351
9cfa3db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -476,6 +476,27 @@ impl Item { | |||||
| self.is_attachment_v2() && self.parent_id().is_none() | ||||||
| } | ||||||
|
|
||||||
| /// Returns the [`ParentType`] of an attachment. | ||||||
| /// | ||||||
| /// For standard attachments (V1) always returns [`ParentType::Event`]. | ||||||
| pub fn attachment_parent_type(&self) -> Option<ParentType> { | ||||||
| let is_attachment = self.ty() == &ItemType::Attachment; | ||||||
| let is_trace_attachment = self.content_type() == Some(&ContentType::TraceAttachment); | ||||||
|
|
||||||
| if is_attachment { | ||||||
| if is_trace_attachment { | ||||||
| match self.parent_id() { | ||||||
| Some(ParentId::SpanId(_)) => Some(ParentType::Span), | ||||||
| None => Some(ParentType::Trace), | ||||||
| } | ||||||
| } else { | ||||||
| Some(ParentType::Event) | ||||||
| } | ||||||
| } else { | ||||||
| None | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// Returns the attachment payload size. | ||||||
| /// | ||||||
| /// For AttachmentV2, returns only the size of the actual payload, excluding the attachment meta. | ||||||
|
|
@@ -1086,6 +1107,14 @@ impl ParentId { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// The type of parent entity an attachment is associated with. | ||||||
| #[derive(Debug)] | ||||||
| pub enum ParentType { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Event, | ||||||
| Span, | ||||||
| Trace, | ||||||
|
Comment on lines
+1113
to
+1115
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surprised clippy isn't mad at this, usually need to document every public symbol and enum variants are always public if the enum is. Would be good to just add documentation of what we consider an |
||||||
| } | ||||||
|
|
||||||
| #[cfg(test)] | ||||||
| mod tests { | ||||||
| use crate::integrations::OtelFormat; | ||||||
|
|
||||||
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.
Would be good just to add some examples or what this is used for.