Skip to content

Commit f7af13d

Browse files
committed
chore(insights): Update all if combinators to include operator
- I'm updating count_if to match discover's api in #96689, so for consistency adding the operator to all our existing -if combinator usage before deprecating it
1 parent 293699a commit f7af13d

File tree

12 files changed

+68
-66
lines changed

12 files changed

+68
-66
lines changed

static/app/views/insights/agentMonitoring/components/modelsTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const EMPTY_ARRAY: never[] = [];
6666
const defaultColumnOrder: Array<GridColumnOrder<string>> = [
6767
{key: 'model', name: t('Model'), width: COL_WIDTH_UNDEFINED},
6868
{key: 'count()', name: t('Requests'), width: 120},
69-
{key: 'count_if(span.status,unknown)', name: t('Errors'), width: 120},
69+
{key: 'count_if(span.status,equals,unknown)', name: t('Errors'), width: 120},
7070
{key: 'avg(span.duration)', name: t('Avg'), width: 100},
7171
{key: 'p95(span.duration)', name: t('P95'), width: 100},
7272
{key: AI_COST_ATTRIBUTE_SUM, name: t('Cost'), width: 100},
@@ -81,7 +81,7 @@ const rightAlignColumns = new Set([
8181
AI_OUTPUT_TOKENS_REASONING_ATTRIBUTE_SUM,
8282
AI_INPUT_TOKENS_CACHED_ATTRIBUTE_SUM,
8383
AI_COST_ATTRIBUTE_SUM,
84-
'count_if(span.status,unknown)',
84+
'count_if(span.status,equals,unknown)',
8585
'avg(span.duration)',
8686
'p95(span.duration)',
8787
]);
@@ -123,7 +123,7 @@ export function ModelsTable() {
123123
'count()',
124124
'avg(span.duration)',
125125
'p95(span.duration)',
126-
'count_if(span.status,unknown)', // spans with status unknown are errors
126+
'count_if(span.status,equals,unknown)', // spans with status unknown are errors
127127
],
128128
sorts: [{field: sortField, kind: sortOrder}],
129129
search: fullQuery,
@@ -145,7 +145,7 @@ export function ModelsTable() {
145145
avg: span['avg(span.duration)'] ?? 0,
146146
p95: span['p95(span.duration)'] ?? 0,
147147
cost: Number(span[AI_COST_ATTRIBUTE_SUM]),
148-
errors: span['count_if(span.status,unknown)'] ?? 0,
148+
errors: span['count_if(span.status,equals,unknown)'] ?? 0,
149149
inputTokens: Number(span[AI_INPUT_TOKENS_ATTRIBUTE_SUM]),
150150
inputCachedTokens: Number(span[AI_INPUT_TOKENS_CACHED_ATTRIBUTE_SUM]),
151151
outputTokens: Number(span[AI_OUTPUT_TOKENS_ATTRIBUTE_SUM]),
@@ -269,7 +269,7 @@ const BodyCell = memo(function BodyCell({
269269
return <DurationCell milliseconds={dataRow.p95} />;
270270
case AI_COST_ATTRIBUTE_SUM:
271271
return <TextAlignRight>{formatLLMCosts(dataRow.cost)}</TextAlignRight>;
272-
case 'count_if(span.status,unknown)':
272+
case 'count_if(span.status,equals,unknown)':
273273
return (
274274
<ErrorCell
275275
value={dataRow.errors}

static/app/views/insights/agentMonitoring/components/toolsTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ const EMPTY_ARRAY: never[] = [];
5151
const defaultColumnOrder: Array<GridColumnOrder<string>> = [
5252
{key: 'tool', name: t('Tool Name'), width: COL_WIDTH_UNDEFINED},
5353
{key: 'count()', name: t('Requests'), width: 120},
54-
{key: 'count_if(span.status,unknown)', name: t('Errors'), width: 120},
54+
{key: 'count_if(span.status,equals,unknown)', name: t('Errors'), width: 120},
5555
{key: 'avg(span.duration)', name: t('Avg'), width: 100},
5656
{key: 'p95(span.duration)', name: t('P95'), width: 100},
5757
];
5858

5959
const rightAlignColumns = new Set([
6060
'count()',
61-
'count_if(span.status,unknown)',
61+
'count_if(span.status,equals,unknown)',
6262
'avg(span.duration)',
6363
'p95(span.duration)',
6464
]);
@@ -97,7 +97,7 @@ export function ToolsTable() {
9797
'avg(span.duration)',
9898
'p95(span.duration)',
9999
'failure_rate()',
100-
'count_if(span.status,unknown)', // spans with status unknown are errors
100+
'count_if(span.status,equals,unknown)', // spans with status unknown are errors
101101
],
102102
sorts: [{field: sortField, kind: sortOrder}],
103103
search: fullQuery,
@@ -118,7 +118,7 @@ export function ToolsTable() {
118118
requests: Number(span['count()']),
119119
avg: Number(span['avg(span.duration)']),
120120
p95: Number(span['p95(span.duration)']),
121-
errors: Number(span['count_if(span.status,unknown)']),
121+
errors: Number(span['count_if(span.status,equals,unknown)']),
122122
}));
123123
}, [toolsRequest.data]);
124124

@@ -218,7 +218,7 @@ const BodyCell = memo(function BodyCell({
218218
return <DurationCell milliseconds={dataRow.avg} />;
219219
case 'p95(span.duration)':
220220
return <DurationCell milliseconds={dataRow.p95} />;
221-
case 'count_if(span.status,unknown)':
221+
case 'count_if(span.status,equals,unknown)':
222222
return (
223223
<ErrorCell
224224
value={dataRow.errors}

static/app/views/insights/agentMonitoring/components/tracesTable.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ const rightAlignColumns = new Set([
8282
'timestamp',
8383
]);
8484

85-
const GENERATION_COUNTS = AI_GENERATION_OPS.map(op => `count_if(span.op,${op})` as const);
85+
const GENERATION_COUNTS = AI_GENERATION_OPS.map(
86+
op => `count_if(span.op,equals,${op})` as const
87+
);
8688

8789
const AI_AGENT_SUB_OPS = [...AI_GENERATION_OPS, ...AI_TOOL_CALL_OPS].map(
88-
op => `count_if(span.op,${op})` as const
90+
op => `count_if(span.op,equals,${op})` as const
8991
);
9092

9193
export function TracesTable() {
@@ -114,7 +116,7 @@ export function TracesTable() {
114116
fields: [
115117
'trace',
116118
...GENERATION_COUNTS,
117-
'count_if(span.op,gen_ai.execute_tool)',
119+
'count_if(span.op,equals,gen_ai.execute_tool)',
118120
AI_TOKEN_USAGE_ATTRIBUTE_SUM,
119121
AI_COST_ATTRIBUTE_SUM,
120122
],
@@ -160,7 +162,7 @@ export function TracesTable() {
160162
(sum, key) => sum + (span[key] ?? 0),
161163
0
162164
),
163-
toolCalls: span['count_if(span.op,gen_ai.execute_tool)'] ?? 0,
165+
toolCalls: span['count_if(span.op,equals,gen_ai.execute_tool)'] ?? 0,
164166
totalTokens: Number(span[AI_TOKEN_USAGE_ATTRIBUTE_SUM] ?? 0),
165167
totalCost: Number(span[AI_COST_ATTRIBUTE_SUM] ?? 0),
166168
totalErrors: errors[span.trace] ?? 0,

static/app/views/insights/common/components/tableCells/renderHeadCell.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const SORTABLE_FIELDS = new Set([
6565
SpanFields.MESSAGING_MESSAGE_DESTINATION_NAME,
6666
'count_op(queue.publish)',
6767
'count_op(queue.process)',
68-
'avg_if(span.duration,span.op,queue.process)',
68+
'avg_if(span.duration,span.op,equals,queue.process)',
6969
'avg(messaging.message.receive.latency)',
7070
'time_spent_percentage(span.duration)',
7171
'transaction',
@@ -78,10 +78,10 @@ const SORTABLE_FIELDS = new Set([
7878
'failure_rate()',
7979
'performance_score(measurements.score.total)',
8080
'count_unique(user)',
81-
'p50_if(span.duration,is_transaction,true)',
82-
'p95_if(span.duration,is_transaction,true)',
83-
'failure_rate_if(is_transaction,true)',
84-
'sum_if(span.duration,is_transaction,true)',
81+
'p50_if(span.duration,is_transaction,equals,true)',
82+
'p95_if(span.duration,is_transaction,equals,true)',
83+
'failure_rate_if(is_transaction,equals,true)',
84+
'sum_if(span.duration,is_transaction,equals,true)',
8585
'p75(measurements.frames_slow_rate)',
8686
'p75(measurements.frames_frozen_rate)',
8787
'trace_status_rate(ok)',

static/app/views/insights/mobile/appStarts/views/screenSummaryPage.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ describe('Screen Summary', function () {
101101
data: [
102102
{
103103
'span.op': 'app.start.cold',
104-
'avg_if(span.duration,release,com.example.vu.android@2.10.5)': 1000,
105-
'avg_if(span.duration,release,com.example.vu.android@2.10.3+42)': 2000,
104+
'avg_if(span.duration,release,equals,com.example.vu.android@2.10.5)': 1000,
105+
'avg_if(span.duration,release,equals,com.example.vu.android@2.10.3+42)': 2000,
106106
'avg_compare(span.duration,release,com.example.vu.android@2.10.5,com.example.vu.android@2.10.3+42)':
107107
-0.5,
108-
'count_if(release,com.example.vu.android@2.10.5)': 20,
109-
'count_if(release,com.example.vu.android@2.10.3+42)': 10,
108+
'count_if(release,equals,com.example.vu.android@2.10.5)': 20,
109+
'count_if(release,equals,com.example.vu.android@2.10.3+42)': 10,
110110
},
111111
],
112112
},

static/app/views/insights/mobile/appStarts/views/screenSummaryPage.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ export function ScreenSummaryContentPage() {
139139
')',
140140
]}
141141
fields={[
142-
`avg_if(span.duration,release,${primaryRelease})`,
143-
`avg_if(span.duration,release,${secondaryRelease})`,
142+
`avg_if(span.duration,release,equals,${primaryRelease})`,
143+
`avg_if(span.duration,release,equals,${secondaryRelease})`,
144144
`avg_compare(span.duration,release,${primaryRelease},${secondaryRelease})`,
145-
`count_if(release,${primaryRelease})`,
146-
`count_if(release,${secondaryRelease})`,
145+
`count_if(release,equals,${primaryRelease})`,
146+
`count_if(release,equals,${secondaryRelease})`,
147147
]}
148148
blocks={[
149149
{
@@ -153,7 +153,7 @@ export function ScreenSummaryContentPage() {
153153
appStartType === COLD_START_TYPE
154154
? t('Avg Cold Start (%s)', PRIMARY_RELEASE_ALIAS)
155155
: t('Avg Warm Start (%s)', PRIMARY_RELEASE_ALIAS),
156-
dataKey: `avg_if(span.duration,release,${primaryRelease})`,
156+
dataKey: `avg_if(span.duration,release,equals,${primaryRelease})`,
157157
},
158158
{
159159
unit: DurationUnit.MILLISECOND,
@@ -162,7 +162,7 @@ export function ScreenSummaryContentPage() {
162162
appStartType === COLD_START_TYPE
163163
? t('Avg Cold Start (%s)', SECONDARY_RELEASE_ALIAS)
164164
: t('Avg Warm Start (%s)', SECONDARY_RELEASE_ALIAS),
165-
dataKey: `avg_if(span.duration,release,${secondaryRelease})`,
165+
dataKey: `avg_if(span.duration,release,equals,${secondaryRelease})`,
166166
},
167167
{
168168
unit: 'percent_change',
@@ -173,12 +173,12 @@ export function ScreenSummaryContentPage() {
173173
{
174174
unit: 'count',
175175
title: t('Count (%s)', PRIMARY_RELEASE_ALIAS),
176-
dataKey: `count_if(release,${primaryRelease})`,
176+
dataKey: `count_if(release,equals,${primaryRelease})`,
177177
},
178178
{
179179
unit: 'count',
180180
title: t('Count (%s)', SECONDARY_RELEASE_ALIAS),
181-
dataKey: `count_if(release,${secondaryRelease})`,
181+
dataKey: `count_if(release,equals,${secondaryRelease})`,
182182
},
183183
]}
184184
referrer="api.starfish.mobile-startup-totals"

static/app/views/insights/pages/frontend/frontendOverviewPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ function EAPOverviewPage() {
223223
'transaction',
224224
'project',
225225
'tpm()',
226-
'p50_if(span.duration,is_transaction,true)',
227-
'p95_if(span.duration,is_transaction,true)',
228-
'failure_rate_if(is_transaction,true)',
226+
'p50_if(span.duration,is_transaction,equals,true)',
227+
'p95_if(span.duration,is_transaction,equals,true)',
228+
'failure_rate_if(is_transaction,equals,true)',
229229
...(displayPerfScore
230230
? (['performance_score(measurements.score.total)'] as const)
231231
: []),
232232
'count_unique(user)',
233-
'sum_if(span.duration,is_transaction,true)',
233+
'sum_if(span.duration,is_transaction,equals,true)',
234234
],
235235
},
236236
'api.performance.landing-table'

static/app/views/insights/pages/frontend/frontendOverviewTable.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ type Row = Pick<
3131
| 'transaction'
3232
| 'project'
3333
| 'tpm()'
34-
| 'p50_if(span.duration,is_transaction,true)'
35-
| 'p95_if(span.duration,is_transaction,true)'
36-
| 'failure_rate_if(is_transaction,true)'
34+
| 'p50_if(span.duration,is_transaction,equals,true)'
35+
| 'p95_if(span.duration,is_transaction,equals,true)'
36+
| 'failure_rate_if(is_transaction,equals,true)'
3737
| 'count_unique(user)'
38-
| 'sum_if(span.duration,is_transaction,true)'
38+
| 'sum_if(span.duration,is_transaction,equals,true)'
3939
| 'performance_score(measurements.score.total)'
4040
>;
4141

@@ -44,11 +44,11 @@ type Column = GridColumnHeader<
4444
| 'transaction'
4545
| 'project'
4646
| 'tpm()'
47-
| 'p50_if(span.duration,is_transaction,true)'
48-
| 'p95_if(span.duration,is_transaction,true)'
49-
| 'failure_rate_if(is_transaction,true)'
47+
| 'p50_if(span.duration,is_transaction,equals,true)'
48+
| 'p95_if(span.duration,is_transaction,equals,true)'
49+
| 'failure_rate_if(is_transaction,equals,true)'
5050
| 'count_unique(user)'
51-
| 'sum_if(span.duration,is_transaction,true)'
51+
| 'sum_if(span.duration,is_transaction,equals,true)'
5252
| 'performance_score(measurements.score.total)'
5353
>;
5454

@@ -69,17 +69,17 @@ const COLUMN_ORDER: Column[] = [
6969
width: COL_WIDTH_UNDEFINED,
7070
},
7171
{
72-
key: `p50_if(span.duration,is_transaction,true)`,
72+
key: `p50_if(span.duration,is_transaction,equals,true)`,
7373
name: t('p50()'),
7474
width: COL_WIDTH_UNDEFINED,
7575
},
7676
{
77-
key: `p95_if(span.duration,is_transaction,true)`,
77+
key: `p95_if(span.duration,is_transaction,equals,true)`,
7878
name: t('p95()'),
7979
width: COL_WIDTH_UNDEFINED,
8080
},
8181
{
82-
key: 'failure_rate_if(is_transaction,true)',
82+
key: 'failure_rate_if(is_transaction,equals,true)',
8383
name: t('Failure Rate'),
8484
width: COL_WIDTH_UNDEFINED,
8585
},
@@ -89,7 +89,7 @@ const COLUMN_ORDER: Column[] = [
8989
width: COL_WIDTH_UNDEFINED,
9090
},
9191
{
92-
key: 'sum_if(span.duration,is_transaction,true)',
92+
key: 'sum_if(span.duration,is_transaction,equals,true)',
9393
name: DataTitles.timeSpent,
9494
width: COL_WIDTH_UNDEFINED,
9595
tooltip: SPAN_HEADER_TOOLTIPS.timeSpent,
@@ -107,11 +107,11 @@ const SORTABLE_FIELDS = [
107107
'transaction',
108108
'project',
109109
'tpm()',
110-
'p50_if(span.duration,is_transaction,true)',
111-
'p95_if(span.duration,is_transaction,true)',
112-
'failure_rate_if(is_transaction,true)',
110+
'p50_if(span.duration,is_transaction,equals,true)',
111+
'p95_if(span.duration,is_transaction,equals,true)',
112+
'failure_rate_if(is_transaction,equals,true)',
113113
'count_unique(user)',
114-
'sum_if(span.duration,is_transaction,true)',
114+
'sum_if(span.duration,is_transaction,equals,true)',
115115
'performance_score(measurements.score.total)',
116116
] as const;
117117

static/app/views/insights/pages/platform/nextjs/clientTable.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export function ClientTable() {
8282
'avg(span.duration)',
8383
'p95(span.duration)',
8484
'performance_score(measurements.score.total)',
85-
'count_if(span.op,navigation)',
86-
'count_if(span.op,pageload)',
85+
'count_if(span.op,equals,navigation)',
86+
'count_if(span.op,equals,pageload)',
8787
],
8888
cursorParamName: 'tableCursor',
8989
referrer: Referrer.CLIENT_TABLE,
@@ -107,7 +107,7 @@ export function ClientTable() {
107107
const renderBodyCell = useCallback(
108108
(column: GridColumnHeader<string>, dataRow: TableData) => {
109109
if (column.key === 'performance_score(measurements.score.total)') {
110-
if (!dataRow['count_if(span.op,pageload)']) {
110+
if (!dataRow['count_if(span.op,equals,pageload)']) {
111111
return <AlignCenter>{' — '}</AlignCenter>;
112112
}
113113
return (

static/app/views/insights/queues/components/messageSpanSamplesPanel.spec.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ describe('messageSpanSamplesPanel', () => {
7070
'trace_status_rate(ok)': 0.8,
7171
'count_op(queue.publish)': 222,
7272
'count_op(queue.process)': 333,
73-
'avg_if(span.duration,span.op,queue.publish)': 3.0,
74-
'avg_if(span.duration,span.op,queue.process)': 4.0,
73+
'avg_if(span.duration,span.op,equals,queue.publish)': 3.0,
74+
'avg_if(span.duration,span.op,equals,queue.process)': 4.0,
7575
'count()': 555,
7676
'avg(messaging.message.receive.latency)': 2.0,
7777
'avg(span.duration)': 3.5,
@@ -83,8 +83,8 @@ describe('messageSpanSamplesPanel', () => {
8383
'trace_status_rate(ok)': 'percentage',
8484
'count_op(queue.publish)': 'integer',
8585
'count_op(queue.process)': 'integer',
86-
'avg_if(span.duration,span.op,queue.publish)': 'duration',
87-
'avg_if(span.duration,span.op,queue.process)': 'duration',
86+
'avg_if(span.duration,span.op,equals,queue.publish)': 'duration',
87+
'avg_if(span.duration,span.op,equals,queue.process)': 'duration',
8888
'count()': 'integer',
8989
'avg(messaging.message.receive.latency)': 'number',
9090
'avg(span.duration)': 'duration',
@@ -94,8 +94,8 @@ describe('messageSpanSamplesPanel', () => {
9494
'trace_status_rate(ok)': null,
9595
'count_op(queue.publish)': null,
9696
'count_op(queue.process)': null,
97-
'avg_if(span.duration,span.op,queue.publish)': 'millisecond',
98-
'avg_if(span.duration,span.op,queue.process)': 'millisecond',
97+
'avg_if(span.duration,span.op,equals,queue.publish)': 'millisecond',
98+
'avg_if(span.duration,span.op,equals,queue.process)': 'millisecond',
9999
'count()': null,
100100
'avg(messaging.message.receive.latency)': null,
101101
'avg(span.duration)': 'millisecond',
@@ -184,8 +184,8 @@ describe('messageSpanSamplesPanel', () => {
184184
'count_op(queue.process)',
185185
'sum(span.duration)',
186186
'avg(span.duration)',
187-
'avg_if(span.duration,span.op,queue.publish)',
188-
'avg_if(span.duration,span.op,queue.process)',
187+
'avg_if(span.duration,span.op,equals,queue.publish)',
188+
'avg_if(span.duration,span.op,equals,queue.process)',
189189
'avg(messaging.message.receive.latency)',
190190
'trace_status_rate(ok)',
191191
],
@@ -296,8 +296,8 @@ describe('messageSpanSamplesPanel', () => {
296296
'count_op(queue.process)',
297297
'sum(span.duration)',
298298
'avg(span.duration)',
299-
'avg_if(span.duration,span.op,queue.publish)',
300-
'avg_if(span.duration,span.op,queue.process)',
299+
'avg_if(span.duration,span.op,equals,queue.publish)',
300+
'avg_if(span.duration,span.op,equals,queue.process)',
301301
'avg(messaging.message.receive.latency)',
302302
'trace_status_rate(ok)',
303303
],

0 commit comments

Comments
 (0)