Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions static/app/utils/timeSeries/parseGroupBy.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ describe('parseGroupBy', () => {
expect(result).toBeNull();
});

it('returns null for "None" group name', () => {
const result = parseGroupBy('None', ['field1']);
expect(result).toEqual([{key: 'field1', value: null}]);
});

it('parses single field and value correctly', () => {
const result = parseGroupBy('value1', ['field1']);
expect(result).toEqual([{key: 'field1', value: 'value1'}]);
Expand Down
10 changes: 10 additions & 0 deletions static/app/utils/timeSeries/parseGroupBy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function parseGroupBy(
groupName: string,
fields: string[]
): TimeSeriesGroupBy[] | null {
// "Other", by definition, does not have any known group by values
if (groupName === 'Other') {
return null;
}
Expand All @@ -15,6 +16,15 @@ export function parseGroupBy(
}

const groupKeys = fields;

// `/events-stats/` converts Python's `None` into `"None"`. Here, we do the reverse
if (groupName === 'None') {
return groupKeys.map(groupKey => ({
key: groupKey,
value: null,
}));
}

const groupValues = groupName.split(DELIMITER);

// If the `groupName` contains commas, that will result in more values than
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('formatSeriesName', () => {
'v0.0.2',
],
['p95(span.duration)', [{key: 'release', value: 'v0.0.2'}], 'v0.0.2'],
['p95(span.duration)', [{key: 'gen_ai.request.model', value: null}], 'null'],
['p95(span.duration)', [{key: 'gen_ai.request.model', value: null}], '(no value)'],
[
'p95(span.duration)',
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export function formatTimeSeriesLabel(timeSeries: TimeSeries): string {
return formatVersion(groupBy.value);
}

// String interpolation converts `null` to `"null"` and `undefined` to
// `"undefined"`, which is what we want, rather than an empty string
if (groupBy.value === null) {
return t('(no value)');
}

return `${groupBy.value}`;
})
.join(',')}`;
Expand Down
3 changes: 2 additions & 1 deletion static/app/views/insights/agents/components/modelName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled from '@emotion/styled';
import {PlatformIcon} from 'platformicons';

import {Flex} from 'sentry/components/core/layout';
import {t} from 'sentry/locale';
import type {Space} from 'sentry/utils/theme/theme';

interface ModelNameProps {
Expand All @@ -19,7 +20,7 @@ export function ModelName({modelId, provider, size = 16, gap = 'md'}: ModelNameP
<IconWrapper>
<PlatformIcon platform={platform ?? 'unknown'} size={size} />
</IconWrapper>
<NameWrapper>{modelId}</NameWrapper>
<NameWrapper>{modelId === 'null' ? t('(no value)') : modelId}</NameWrapper>
</Flex>
);
}
Expand Down
Loading