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.

fix: issues with the logs where clause filter (#6198)

Vikrant Guptac0e40614bff9
diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchDropdown.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchDropdown.tsx
index c910ca1be4..2e9f8341e3 100644
--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchDropdown.tsx
+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchDropdown.tsx
@@ -1,4 +1,6 @@
/* eslint-disable no-nested-ternary */
+import './QueryBuilderSearchV2.styles.scss';
+
import { Typography } from 'antd';
import {
ArrowDown,
diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx
index d07ba7169c..b3d2b2537a 100644
--- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx
+++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx
@@ -319,7 +319,7 @@ function QueryBuilderSearchV2(
value: '',
}));
setCurrentState(DropdownState.OPERATOR);
- setSearchValue((parsedValue as BaseAutocompleteData)?.key);
+ setSearchValue(`${(parsedValue as BaseAutocompleteData)?.key} `);
}
} else if (currentState === DropdownState.OPERATOR) {
if (isEmpty(value) && currentFilterItem?.key?.key) {
@@ -360,7 +360,7 @@ function QueryBuilderSearchV2(
value: '',
}));
setCurrentState(DropdownState.ATTRIBUTE_VALUE);
- setSearchValue(`${currentFilterItem?.key?.key} ${value}`);
+ setSearchValue(`${currentFilterItem?.key?.key} ${value} `);
}
} else if (currentState === DropdownState.ATTRIBUTE_VALUE) {
const operatorType =
@@ -512,11 +512,6 @@ function QueryBuilderSearchV2(
// this useEffect takes care of tokenisation based on the search state
useEffect(() => {
- // if we are still fetching the suggestions then return as we won't know the type / data-type etc for the attribute key
- if (isFetchingSuggestions) {
- return;
- }
-
// if there is no search value reset to the default state
if (!searchValue) {
setCurrentFilterItem(undefined);
@@ -766,6 +761,7 @@ function QueryBuilderSearchV2(
suggestionsData?.payload?.attributes,
]);
+ // keep the query in sync with the selected tags in logs explorer page
useEffect(() => {
const filterTags: IBuilderQuery['filters'] = {
op: 'AND',
@@ -788,16 +784,14 @@ function QueryBuilderSearchV2(
if (!isEqual(query.filters, filterTags)) {
onChange(filterTags);
- setTags(
- filterTags.items.map((tag) => ({
- ...tag,
- op: getOperatorFromValue(tag.op),
- })) as ITag[],
- );
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tags]);
+ // keep the use effects pure!
+ // if the tags lacks the ID then the above use effect will add it to query
+ // and then the below use effect will take care of adding it to the tags.
+ // keep the tags in sycn with current query.
useEffect(() => {
// convert the query and tags to same format before comparison
if (!isEqual(getInitTags(query), tags)) {
diff --git a/frontend/src/pages/EditRules/EditRules.styles.scss b/frontend/src/pages/EditRules/EditRules.styles.scss
index a01a6e7ab7..c760d8bb42 100644
--- a/frontend/src/pages/EditRules/EditRules.styles.scss
+++ b/frontend/src/pages/EditRules/EditRules.styles.scss
@@ -11,20 +11,19 @@
.edit-rules-card {
width: 20rem;
padding: 1rem;
-}
-.content {
- font-style: normal;
- font-weight: 300;
- font-size: 18px;
- line-height: 20px;
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- margin: 0;
+ .content {
+ font-style: normal;
+ font-weight: 300;
+ font-size: 18px;
+ line-height: 20px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+ margin: 0;
+ }
}
-
.btn-container {
display: flex;
justify-content: center;