Skip to content

Commit 0b1823b

Browse files
authored
fix(ourlogs): Small ux fixes for logs on issues (#86939)
### Summary Limit to 10 rows on issues, make sure cursor is being used, and avoid rendering logs at all if no trace id is set.
1 parent 456aba0 commit 0b1823b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSectio
2222
export function LogsIssuesSection({
2323
initialCollapse,
2424
isOnEmbeddedView,
25-
limitToTraceId: traceId,
25+
limitToTraceId,
2626
}: {
2727
initialCollapse: boolean;
2828
} & Omit<LogsPageParamsProviderProps, 'children'>) {
2929
const organization = useOrganization();
3030
const feature = organization.features.includes('ourlogs-enabled');
31-
const tableData = useExploreLogsTable({enabled: feature});
31+
const tableData = useExploreLogsTable({enabled: feature, limit: 10});
3232
if (!feature) {
3333
return null;
3434
}
35+
if (!limitToTraceId) {
36+
// If there isn't a traceId (eg. profiling issue), we shouldn't show logs since they are trace specific.
37+
// We may change this in the future if we have a trace-group or we generate trace sids for these issue types.
38+
return null;
39+
}
3540
if (tableData?.data?.length === 0) {
3641
// Like breadcrumbs, we don't show the logs section if there are no logs.
3742
return null;
@@ -46,7 +51,7 @@ export function LogsIssuesSection({
4651
>
4752
<LogsPageParamsProvider
4853
isOnEmbeddedView={isOnEmbeddedView}
49-
limitToTraceId={traceId}
54+
limitToTraceId={limitToTraceId}
5055
>
5156
<LogsSectionContent tableData={tableData} />
5257
</LogsPageParamsProvider>

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

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import useOrganization from 'sentry/utils/useOrganization';
66
import useProjects from 'sentry/utils/useProjects';
77
import {
88
useLogsBaseSearch,
9+
useLogsCursor,
910
useLogsFields,
1011
useLogsProjectIds,
1112
useLogsSearch,
@@ -26,6 +27,7 @@ export type UseExploreLogsTableResult = ReturnType<typeof useExploreLogsTable>;
2627
export function useExploreLogsTable(options: Parameters<typeof useOurlogs>[0]) {
2728
const _search = useLogsSearch();
2829
const baseSearch = useLogsBaseSearch();
30+
const cursor = useLogsCursor();
2931
const fields = useLogsFields();
3032
const sortBys = useLogsSortBys();
3133
const projectIds = useLogsProjectIds();
@@ -38,6 +40,7 @@ export function useExploreLogsTable(options: Parameters<typeof useOurlogs>[0]) {
3840
const {data, meta, isError, isPending, pageLinks} = useOurlogs(
3941
{
4042
...options,
43+
cursor,
4144
sorts: sortBys,
4245
fields: Array.from(extendedFields),
4346
search,

0 commit comments

Comments
 (0)