diff --git a/static/app/actionCreators/events.spec.tsx b/static/app/actionCreators/events.spec.tsx index 54150c082eda5c..40e92bef9adfdd 100644 --- a/static/app/actionCreators/events.spec.tsx +++ b/static/app/actionCreators/events.spec.tsx @@ -32,9 +32,10 @@ describe('Events ActionCreator', function () { }); }); - it('requests events stats with relative period', function () { - doEventsRequest(api, { + it('requests events stats with relative period', async function () { + await doEventsRequest(api, { ...opts, + includeAllArgs: false, includePrevious: false, period: '7d', partial: true, @@ -52,9 +53,10 @@ describe('Events ActionCreator', function () { ); }); - it('sets useRpc param', function () { - doEventsRequest(api, { + it('sets useRpc param', async function () { + await doEventsRequest(api, { ...opts, + includeAllArgs: false, includePrevious: false, period: '7d', partial: true, @@ -73,9 +75,10 @@ describe('Events ActionCreator', function () { ); }); - it('requests events stats with relative period including previous period', function () { - doEventsRequest(api, { + it('requests events stats with relative period including previous period', async function () { + await doEventsRequest(api, { ...opts, + includeAllArgs: false, includePrevious: true, period: '7d', partial: true, @@ -93,11 +96,12 @@ describe('Events ActionCreator', function () { ); }); - it('requests events stats with absolute period', function () { + it('requests events stats with absolute period', async function () { const start = new Date('2017-10-12T12:00:00.000Z'); const end = new Date('2017-10-17T00:00:00.000Z'); - doEventsRequest(api, { + await doEventsRequest(api, { ...opts, + includeAllArgs: false, includePrevious: false, start, end, @@ -121,8 +125,9 @@ describe('Events ActionCreator', function () { it('requests events stats with absolute period including previous period', async function () { const start = new Date('2017-10-12T12:00:00.000Z'); const end = new Date('2017-10-17T00:00:00.000Z'); - await doEventsRequest(api, { + await doEventsRequest(api, { ...opts, + includeAllArgs: false, includePrevious: true, start, end, @@ -143,8 +148,9 @@ describe('Events ActionCreator', function () { }); it('spreads query extras', async function () { - await doEventsRequest(api, { + await doEventsRequest(api, { ...opts, + includeAllArgs: false, queryExtras: {useOnDemandMetrics: 'true'}, partial: true, }); diff --git a/static/app/actionCreators/events.tsx b/static/app/actionCreators/events.tsx index ba012f0b19a8a1..3c4f5bd28e070c 100644 --- a/static/app/actionCreators/events.tsx +++ b/static/app/actionCreators/events.tsx @@ -2,7 +2,7 @@ import type {LocationDescriptor} from 'history'; import pick from 'lodash/pick'; import {addErrorMessage} from 'sentry/actionCreators/indicator'; -import type {ApiResult, Client, ResponseMeta} from 'sentry/api'; +import type {ApiResult, Client} from 'sentry/api'; import {canIncludePreviousPeriod} from 'sentry/components/charts/utils'; import {t} from 'sentry/locale'; import type {DateString} from 'sentry/types/core'; @@ -61,7 +61,7 @@ type Options = { yAxis?: string | string[]; }; -export type EventsStatsOptions = {includeAllArgs?: T} & Options; +export type EventsStatsOptions = {includeAllArgs: T} & Options; /** * Make requests to `events-stats` endpoint @@ -83,7 +83,7 @@ export type EventsStatsOptions = {includeAllArgs?: T} & Optio * @param {Record} options.queryExtras A list of extra query parameters * @param {(org: OrganizationSummary) => string} options.generatePathname A function that returns an override for the pathname */ -export const doEventsRequest = ( +export const doEventsRequest = ( api: Client, { organization, @@ -113,9 +113,7 @@ export const doEventsRequest = ( useRpc, }: EventsStatsOptions ): IncludeAllArgsType extends true - ? Promise< - [EventsStats | MultiSeriesEventsStats, string | undefined, ResponseMeta | undefined] - > + ? Promise> : Promise => { const pathname = generatePathname?.(organization) ?? diff --git a/static/app/components/charts/eventsRequest.spec.tsx b/static/app/components/charts/eventsRequest.spec.tsx index 54ce765126bda7..7d1d6d2a0e44d2 100644 --- a/static/app/components/charts/eventsRequest.spec.tsx +++ b/static/app/components/charts/eventsRequest.spec.tsx @@ -28,6 +28,7 @@ describe('EventsRequest', function () { query: '', children: () => null, partial: false, + includeAllArgs: false, includeTransformedData: true, }; diff --git a/static/app/components/charts/eventsRequest.tsx b/static/app/components/charts/eventsRequest.tsx index 71c05a3be3bf78..69916872c6c18c 100644 --- a/static/app/components/charts/eventsRequest.tsx +++ b/static/app/components/charts/eventsRequest.tsx @@ -65,6 +65,7 @@ export type RenderProps = LoadingStatus & }; type DefaultProps = { + includeAllArgs: false; /** * Include data for previous period */ @@ -277,6 +278,7 @@ class EventsRequest extends PureComponent(api, props); } catch (resp) { if (resp?.responseJSON?.detail) { errorMessage = resp.responseJSON.detail; diff --git a/static/app/components/charts/onDemandMetricRequest.tsx b/static/app/components/charts/onDemandMetricRequest.tsx index be5e2df553d625..552fe7a0ff1c54 100644 --- a/static/app/components/charts/onDemandMetricRequest.tsx +++ b/static/app/components/charts/onDemandMetricRequest.tsx @@ -7,7 +7,7 @@ import type {EventsStats, MultiSeriesEventsStats} from 'sentry/types/organizatio export class OnDemandMetricRequest extends EventsRequest { fetchExtrapolatedData = async (): Promise => { const {api, organization, ...props} = this.props; - const retVal = await doEventsRequest(api, { + const retVal = await doEventsRequest(api, { ...props, organization, generatePathname: () => diff --git a/static/app/views/alerts/rules/metric/triggers/chart/index.tsx b/static/app/views/alerts/rules/metric/triggers/chart/index.tsx index 1ee773349a423d..33655ec6a21ef6 100644 --- a/static/app/views/alerts/rules/metric/triggers/chart/index.tsx +++ b/static/app/views/alerts/rules/metric/triggers/chart/index.tsx @@ -571,6 +571,7 @@ class TriggersChart extends PureComponent { if (isOnDemandMetricAlert) { const {sampleRate} = this.state; const baseProps: EventsRequestProps = { + includeAllArgs: false, api, organization, query, diff --git a/static/app/views/dashboards/datasetConfig/errorsAndTransactions.tsx b/static/app/views/dashboards/datasetConfig/errorsAndTransactions.tsx index 7441c24d1d076b..ce81a1bd6cfbd4 100644 --- a/static/app/views/dashboards/datasetConfig/errorsAndTransactions.tsx +++ b/static/app/views/dashboards/datasetConfig/errorsAndTransactions.tsx @@ -634,8 +634,9 @@ export async function doOnDemandMetricsRequest( const fetchEstimatedStats = () => `/organizations/${requestData.organization.slug}/metrics-estimation-stats/`; - const response = await doEventsRequest(api, { + const response = await doEventsRequest(api, { ...requestData, + includeAllArgs: true, queryExtras: { ...requestData.queryExtras, useOnDemandMetrics: true, @@ -645,21 +646,17 @@ export async function doOnDemandMetricsRequest( generatePathname: isEditing ? fetchEstimatedStats : undefined, }); - // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message response[0] = {...response[0]}; if ( hasDatasetSelector(requestData.organization) && widgetType === WidgetType.DISCOVER ) { - // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message - const meta = response[0].meta ?? {}; + const meta: any = response[0].meta ?? {}; meta.discoverSplitDecision = 'transaction-like'; - // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message response[0] = {...response[0], ...{meta}}; } - // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message return [response[0], response[1], response[2]]; } catch (err) { Sentry.captureMessage('Failed to fetch metrics estimation stats', {extra: err}); diff --git a/static/app/views/performance/landing/widgets/widgets/lineChartListWidget.tsx b/static/app/views/performance/landing/widgets/widgets/lineChartListWidget.tsx index 51b29ec1810ab3..bdeb74a75cde3b 100644 --- a/static/app/views/performance/landing/widgets/widgets/lineChartListWidget.tsx +++ b/static/app/views/performance/landing/widgets/widgets/lineChartListWidget.tsx @@ -472,6 +472,7 @@ export function LineChartListWidget(props: PerformanceWidgetProps) { return ( (