-
Notifications
You must be signed in to change notification settings - Fork 104
feat(processor): Add initial Span Attachment logic #5363
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
f2388a7
1775126
ffb40bc
68b42dd
fe40196
85025db
0471c5c
afb9e4e
d7fced5
3d0c531
a397308
cd99ad4
a44ddce
9f0e045
41eb6e7
c16e195
9bb7098
e3820f5
fe815f6
9526118
7c78b49
41ddd91
069aeea
ca6ad29
8588f05
e01d6d0
d2c0fbe
73af70b
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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| use relay_protocol::{Annotated, Empty, FromValue, IntoValue, Object, Value}; | ||
|
|
||
| use crate::processor::ProcessValue; | ||
| use crate::protocol::{Attributes, Timestamp}; | ||
|
|
||
| use uuid::Uuid; | ||
|
|
||
| /// Metadata for a span attachment. | ||
| #[derive(Clone, Debug, Default, PartialEq, Empty, FromValue, IntoValue, ProcessValue)] | ||
| pub struct AttachmentV2Meta { | ||
| /// Unique identifier for this attachment. | ||
| #[metastructure(required = true, nonempty = true, trim = false)] | ||
| pub attachment_id: Annotated<Uuid>, | ||
|
|
||
| /// Timestamp when the attachment was created. | ||
| #[metastructure(required = true, trim = false)] | ||
| pub timestamp: Annotated<Timestamp>, | ||
|
|
||
| /// Original filename of the attachment. | ||
| #[metastructure(pii = "true", max_chars = 256, max_chars_allowance = 40, trim = false)] | ||
| pub filename: Annotated<String>, | ||
|
|
||
| /// Content type of the attachment body. | ||
| #[metastructure(required = true, max_chars = 128, trim = false)] | ||
| pub content_type: Annotated<String>, | ||
|
|
||
| /// Arbitrary attributes on a span attachment. | ||
| #[metastructure(pii = "maybe")] | ||
| pub attributes: Annotated<Attributes>, | ||
|
|
||
| /// Additional arbitrary fields for forwards compatibility. | ||
| #[metastructure(additional_properties, pii = "maybe")] | ||
| pub other: Object<Value>, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,7 @@ pub fn validate_dsc(spans: &ExpandedSpans) -> Result<()> { | |
| }; | ||
|
|
||
| for span in &spans.spans { | ||
| let span = &span.span; | ||
| let trace_id = get_value!(span.trace_id); | ||
|
|
||
| if trace_id != Some(&dsc.trace_id) { | ||
|
|
@@ -289,17 +290,34 @@ fn create_metrics( | |
| /// as the total category is counted from now in in metrics. | ||
| struct UnsampledSpans { | ||
| spans: Vec<Item>, | ||
| attachments: Vec<Item>, | ||
| } | ||
|
|
||
| impl From<SerializedSpans> for UnsampledSpans { | ||
| fn from(value: SerializedSpans) -> Self { | ||
| Self { spans: value.spans } | ||
| Self { | ||
| spans: value.spans, | ||
| attachments: value.attachments, | ||
| } | ||
|
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. Bug: Legacy and integration spans dropped without outcomes trackingWhen converting
Member
Author
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. Interesting spot this used to be |
||
| } | ||
| } | ||
|
|
||
| impl Counted for UnsampledSpans { | ||
| fn quantities(&self) -> Quantities { | ||
| let quantity = outcome_count(&self.spans) as usize; | ||
| smallvec::smallvec![(DataCategory::SpanIndexed, quantity),] | ||
| let mut quantities = smallvec::smallvec![]; | ||
|
|
||
| if quantity > 0 { | ||
| quantities.push((DataCategory::SpanIndexed, quantity)); | ||
| } | ||
| if !self.attachments.is_empty() { | ||
| quantities.push(( | ||
| DataCategory::Attachment, | ||
| self.attachments.iter().map(Item::len).sum(), | ||
| )); | ||
| quantities.push((DataCategory::AttachmentItem, self.attachments.len())); | ||
| } | ||
|
|
||
| quantities | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.