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: added fix for free text with quick filter issue (#9768)

Abhi kumar1ccb9bb4c27c
diff --git a/frontend/src/components/QueryBuilderV2/utils.ts b/frontend/src/components/QueryBuilderV2/utils.ts
index d9e3150aa5..581761b5dd 100644
--- a/frontend/src/components/QueryBuilderV2/utils.ts
+++ b/frontend/src/components/QueryBuilderV2/utils.ts
@@ -163,6 +163,10 @@ function formatSingleValueForFilter(
if (trimmed === 'true' || trimmed === 'false') {
return trimmed === 'true';
}
+
+ if (isQuoted(value)) {
+ return unquote(value);
+ }
}
// Return non-string values as-is, or string values that couldn't be converted
diff --git a/frontend/src/utils/__tests__/queryContextUtils.test.ts b/frontend/src/utils/__tests__/queryContextUtils.test.ts
index 2cea3edcb1..d0a69d94e3 100644
--- a/frontend/src/utils/__tests__/queryContextUtils.test.ts
+++ b/frontend/src/utils/__tests__/queryContextUtils.test.ts
@@ -61,6 +61,58 @@ describe('extractQueryPairs', () => {
]);
});
+ test('should test for filter expression with freeText', () => {
+ const input = "disconnected deployment.env not in ['mq-kafka']";
+ const result = extractQueryPairs(input);
+ expect(result).toEqual([
+ {
+ key: 'disconnected',
+ operator: '',
+ valueList: [],
+ valuesPosition: [],
+ hasNegation: false,
+ isMultiValue: false,
+ value: undefined,
+ position: {
+ keyStart: 0,
+ keyEnd: 11,
+ operatorStart: 0,
+ operatorEnd: 0,
+ negationStart: 0,
+ negationEnd: 0,
+ valueStart: undefined,
+ valueEnd: undefined,
+ },
+ isComplete: false,
+ },
+ {
+ key: 'deployment.env',
+ operator: 'in',
+ value: "['mq-kafka']",
+ valueList: ["'mq-kafka'"],
+ valuesPosition: [
+ {
+ start: 36,
+ end: 45,
+ },
+ ],
+ hasNegation: true,
+ isMultiValue: true,
+ position: {
+ keyStart: 13,
+ keyEnd: 26,
+ operatorStart: 32,
+ operatorEnd: 33,
+ valueStart: 35,
+ valueEnd: 46,
+ negationStart: 28,
+ negationEnd: 30,
+ },
+ isComplete: true,
+ },
+ ]);
+ });
+
test('should extract IN with numeric list inside parentheses', () => {
const input = 'id IN (1, 2, 3)';
const result = extractQueryPairs(input);
diff --git a/frontend/src/utils/queryContextUtils.ts b/frontend/src/utils/queryContextUtils.ts
index afc2fa400b..d337f75eac 100644
--- a/frontend/src/utils/queryContextUtils.ts
+++ b/frontend/src/utils/queryContextUtils.ts
@@ -1339,8 +1339,7 @@ export function extractQueryPairs(query: string): IQueryPair[] {
else if (
currentPair &&
currentPair.key &&
- (isConjunctionToken(token.type) ||
- (token.type === FilterQueryLexer.KEY && isQueryPairComplete(currentPair)))
+ (isConjunctionToken(token.type) || token.type === FilterQueryLexer.KEY)
) {
queryPairs.push({
key: currentPair.key,