diff --git a/static/app/utils/performance/contexts/onDemandControl.tsx b/static/app/utils/performance/contexts/onDemandControl.tsx index 34c7685ea7ca20..d2dc218542cf0b 100644 --- a/static/app/utils/performance/contexts/onDemandControl.tsx +++ b/static/app/utils/performance/contexts/onDemandControl.tsx @@ -104,6 +104,12 @@ export function isOnDemandMetricWidget(widget: Widget): boolean { const doesWidgetHaveReleaseConditions = (widget: Widget) => widget.queries.some(q => q.conditions.includes('release:')); +/** + * Check the extraction state for any widgets exceeding spec limit / cardinality limit etc. + */ +const doesWidgetHaveDisabledOnDemand = (widget: Widget) => + widget.queries.some(q => q.onDemand?.some(d => !d.enabled)); + export const shouldUseOnDemandMetrics = ( organization: Organization, widget: Widget, @@ -121,6 +127,10 @@ export const shouldUseOnDemandMetrics = ( return false; } + if (doesWidgetHaveDisabledOnDemand(widget)) { + return false; + } + return isOnDemandMetricWidget(widget); };