Skip to content

Conversation

@mifu67
Copy link
Contributor

@mifu67 mifu67 commented Nov 12, 2025

Before:
Screenshot 2025-11-12 at 2 10 37 PM

After:

Screenshot 2025-11-12 at 3 15 02 PM

@mifu67 mifu67 requested review from malwilley and scttcper November 12, 2025 23:18
@mifu67 mifu67 requested a review from a team as a code owner November 12, 2025 23:18
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 12, 2025
const incidentEnd = openPeriod.end ?? Date.now();

const timeWindowMs = snubaQuery.timeWindow * 60 * 1000;
const timeWindowMs = snubaQuery.timeWindow * 1000;
Copy link

Choose a reason for hiding this comment

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

Bug: The timeWindowMs calculation is incorrect, making it 60 times smaller than intended, which will cause incident status areas to render at incorrect timestamps.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The calculation for timeWindowMs was changed from snubaQuery.timeWindow * 60 * 1000 to snubaQuery.timeWindow * 1000. This change is incorrect because snubaQuery.timeWindow is in seconds, not minutes, and the timeWindowMs value is intended to represent a duration in milliseconds that was previously derived from a minute-based value. As a result, timeWindowMs will be 60 times smaller than expected, causing statusAreaStart and statusAreaEnd boundaries to be calculated incorrectly. This will lead to incident status areas being rendered approximately 60 times too early on the chart, making the visual representation misleading.

💡 Suggested Fix

Revert the change to timeWindowMs calculation at static/app/views/detectors/components/details/metric/charts/metricDetectorChartOptions.tsx:260 by restoring the multiplication by 60 to snubaQuery.timeWindow * 60 * 1000 to correctly convert the time window from minutes (as implicitly expected by the original calculation) to milliseconds.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
static/app/views/detectors/components/details/metric/charts/metricDetectorChartOptions.tsx#L260

Potential issue: The calculation for `timeWindowMs` was changed from
`snubaQuery.timeWindow * 60 * 1000` to `snubaQuery.timeWindow * 1000`. This change is
incorrect because `snubaQuery.timeWindow` is in seconds, not minutes, and the
`timeWindowMs` value is intended to represent a duration in milliseconds that was
previously derived from a minute-based value. As a result, `timeWindowMs` will be 60
times smaller than expected, causing `statusAreaStart` and `statusAreaEnd` boundaries to
be calculated incorrectly. This will lead to incident status areas being rendered
approximately 60 times too early on the chart, making the visual representation
misleading.

Did we get this right? 👍 / 👎 to inform future reviews.

Reference_id: 2633684

Copy link
Contributor Author

Choose a reason for hiding this comment

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

naur, I changed it BECAUSE it was rendering the status areas incorrectly.

@mifu67 mifu67 merged commit efb475d into master Nov 12, 2025
48 checks passed
@mifu67 mifu67 deleted the mifu67/aci/fix-charts branch November 12, 2025 23:51
andrewshie-sentry pushed a commit that referenced this pull request Nov 13, 2025
Before:
<img width="496" height="202" alt="Screenshot 2025-11-12 at 2 10 37 PM"
src="https://github.com/user-attachments/assets/49ed31f8-2008-48b8-9b4f-c9da5c7746ee"
/>


After:

<img width="481" height="177" alt="Screenshot 2025-11-12 at 3 15 02 PM"
src="https://github.com/user-attachments/assets/6fc20f83-6a46-4c38-bd01-ba45e791f5e6"
/>
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