Skip to content
Open
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
18 changes: 18 additions & 0 deletions static/app/views/explore/logs/confidenceFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import type {RawLogCounts} from 'sentry/views/explore/logs/useLogsQuery';

interface ConfidenceFooterProps {
chartInfo: ChartInfo;
hasUserQuery: boolean;
isLoading: boolean;
rawLogCounts: RawLogCounts;
}

export function ConfidenceFooter({
chartInfo: currentChartInfo,
hasUserQuery,
isLoading,
rawLogCounts,
}: ConfidenceFooterProps) {
Expand All @@ -28,6 +30,7 @@ export function ConfidenceFooter({
<Container>
<ConfidenceMessage
isLoading={isLoading}
hasUserQuery={hasUserQuery}
rawLogCounts={rawLogCounts}
confidence={chartInfo.confidence}
dataScanned={chartInfo.dataScanned}
Expand All @@ -40,6 +43,7 @@ export function ConfidenceFooter({
}

interface ConfidenceMessageProps {
hasUserQuery: boolean;
isLoading: boolean;
rawLogCounts: RawLogCounts;
confidence?: Confidence;
Expand All @@ -55,6 +59,7 @@ function ConfidenceMessage({
dataScanned,
confidence: _confidence,
topEvents,
hasUserQuery,
isLoading,
isSampled,
}: ConfidenceMessageProps) {
Expand All @@ -79,6 +84,19 @@ function ConfidenceMessage({
const suffix = rawLogCounts.highAccuracy.count ? t('logs') : '';

if (dataScanned === 'full') {
if (!hasUserQuery) {
if (isTopN) {
return tct('Log count for top [topEvents] groups: [matchingLogsCount]', {
topEvents,
matchingLogsCount,
});
}

return tct('Log count: [matchingLogsCount]', {
matchingLogsCount,
});
}

// For logs, if the full data was scanned, we can assume that no
// extrapolation happened and we should remove mentions of extrapolation.
if (isTopN) {
Expand Down
3 changes: 3 additions & 0 deletions static/app/views/explore/logs/logsGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
useQueryParamsAggregateFields,
useQueryParamsAggregateSortBys,
useQueryParamsMode,
useQueryParamsQuery,
useQueryParamsSearch,
useQueryParamsTopEventsLimit,
useQueryParamsVisualizes,
Expand Down Expand Up @@ -119,6 +120,7 @@ function Graph({
visualize,
}: GraphProps) {
const aggregate = visualize.yAxis;
const userQuery = useQueryParamsQuery();
const topEventsLimit = useQueryParamsTopEventsLimit();

const [interval, setInterval, intervalOptions] = useChartInterval({
Expand Down Expand Up @@ -204,6 +206,7 @@ function Graph({
chartInfo={chartInfo}
isLoading={timeseriesResult.isLoading}
rawLogCounts={rawLogCounts}
hasUserQuery={!!userQuery}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[BestPractice]

The hasUserQuery prop is passed as !!userQuery but this will be true for any non-empty string, including whitespace-only queries. Consider using a more robust check:

Suggested change
hasUserQuery={!!userQuery}
hasUserQuery={!!(userQuery && userQuery.trim())}

Committable suggestion

Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Context for Agents
[**BestPractice**]

The `hasUserQuery` prop is passed as `!!userQuery` but this will be `true` for any non-empty string, including whitespace-only queries. Consider using a more robust check:

```suggestion
            hasUserQuery={!!(userQuery && userQuery.trim())}
```

⚡ **Committable suggestion**

Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

File: static/app/views/explore/logs/logsGraph.tsx
Line: 209

/>
)
}
Expand Down