Skip to content

DSC Mutability and Measurements #5679

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

Closed
10 tasks done
AbhiPrasad opened this issue Sep 1, 2022 · 9 comments · Fixed by #5748
Closed
10 tasks done

DSC Mutability and Measurements #5679

AbhiPrasad opened this issue Sep 1, 2022 · 9 comments · Fixed by #5748
Assignees

Comments

@AbhiPrasad
Copy link
Member

AbhiPrasad commented Sep 1, 2022

Problem statement:

Mis-match between transaction name set in DSC at beginning of trace and in transaction payloads later in trace. This is occurring at a high enough rate to indicate we cannot reliably sample based on trace.

Proposal:

Adjust the mutability of the DSC in an attempt to get a more accurate transaction name in the DSC of the overall trace, for sampling decisions to be more accurately reflect what users configure on product side.

To that end we would also like to gather metrics to further drive what types of changes, how often, and when they occur in the wild, so we can better determine when DSC should be "frozen"

Tasks:

Todo

In Progress

Done


Diagram for visual learners (courtesy of @jan-auer):

image

@AbhiPrasad
Copy link
Member Author

AbhiPrasad commented Sep 1, 2022

Current state: https://develop.sentry.dev/sdk/event-payloads/transaction/#transaction-annotations

I'm proposing we update the transaction_info field to be like so

interface TransactionInfo {
  source: TransactionSource;
  // unix timestamp of first name change
  first_name_change?: number;
  // number of propogations that occured before initial name change
  // only set if `first_name_change` is defined
  num_initial_propogations?: number;
  // number of times name was changed
  // only set if `first_name_change` is defined
  name_change_count?: number;
}

@AbhiPrasad
Copy link
Member Author

Opened #5681, #5682, #5683 to make it easier to add the transaction info changes

@AbhiPrasad
Copy link
Member Author

Note: we'll be doing this only in JS for now, and will evaluate bringing this to other SDKs based on what the metrics we collect say.

@lobsterkatie
Copy link
Member

Current state: develop.sentry.dev/sdk/event-payloads/transaction/#transaction-annotations

I'm proposing we update the transaction_info field to be like so

interface TransactionInfo {
  source: TransactionSource;
  // unix timestamp of first name change
  first_name_change?: number;
  // number of propogations that occured before initial name change
  // only set if `first_name_change` is defined
  num_initial_propogations?: number;
  // number of times name was changed
  // only set if `first_name_change` is defined
  name_change_count?: number;
}

Two thoughts here:

  • Is it better to store firstNameChange in absolute or relative time? Clearly one is computable from the other, but if what we really want to know is how feasible/advisable it might be to set a limit on how long the DSC is mutable (which would be an amount of time rather than a timestamp), it might be easier to just store the data that way to begin with.

  • I think it's important for us also to store the total number of propagations. Both of these measurements are really answers to the question of how far through a transaction we are before the name is finalized (to get a sense of how much we'll be missing by letting some propagations go out with non-final DSC data), and for that we need to know the total extent of the transaction.

Lms24 pushed a commit that referenced this issue Sep 2, 2022
Remove usage `setMetadata` in favour of adding the source to `setName`

helps us get prepped for #5679
@Lms24
Copy link
Member

Lms24 commented Sep 2, 2022

Hmm I'm not sure about the proposed interface. To me it's a little "opinionated" in the sense, that we could collect more general data which could allow us to analyze the timing and stuff in Relay/wherever. What about something like this:

interface TransactionInfo {
  source: TransactionSource;
  nameChanges?: TransactionNameChange[]
  // only set if `nameChanges` is defined and not empty (we can also put this into TransactionNameChange)
  num_initial_propagations?: number;
}

type TransactionNameChange = {
  name: string, // new name
  timestamp: number // unix timestamp when the name was changed (or just the delta to the tx start)
  source: TransactionSource, // optionally, the new source
}

I think this shouldn't be harder/more complex to implement than the other interface but provides us more data

Anyway, feel free to go with whatever makes more sense. Just my 2 cents before I'm off for vacation 😎

@AbhiPrasad
Copy link
Member Author

AbhiPrasad commented Sep 6, 2022

I think let's settle on something like this, per @Lms24 great suggestion above.

interface TransactionInfo {
  source: TransactionSource;
  name_changes?: TransactionNameChange[]
}

interface TransactionNameChange {
  name: string; // new name
  timestamp: number // unix timestamp when the name was changed (or just the delta to the tx start)
  source?: TransactionSource; // new source
  propagations: number; number of propagations since start of transaction.
}

@lobsterkatie
Copy link
Member

I'm good with the above change, but I also still think it's important to store the total number of propagations. As Jan said in the meeting, what we ultimately want is a percentage.

@AbhiPrasad
Copy link
Member Author

AbhiPrasad commented Sep 12, 2022

Final spec:

export interface TransactionInfo {
    source: TransactionSource;
    changes: TransactionNameChange[];
    propagations: number;
};

/**
 * Object representing metadata about when a transaction name was changed.
 */
export interface TransactionNameChange {
  /**
   * Unix timestamp when the name was changed. Same type as the start and
   * end timestamps of a transaction and span.
   */
  timestamp: number;

  /** Previous source used before transaction name change */
  source: TransactionSource;

  /** Number of propagations since start of transaction */
  propagations: number;
}

Implementation in Relay: getsentry/relay#1466

@AbhiPrasad
Copy link
Member Author

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 a pull request may close this issue.

5 participants