Skip to content

Conversation

@k-fish
Copy link
Member

@k-fish k-fish commented Nov 5, 2025

This adds two primary events for when the users land on the page.

Closes LOGS-473

This adds two primary events for when the users land on the page.

Closes LOGS-473
@k-fish k-fish requested a review from a team as a code owner November 5, 2025 22:24
@linear
Copy link

linear bot commented Nov 5, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 5, 2025
const {
data: {hasExceededPerformanceUsageLimit},
isLoading: isLoadingSubscriptionDetails,
} = usePerformanceSubscriptionDetails({traceItemDataset: 'default'});
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Use Metrics Dataset for Trace Usage Checks

The useMetricsAnalytics function incorrectly passes traceItemDataset: 'default' to usePerformanceSubscriptionDetails. Since this function is tracking metrics analytics and the PR adds support for the 'metrics' dataset (including the traceMetrics category in the subscription type), it should use traceItemDataset: 'metrics' instead to check the correct usage limit (traceMetrics.usageExceeded) rather than defaulting to transactions/spans limits.

Fix in Cursor Fix in Web

metricQueries: Array<{queryParams: ReadableQueryParams}>;
}) {
const organization = useOrganization();
const {selection} = usePageFilters();
Copy link

Choose a reason for hiding this comment

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

Bug: useMetricsAnalytics uses traceItemDataset: 'default' instead of 'metrics', leading to incorrect usage limit checks.
Severity: MEDIUM | Confidence: 0.90

🔍 Detailed Analysis

The useMetricsAnalytics hook incorrectly invokes usePerformanceSubscriptionDetails with traceItemDataset: 'default'. This configuration causes the system to evaluate usage limits against transactions.usageExceeded or spans.usageExceeded instead of the intended traceMetrics.usageExceeded. As a result, the metrics.explorer.metadata analytics event will report an inaccurate value for has_exceeded_performance_usage_limit concerning metrics usage.

💡 Suggested Fix

Modify the call to usePerformanceSubscriptionDetails within useMetricsAnalytics to use traceItemDataset: 'metrics' instead of traceItemDataset: 'default' to ensure accurate usage limit evaluation.

🤖 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/explore/hooks/useAnalytics.tsx#L878

Potential issue: The `useMetricsAnalytics` hook incorrectly invokes
`usePerformanceSubscriptionDetails` with `traceItemDataset: 'default'`. This
configuration causes the system to evaluate usage limits against
`transactions.usageExceeded` or `spans.usageExceeded` instead of the intended
`traceMetrics.usageExceeded`. As a result, the `metrics.explorer.metadata` analytics
event will report an inaccurate value for `has_exceeded_performance_usage_limit`
concerning metrics usage.

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

const [interval] = useChartInterval();
const topEvents = useTopEvents();

useMetricsPanelAnalytics({
Copy link
Member

Choose a reason for hiding this comment

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

This is going to fire once per panel and again when the query changes for the panel. Is this the intended behaviour?

Copy link
Member

Choose a reason for hiding this comment

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

This hook is very overloaded lol

@k-fish k-fish merged commit 0f1c61d into master Nov 7, 2025
48 checks passed
@k-fish k-fish deleted the ref/tracemetrics/add-analytics-call branch November 7, 2025 17:26
Jesse-Box pushed a commit that referenced this pull request Nov 12, 2025
This adds two primary events for when the users land on the page.

Closes LOGS-473
andrewshie-sentry pushed a commit that referenced this pull request Nov 13, 2025
This adds two primary events for when the users land on the page.

Closes LOGS-473
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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