Skip to content

Conversation

TBS1996
Copy link
Contributor

@TBS1996 TBS1996 commented Feb 19, 2024

#2068

Parametrizes the root transaction of a DSC so that trace rules can match on the parametrized version of transaction names

if !self.name_config.rules.is_empty() {
self.apply_transaction_rename_rule(&mut event.transaction);
}
normalize_transaction_name(&mut event.transaction, self.name_config.rules);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted for re-use with dsc

///
/// Note: we add `/` at the end of the transaction name if there isn't one, to make sure that
/// patterns like `/<something>/*/**` where we have `**` at the end are a match.
pub fn apply_transaction_rename_rules(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unchanged, just moved

@TBS1996 TBS1996 linked an issue Feb 20, 2024 that may be closed by this pull request
@TBS1996 TBS1996 marked this pull request as ready for review February 20, 2024 01:10
@TBS1996 TBS1996 requested a review from a team as a code owner February 20, 2024 01:10
&self,
state: &mut ProcessEnvelopeState<G>,
) -> Result<(), ProcessingError> {
let project_state = Arc::clone(&state.project_state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the clone here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current setup, yes, because we need mutable reference to ProcessEnvelopeState to mutate the envelope, and the rules are inside the project state, so we'd get a cannot borrow mutable because its also borrowed as immutable error

@TBS1996 TBS1996 requested a review from jjbayer February 20, 2024 12:59
@TBS1996 TBS1996 removed the request for review from jjbayer February 20, 2024 13:28
@TBS1996 TBS1996 requested a review from jjbayer February 20, 2024 22:41
envelope = Envelope()
transaction_event, trace_id, _ = _create_transaction_item()
envelope.add_transaction(transaction_event)
_add_trace_info(envelope, trace_id, public_key, transaction=original_transaction)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a second project config that contains the txNameRules and pass its project key here, to test that the normalization uses the correct config.

@TBS1996 TBS1996 requested a review from jjbayer February 21, 2024 12:07
sampling_config["config"]["txNameRules"] = [
{
"pattern": pattern,
"expiry": "3022-11-30T00:00:00.000000Z",
Copy link
Contributor Author

@TBS1996 TBS1996 Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: test will fail 998 years from now

@TBS1996 TBS1996 merged commit e78106d into master Feb 22, 2024
@TBS1996 TBS1996 deleted the tor/traceparam branch February 22, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Match trace rules against the parametrized name of a transaction
2 participants