Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: Faster way to view associated logs for a trace in logs explorer (#10242)

Ishan0c660f861863
diff --git a/frontend/src/container/LogDetailedView/TableView/TableViewActions.styles.scss b/frontend/src/container/LogDetailedView/TableView/TableViewActions.styles.scss
index 5f5e94c74b..218db3be16 100644
--- a/frontend/src/container/LogDetailedView/TableView/TableViewActions.styles.scss
+++ b/frontend/src/container/LogDetailedView/TableView/TableViewActions.styles.scss
@@ -35,10 +35,10 @@
box-shadow: 4px 10px 16px 2px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(20px);
padding: 0px;
- .group-by-clause {
+ .more-filter-actions {
display: flex;
align-items: center;
- gap: 4px;
+ gap: 8px;
color: var(--bg-vanilla-400);
font-family: Inter;
font-size: 14px;
@@ -53,7 +53,7 @@
}
}
- .group-by-clause:hover {
+ .more-filter-actions:hover {
background-color: unset !important;
}
}
@@ -65,7 +65,7 @@
border: 1px solid var(--bg-vanilla-400);
background: var(--bg-vanilla-100) !important;
- .group-by-clause {
+ .more-filter-actions {
color: var(--bg-ink-400);
}
}
diff --git a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx
index 1d7d86ce4f..d099af897d 100644
--- a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx
+++ b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx
@@ -1,4 +1,5 @@
/* eslint-disable sonarjs/no-duplicate-string */
+/* eslint-disable sonarjs/cognitive-complexity */
import React, { useCallback, useMemo, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { Color } from '@signozhq/design-tokens';
@@ -16,7 +17,12 @@ import { MetricsType } from 'container/MetricsApplication/constant';
import { useGetSearchQueryParam } from 'hooks/queryBuilder/useGetSearchQueryParam';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { ICurrentQueryData } from 'hooks/useHandleExplorerTabChange';
-import { ArrowDownToDot, ArrowUpFromDot, Ellipsis } from 'lucide-react';
+import {
+ ArrowDownToDot,
+ ArrowUpFromDot,
+ Ellipsis,
+ RefreshCw,
+} from 'lucide-react';
import { ExplorerViews } from 'pages/LogsExplorer/utils';
import { useTimezone } from 'providers/Timezone';
import {
@@ -205,6 +211,70 @@ export default function TableViewActions(
viewName,
]);
+ const handleReplaceFilter = useCallback((): void => {
+ if (!stagedQuery) {
+ return;
+ }
+ const normalizedDataType: DataTypes | undefined =
+ dataType && Object.values(DataTypes).includes(dataType as DataTypes)
+ ? (dataType as DataTypes)
+ : undefined;
+
+ const updatedQuery = updateQueriesData(
+ stagedQuery,
+ 'queryData',
+ (item, index) => {
+ // Only replace filters for index 0
+ if (index === 0) {
+ const newFilterItem: BaseAutocompleteData = {
+ key: fieldFilterKey,
+ type: fieldType || '',
+ dataType: normalizedDataType,
+ };
+
+ // Create new filter items array with single IN filter
+ const newFilters = {
+ items: [
+ {
+ id: '',
+ key: newFilterItem,
+ op: OPERATORS.IN,
+ value: [parseFieldValue(fieldData.value)],
+ },
+ ],
+ op: 'AND',
+ };
+
+ // Clear the expression and update filters
+ return {
+ ...item,
+ filters: newFilters,
+ filter: { expression: '' },
+ };
+ }
+
+ return item;
+ },
+ );
+
+ const queryData: ICurrentQueryData = {
+ name: viewName,
+ id: updatedQuery.id,
+ query: updatedQuery,
+ };
+
+ handleChangeSelectedView?.(ExplorerViews.LIST, queryData);
+ }, [
+ stagedQuery,
+ updateQueriesData,
+ fieldFilterKey,
+ fieldType,
+ dataType,
+ fieldData,
+ handleChangeSelectedView,
+ viewName,
+ ]);
+
// Memoize textToCopy computation
const textToCopy = useMemo(() => {
let text = fieldData.value;
@@ -327,13 +397,21 @@ export default function TableViewActions(
content={
<div>
<Button
- className="group-by-clause"
+ className="more-filter-actions"
type="text"
icon={<GroupByIcon />}
onClick={handleGroupByAttribute}
>
Group By Attribute
</Button>
+ <Button
+ className="more-filter-actions"
+ type="text"
+ icon={<RefreshCw size={14} />}
+ onClick={handleReplaceFilter}
+ >
+ Replace filters with this value
+ </Button>
</div>
}
rootClassName="table-view-actions-content"
@@ -405,13 +483,21 @@ export default function TableViewActions(
content={
<div>
<Button
- className="group-by-clause"
+ className="more-filter-actions"
type="text"
icon={<GroupByIcon />}
onClick={handleGroupByAttribute}
>
Group By Attribute
</Button>
+ <Button
+ className="more-filter-actions"
+ type="text"
+ icon={<RefreshCw size={14} />}
+ onClick={handleReplaceFilter}
+ >
+ Replace filters with this value
+ </Button>
</div>
}
rootClassName="table-view-actions-content"