Skip to content

Conversation

@shruthilayaj
Copy link
Member

@shruthilayaj shruthilayaj commented Nov 20, 2025

The backend returns extrapolation mode, a field used for transaction -> span
migration. Use this value to call events-stats/ endpoint with the correct extrapolation
mode and sampling mode.
Alerts with SERVER_WEIGHTED call events-stats/ with 'serverOnly' extrapolation mode and SAMPLING_MODE.NORMAL
Alerts with NONE call events-stats/ with 'none' extrapolation mode and SAMPLING_MODE.HIGH_ACCURACY

Extrapolation mode will be set in the backend and not a field we'd expose to the user.
We're going to have an extrapolation mode called "serverOnly" which extrapolates based on server sampling (which will match generic_metric dataset numbers)
and disable extrapolation (ie extrapolation mode none) to match transaction dataset numbers

This PR takes care of both legacy alerts and monitors

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 20, 2025
@shruthilayaj shruthilayaj marked this pull request as ready for review November 20, 2025 22:00
@shruthilayaj shruthilayaj requested review from a team as code owners November 20, 2025 22:00
metricExtractionRules: null,
triggers: triggersClone,
resolveThreshold: rule.resolveThreshold,
extrapolationMode: rule.extrapolationMode,
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Duplicate alert rules retain original extrapolation mode in chart

When duplicating a metric alert rule, the form initializes extrapolationMode from the original rule's data. This causes the chart to be queried with the original rule's extrapolation mode, but duplicated rules should be treated as new rules without backend-set extrapolation mode. The extrapolation mode is correctly cleared when saving (line 820), but not during the initial state setup for the chart display.

Fix in Cursor Fix in Web

? SAMPLING_MODE.NORMAL
? rule.extrapolationMode === ExtrapolationMode.NONE
? SAMPLING_MODE.HIGH_ACCURACY
: SAMPLING_MODE.NORMAL
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Inconsistent sampling mode logic between chart components

The sampling mode is being applied based only on dataset === Dataset.EVENTS_ANALYTICS_PLATFORM, but in TriggersChart the same logic checks both dataset === Dataset.EVENTS_ANALYTICS_PLATFORM AND traceItemType === TraceItemDataset.SPANS. This inconsistency means sampling mode is applied to non-span trace items in the details view but not in the form view, leading to different API calls for the same alert configuration across different pages.

Fix in Cursor Fix in Web

Copy link
Member

@scttcper scttcper left a comment

Choose a reason for hiding this comment

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

looks good for metric detectors, hard to say on metric alerts

@shruthilayaj shruthilayaj merged commit b2fff1d into master Nov 21, 2025
47 checks passed
@shruthilayaj shruthilayaj deleted the shruthi/feat/use-extrapolation-mode-in-alerts branch November 21, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants