Skip to content

Commit

Permalink
doc, ref
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer committed Sep 20, 2024
1 parent 3bc3164 commit dfd413e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions relay-event-normalization/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ fn normalize(event: &mut Event, meta: &mut Meta, config: &NormalizationConfig) {
// TODO: Parts of this processor should probably be a filter so we
// can revert some changes to ProcessingAction)
let mut transactions_processor = transactions::TransactionsProcessor::new(
config.transaction_name_config.clone(),
config.span_op_defaults.clone(),
config.transaction_name_config,
config.span_op_defaults,
);
let _ = transactions_processor.process_event(event, meta, ProcessingState::root());

Expand Down
16 changes: 10 additions & 6 deletions relay-event-normalization/src/transactions/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::regexes::TRANSACTION_NAME_NORMALIZER_REGEX;
use crate::TransactionNameRule;

/// Configuration for sanitizing unparameterized transaction names.
#[derive(Clone, Debug, Default)]
#[derive(Clone, Copy, Debug, Default)]
pub struct TransactionNameConfig<'r> {
/// Rules for identifier replacement that were discovered by Sentry's transaction clusterer.
pub rules: &'r [TransactionNameRule],
Expand Down Expand Up @@ -191,7 +191,8 @@ impl Processor for TransactionsProcessor<'_> {
/// Rules used to infer `span.op` from other span fields.
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
pub struct SpanOpDefaults {
rules: Vec<SpanOpDefaultRule>,
/// List of rules to apply. First match wins.
pub rules: Vec<SpanOpDefaultRule>,
}

impl SpanOpDefaults {
Expand All @@ -204,7 +205,7 @@ impl SpanOpDefaults {
}

/// Borrowed version of [`SpanOpDefaults`].
#[derive(Clone, Debug, Default)]
#[derive(Clone, Copy, Debug, Default)]
pub struct BorrowedSpanOpDefaults<'a> {
rules: &'a [SpanOpDefaultRule],
}
Expand All @@ -224,10 +225,13 @@ impl BorrowedSpanOpDefaults<'_> {
}
}

/// A rule to infer [`Span::op`] from other span fields.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
struct SpanOpDefaultRule {
condition: RuleCondition,
value: String,
pub struct SpanOpDefaultRule {
/// When to set the given value.
pub condition: RuleCondition,
/// Value for the [`Span::op`]. Only set if omitted by the SDK.
pub value: String,
}

/// Span status codes for the Ruby Rack integration that indicate raw URLs being sent as
Expand Down

0 comments on commit dfd413e

Please sign in to comment.