Skip to content

Commit 80122e1

Browse files
insights(agents): use SpanFields in models table
Co-authored-by: Ogi <obostjancic@users.noreply.github.com>
1 parent d447d4b commit 80122e1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

static/app/views/insights/pages/agents/components/modelsTable.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {getAIGenerationsFilter} from 'sentry/views/insights/pages/agents/utils/q
3838
import {Referrer} from 'sentry/views/insights/pages/agents/utils/referrers';
3939
import {DurationCell} from 'sentry/views/insights/pages/platform/shared/table/DurationCell';
4040
import {NumberCell} from 'sentry/views/insights/pages/platform/shared/table/NumberCell';
41+
import {SpanFields} from 'sentry/views/insights/types';
4142

4243
interface TableData {
4344
avg: number;
@@ -100,7 +101,7 @@ export function ModelsTable() {
100101
const modelsRequest = useSpans(
101102
{
102103
fields: [
103-
'gen_ai.response.model',
104+
SpanFields.GEN_AI_RESPONSE_MODEL,
104105
'sum(gen_ai.usage.input_tokens)',
105106
'sum(gen_ai.usage.output_tokens)',
106107
'sum(gen_ai.usage.output_tokens.reasoning)',
@@ -126,7 +127,7 @@ export function ModelsTable() {
126127
}
127128

128129
return modelsRequest.data.map(span => ({
129-
model: span['gen_ai.response.model'],
130+
model: span[SpanFields.GEN_AI_RESPONSE_MODEL],
130131
requests: span['count()'] ?? 0,
131132
avg: span['avg(span.duration)'] ?? 0,
132133
p95: span['p95(span.duration)'] ?? 0,
@@ -223,9 +224,9 @@ const BodyCell = memo(function BodyCell({
223224
yAxes: ['avg(span.duration)'],
224225
},
225226
],
226-
query: `gen_ai.response.model:${dataRow.model}`,
227+
query: `${SpanFields.GEN_AI_RESPONSE_MODEL}:${dataRow.model}`,
227228
field: [
228-
'gen_ai.response.model',
229+
SpanFields.GEN_AI_RESPONSE_MODEL,
229230
'gen_ai.operation.name',
230231
'gen_ai.usage.input_tokens',
231232
'gen_ai.usage.output_tokens',
@@ -268,7 +269,7 @@ const BodyCell = memo(function BodyCell({
268269
<ErrorCell
269270
value={dataRow.errors}
270271
target={getExploreUrl({
271-
query: `${query} span.status:internal_error gen_ai.response.model:"${dataRow.model}"`,
272+
query: `${query} span.status:internal_error ${SpanFields.GEN_AI_RESPONSE_MODEL}:"${dataRow.model}"`,
272273
organization,
273274
selection,
274275
referrer: Referrer.MODELS_TABLE,

0 commit comments

Comments
 (0)