-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/metrics-aggregate-envelopes
* master: fix(server): Remove dependent items from envelope when dropping transaction item (#960) fix(clippy): Fix clippy 1.51.0 warnings (#965) feat(server): Add support for breakdowns ingestion (#934) build: Update schemars and remove workarounds (#961) feat(server): Add rule id to outcomes coming from transaction sampling (#953)
- Loading branch information
Showing
30 changed files
with
1,141 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use std::ops::{Deref, DerefMut}; | ||
|
||
use crate::protocol::Measurements; | ||
use crate::types::{Annotated, Error, FromValue, Object, Value}; | ||
|
||
/// A map of breakdowns. | ||
/// Breakdowns may be available on any event type. A breakdown are product-defined measurement values | ||
/// generated by the client, or materialized during ingestion. For example, for transactions, we may | ||
/// emit span operation breakdowns based on the attached span data. | ||
#[derive(Clone, Debug, Default, PartialEq, Empty, ToValue, ProcessValue)] | ||
pub struct Breakdowns(pub Object<Measurements>); | ||
|
||
impl Breakdowns { | ||
pub fn is_valid_breakdown_name(name: &str) -> bool { | ||
!name.is_empty() | ||
&& name.starts_with(|c| matches!(c, 'a'..='z' | 'A'..='Z')) | ||
&& name | ||
.chars() | ||
.all(|c| matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' | '.')) | ||
} | ||
} | ||
|
||
impl FromValue for Breakdowns { | ||
fn from_value(value: Annotated<Value>) -> Annotated<Self> { | ||
let mut processing_errors = Vec::new(); | ||
|
||
let mut breakdowns = Object::from_value(value).map_value(|breakdowns| { | ||
let breakdowns = breakdowns | ||
.into_iter() | ||
.filter_map(|(name, object)| { | ||
let name = name.trim(); | ||
|
||
if Breakdowns::is_valid_breakdown_name(name) { | ||
return Some((name.into(), object)); | ||
} else { | ||
processing_errors.push(Error::invalid(format!( | ||
"breakdown name '{}' can contain only characters a-z0-9.-_", | ||
name | ||
))); | ||
} | ||
|
||
None | ||
}) | ||
.collect(); | ||
|
||
Self(breakdowns) | ||
}); | ||
|
||
for error in processing_errors { | ||
breakdowns.meta_mut().add_error(error); | ||
} | ||
|
||
breakdowns | ||
} | ||
} | ||
|
||
impl Deref for Breakdowns { | ||
type Target = Object<Measurements>; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl DerefMut for Breakdowns { | ||
fn deref_mut(&mut self) -> &mut Self::Target { | ||
&mut self.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.