Skip to content

Commit 0ded31f

Browse files
authored
fix(ourlogs): Standardize count(logs) everywhere (#93603)
1 parent 9574590 commit 0ded31f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

static/app/utils/discover/fields.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,15 @@ export function prettifyParsedFunction(func: ParsedFunction) {
16341634
) {
16351635
return 'count(spans)';
16361636
}
1637+
1638+
if (
1639+
func.name === 'count' &&
1640+
func.arguments.length === 1 &&
1641+
func.arguments[0] === 'message'
1642+
) {
1643+
return 'count(logs)';
1644+
}
1645+
16371646
const args = func.arguments.map(prettifyTagKey);
16381647
return `${func.name}(${args.join(',')})`;
16391648
}

static/app/views/explore/logs/logsToolbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface LogsToolbarProps {
6464

6565
export function LogsToolbar({stringTags, numberTags}: LogsToolbarProps) {
6666
const aggregateFunction = useLogsAggregateFunction();
67-
const aggregateParam = useLogsAggregateParam() ?? 'logs';
67+
let aggregateParam = useLogsAggregateParam();
6868
const groupBy = useLogsGroupBy();
6969
const setLogsPageParams = useSetLogsPageParams();
7070
const functionArgRef = useRef<HTMLDivElement>(null);
@@ -75,6 +75,7 @@ export function LogsToolbar({stringTags, numberTags}: LogsToolbarProps) {
7575
}));
7676
if (aggregateFunction === 'count') {
7777
aggregatableKeys.unshift({label: t('logs'), value: 'logs'});
78+
aggregateParam = 'logs';
7879
}
7980

8081
return (

0 commit comments

Comments
 (0)