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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix(metrics): resolve any filter key context instead of erroring (#12188)
Tushar Vats967289ebc609
diff --git a/pkg/telemetrymetrics/condition_builder.go b/pkg/telemetrymetrics/condition_builder.goindex 2681b90568..4504107abd 100644--- a/pkg/telemetrymetrics/condition_builder.go+++ b/pkg/telemetrymetrics/condition_builder.go@@ -162,18 +162,28 @@ func (c *conditionBuilder) ConditionFor(return nil, nil, err}- keys, warning := querybuilder.ResolveKeys(key, querybuilder.MatchingFieldKeys(key, fieldKeys))+ keys := querybuilder.MatchingFieldKeys(key, fieldKeys)var warnings []string- if warning != "" {- warnings = append(warnings, warning)- }if len(keys) == 0 {- return nil, warnings, querybuilder.NewKeyNotFoundError(key.Name)+ if _, isColumn := timeSeriesV4Columns[key.Name]; isColumn {+ keys = []*telemetrytypes.TelemetryFieldKey{key}+ } else {+ if len(fieldKeys[key.Name]) == 0 {+ warnings = append(warnings, fmt.Sprintf("label `%s` not found in metadata; check the label name for typos", key.Name))+ }+ keys = []*telemetrytypes.TelemetryFieldKey{+ telemetrytypes.NewTelemetryFieldKey(key.Name, telemetrytypes.FieldContextAttribute, key.FieldDataType),+ }+ if key.FieldContext != telemetrytypes.FieldContextUnspecified {+ keys = append(keys, telemetrytypes.NewTelemetryFieldKey(+ key.FieldContext.StringValue()+"."+key.Name, telemetrytypes.FieldContextAttribute, key.FieldDataType))+ }+ }}conds := make([]string, 0, len(keys))for _, k := range keys {- cond, err := c.conditionForKey(ctx, orgID, startNs, endNs, k, operator, value, sb)+ cond, err := c.conditionFor(ctx, orgID, startNs, endNs, k, operator, value, sb)if err != nil {return nil, nil, err}@@ -181,21 +191,3 @@ func (c *conditionBuilder) ConditionFor(}return conds, warnings, nil}--func (c *conditionBuilder) conditionForKey(- ctx context.Context,- orgID valuer.UUID,- startNs uint64,- endNs uint64,- key *telemetrytypes.TelemetryFieldKey,- operator qbtypes.FilterOperator,- value any,- sb *sqlbuilder.SelectBuilder,-) (string, error) {- condition, err := c.conditionFor(ctx, orgID, startNs, endNs, key, operator, value, sb)- if err != nil {- return "", err- }-- return condition, nil-}diff --git a/pkg/telemetrymetrics/condition_builder_test.go b/pkg/telemetrymetrics/condition_builder_test.goindex 9cdad13dca..fb0104faeb 100644--- a/pkg/telemetrymetrics/condition_builder_test.go+++ b/pkg/telemetrymetrics/condition_builder_test.go@@ -307,3 +307,86 @@ func TestConditionForMultipleKeys(t *testing.T) {})}}++func TestConditionForKeyNotInMetadata(t *testing.T) {+ ctx := context.Background()++ testCases := []struct {+ name string+ key telemetrytypes.TelemetryFieldKey+ fieldKeys map[string][]*telemetrytypes.TelemetryFieldKey+ operator qbtypes.FilterOperator+ value any+ expectedSQL []string+ expectWarn bool+ }{+ {+ name: "intrinsic metric_name full-text resolves without warning",+ key: telemetrytypes.TelemetryFieldKey{Name: "metric_name", FieldContext: telemetrytypes.FieldContextMetric},+ fieldKeys: map[string][]*telemetrytypes.TelemetryFieldKey{},+ operator: qbtypes.FilterOperatorRegexp,+ value: "k8s",+ expectedSQL: []string{"match(metric_name, ?)"},+ expectWarn: false,+ },+ {+ name: "unknown label resolves to labels extract with a typo warning",+ key: telemetrytypes.TelemetryFieldKey{Name: "foo", FieldContext: telemetrytypes.FieldContextUnspecified},+ fieldKeys: map[string][]*telemetrytypes.TelemetryFieldKey{},+ operator: qbtypes.FilterOperatorEqual,+ value: "bar",+ expectedSQL: []string{"JSONExtractString(labels, 'foo') = ?"},+ expectWarn: true,+ },+ {+ name: "context prefix that may be part of the name tries both readings",+ key: telemetrytypes.TelemetryFieldKey{Name: "a.b.c", FieldContext: telemetrytypes.FieldContextScope},+ fieldKeys: map[string][]*telemetrytypes.TelemetryFieldKey{},+ operator: qbtypes.FilterOperatorEqual,+ value: "x",+ expectedSQL: []string{"JSONExtractString(labels, 'a.b.c') = ?", "JSONExtractString(labels, 'scope.a.b.c') = ?"},+ expectWarn: true,+ },+ {+ name: "unresolved metric-context name is treated as a label prefix",+ key: telemetrytypes.TelemetryFieldKey{Name: "foo", FieldContext: telemetrytypes.FieldContextMetric},+ fieldKeys: map[string][]*telemetrytypes.TelemetryFieldKey{},+ operator: qbtypes.FilterOperatorEqual,+ value: "bar",+ expectedSQL: []string{"JSONExtractString(labels, 'foo') = ?", "JSONExtractString(labels, 'metric.foo') = ?"},+ expectWarn: true,+ },+ {+ name: "known label under a mismatched context collapses without warning",+ key: telemetrytypes.TelemetryFieldKey{Name: "region", FieldContext: telemetrytypes.FieldContextResource},+ fieldKeys: map[string][]*telemetrytypes.TelemetryFieldKey{+ "region": {{Name: "region", FieldContext: telemetrytypes.FieldContextAttribute, FieldDataType: telemetrytypes.FieldDataTypeString}},+ },+ operator: qbtypes.FilterOperatorEqual,+ value: "us",+ expectedSQL: []string{"JSONExtractString(labels, 'region') = ?"},+ expectWarn: false,+ },+ }++ fm := NewFieldMapper()+ conditionBuilder := NewConditionBuilder(fm)++ for _, tc := range testCases {+ t.Run(tc.name, func(t *testing.T) {+ sb := sqlbuilder.NewSelectBuilder()+ cond, warnings, err := conditionBuilder.ConditionFor(ctx, valuer.UUID{}, 0, 0, &tc.key, tc.fieldKeys, qbtypes.ConditionBuilderOptions{}, tc.operator, tc.value, sb)+ require.NoError(t, err)+ sb.Where(cond...)+ sql, _ := sb.BuildWithFlavor(sqlbuilder.ClickHouse)+ for _, want := range tc.expectedSQL {+ assert.Contains(t, sql, want)+ }+ if tc.expectWarn {+ assert.NotEmpty(t, warnings)+ } else {+ assert.Empty(t, warnings)+ }+ })+ }+}diff --git a/tests/integration/tests/inframonitoring/01_hosts.py b/tests/integration/tests/inframonitoring/01_hosts.pyindex 3e5ee0f1e7..014355fb0b 100644--- a/tests/integration/tests/inframonitoring/01_hosts.py+++ b/tests/integration/tests/inframonitoring/01_hosts.py@@ -200,6 +200,7 @@ def test_hosts_warnings({"prod-linux-1", "dev-linux-1"},id="in_contains",),+ pytest.param("host.namee = 'prod-linux-1'", set(), id="unresolved_key"),],)def test_hosts_filter(@@ -257,7 +258,6 @@ def test_hosts_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("host.namee = 'prod-linux-1'", "host.namee", id="bad_attr_name"),pytest.param("host.name =", None, id="trailing_op"),pytest.param("(host.name = 'prod-linux-1'", None, id="unclosed_paren"),# Cases dropped — parser is permissive and accepts these silently:@@ -274,8 +274,8 @@ def test_hosts_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/02_pods.py b/tests/integration/tests/inframonitoring/02_pods.pyindex 62f499a72c..e8969be02d 100644--- a/tests/integration/tests/inframonitoring/02_pods.py+++ b/tests/integration/tests/inframonitoring/02_pods.py@@ -290,6 +290,7 @@ def test_pods_warnings({"web-prod-1", "web-dev-1"},id="in_contains",),+ pytest.param("k8s.pod.namee = 'web-prod-1'", set(), id="unresolved_key"),],)def test_pods_filter(@@ -348,7 +349,6 @@ def test_pods_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.pod.namee = 'web-prod-1'", "k8s.pod.namee", id="bad_attr_name"),pytest.param("k8s.pod.name =", None, id="trailing_op"),pytest.param("(k8s.pod.name = 'web-prod-1'", None, id="unclosed_paren"),],@@ -361,8 +361,8 @@ def test_pods_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(_load_pods_metrics(diff --git a/tests/integration/tests/inframonitoring/03_nodes.py b/tests/integration/tests/inframonitoring/03_nodes.pyindex 79db5d29e2..ee28c09ab0 100644--- a/tests/integration/tests/inframonitoring/03_nodes.py+++ b/tests/integration/tests/inframonitoring/03_nodes.py@@ -216,6 +216,7 @@ def test_nodes_warnings({"web-a-us-1", "web-b-us-1"},id="in_contains",),+ pytest.param("k8s.node.namee = 'web-a-us-1'", set(), id="unresolved_key"),],)def test_nodes_filter(@@ -272,7 +273,6 @@ def test_nodes_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.node.namee = 'web-a-us-1'", "k8s.node.namee", id="bad_attr_name"),pytest.param("k8s.node.name =", None, id="trailing_op"),pytest.param("(k8s.node.name = 'web-a-us-1'", None, id="unclosed_paren"),],@@ -285,8 +285,8 @@ def test_nodes_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/04_namespaces.py b/tests/integration/tests/inframonitoring/04_namespaces.pyindex 733fcd7030..26d889bb9c 100644--- a/tests/integration/tests/inframonitoring/04_namespaces.py+++ b/tests/integration/tests/inframonitoring/04_namespaces.py@@ -215,6 +215,7 @@ def test_namespaces_warnings({"web-a-prod", "web-b-prod"},id="in_contains",),+ pytest.param("k8s.namespace.namee = 'web-a-prod'", set(), id="unresolved_key"),],)def test_namespaces_filter(@@ -270,7 +271,6 @@ def test_namespaces_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.namespace.namee = 'web-a-prod'", "k8s.namespace.namee", id="bad_attr_name"),pytest.param("k8s.namespace.name =", None, id="trailing_op"),pytest.param("(k8s.namespace.name = 'web-a-prod'", None, id="unclosed_paren"),],@@ -283,8 +283,8 @@ def test_namespaces_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/05_clusters.py b/tests/integration/tests/inframonitoring/05_clusters.pyindex 13f1ef1912..a4687b58b4 100644--- a/tests/integration/tests/inframonitoring/05_clusters.py+++ b/tests/integration/tests/inframonitoring/05_clusters.py@@ -233,6 +233,7 @@ def test_clusters_warnings({"web-gcp-prod", "web-aws-prod"},id="in_contains",),+ pytest.param("k8s.cluster.namee = 'web-gcp-prod'", set(), id="unresolved_key"),],)def test_clusters_filter(@@ -290,7 +291,6 @@ def test_clusters_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.cluster.namee = 'web-gcp-prod'", "k8s.cluster.namee", id="bad_attr_name"),pytest.param("k8s.cluster.name =", None, id="trailing_op"),pytest.param("(k8s.cluster.name = 'web-gcp-prod'", None, id="unclosed_paren"),],@@ -303,8 +303,8 @@ def test_clusters_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/06_volumes.py b/tests/integration/tests/inframonitoring/06_volumes.pyindex eb865161d5..6728054b95 100644--- a/tests/integration/tests/inframonitoring/06_volumes.py+++ b/tests/integration/tests/inframonitoring/06_volumes.py@@ -231,6 +231,7 @@ def test_volumes_warnings({"data-ns-a-prod", "data-ns-b-prod"},id="in_contains",),+ pytest.param("k8s.persistentvolumeclaim.namee = 'data-ns-a-prod'", set(), id="unresolved_key"),],)def test_volumes_filter(@@ -289,11 +290,6 @@ def test_volumes_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param(- "k8s.persistentvolumeclaim.namee = 'data-ns-a-prod'",- "k8s.persistentvolumeclaim.namee",- id="bad_attr_name",- ),pytest.param("k8s.persistentvolumeclaim.name =", None, id="trailing_op"),pytest.param("(k8s.persistentvolumeclaim.name = 'data-ns-a-prod'", None, id="unclosed_paren"),],@@ -306,8 +302,8 @@ def test_volumes_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/07_deployments.py b/tests/integration/tests/inframonitoring/07_deployments.pyindex 2eb3ba6117..c3c334d498 100644--- a/tests/integration/tests/inframonitoring/07_deployments.py+++ b/tests/integration/tests/inframonitoring/07_deployments.py@@ -242,6 +242,7 @@ def test_deployments_warnings({"web-a-prod", "web-b-prod"},id="in_contains",),+ pytest.param("k8s.deployment.namee = 'web-a-prod'", set(), id="unresolved_key"),],)def test_deployments_filter(@@ -301,7 +302,6 @@ def test_deployments_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.deployment.namee = 'web-a-prod'", "k8s.deployment.namee", id="bad_attr_name"),pytest.param("k8s.deployment.name =", None, id="trailing_op"),pytest.param("(k8s.deployment.name = 'web-a-prod'", None, id="unclosed_paren"),],@@ -314,8 +314,8 @@ def test_deployments_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/08_statefulsets.py b/tests/integration/tests/inframonitoring/08_statefulsets.pyindex 302944b430..b12bee32f9 100644--- a/tests/integration/tests/inframonitoring/08_statefulsets.py+++ b/tests/integration/tests/inframonitoring/08_statefulsets.py@@ -156,6 +156,7 @@ def test_statefulsets_accuracy({"web-a-prod", "web-b-prod"},id="in_contains",),+ pytest.param("k8s.statefulset.namee = 'web-a-prod'", set(), id="unresolved_key"),],)def test_statefulsets_filter(@@ -215,7 +216,6 @@ def test_statefulsets_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.statefulset.namee = 'web-a-prod'", "k8s.statefulset.namee", id="bad_attr_name"),pytest.param("k8s.statefulset.name =", None, id="trailing_op"),pytest.param("(k8s.statefulset.name = 'web-a-prod'", None, id="unclosed_paren"),],@@ -228,8 +228,8 @@ def test_statefulsets_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/09_jobs.py b/tests/integration/tests/inframonitoring/09_jobs.pyindex 4c8a88084e..ca5de142b3 100644--- a/tests/integration/tests/inframonitoring/09_jobs.py+++ b/tests/integration/tests/inframonitoring/09_jobs.py@@ -246,6 +246,7 @@ def test_jobs_warnings({"etl-a-prod", "etl-b-prod"},id="in_contains",),+ pytest.param("k8s.job.namee = 'etl-a-prod'", set(), id="unresolved_key"),],)def test_jobs_filter(@@ -304,7 +305,6 @@ def test_jobs_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.job.namee = 'etl-a-prod'", "k8s.job.namee", id="bad_attr_name"),pytest.param("k8s.job.name =", None, id="trailing_op"),pytest.param("(k8s.job.name = 'etl-a-prod'", None, id="unclosed_paren"),],@@ -317,8 +317,8 @@ def test_jobs_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/inframonitoring/10_daemonsets.py b/tests/integration/tests/inframonitoring/10_daemonsets.pyindex 4feda45e35..94cb04c3d7 100644--- a/tests/integration/tests/inframonitoring/10_daemonsets.py+++ b/tests/integration/tests/inframonitoring/10_daemonsets.py@@ -162,6 +162,7 @@ def test_daemonsets_accuracy({"logs-a-prod", "logs-b-prod"},id="in_contains",),+ pytest.param("k8s.daemonset.namee = 'logs-a-prod'", set(), id="unresolved_key"),],)def test_daemonsets_filter(@@ -221,7 +222,6 @@ def test_daemonsets_filter(@pytest.mark.parametrize("expression,err_substr",[- pytest.param("k8s.daemonset.namee = 'logs-a-prod'", "k8s.daemonset.namee", id="bad_attr_name"),pytest.param("k8s.daemonset.name =", None, id="trailing_op"),pytest.param("(k8s.daemonset.name = 'logs-a-prod'", None, id="unclosed_paren"),],@@ -234,8 +234,8 @@ def test_daemonsets_filter_invalid(expression: str,err_substr,) -> None:- """Invalid filter expressions (typo'd attribute key, malformed grammar) return- 400 invalid_input with structured errors; bad attribute keys are named in them."""+ """Malformed filter grammar (trailing operator, unclosed paren) returns+ 400 invalid_input with structured errors."""now = datetime.now(tz=UTC).replace(microsecond=0)insert_metrics(Metrics.load_from_file(diff --git a/tests/integration/tests/queriermetrics/10_key_resolution.py b/tests/integration/tests/queriermetrics/10_key_resolution.pyindex db7f24f5e8..9a6dbbd4fc 100644--- a/tests/integration/tests/queriermetrics/10_key_resolution.py+++ b/tests/integration/tests/queriermetrics/10_key_resolution.py@@ -66,9 +66,9 @@ def test_metrics_filter_label_context(get_token: Callable[[str, str], str],insert_metrics: Callable[[list[Metrics]], None],) -> None:- """Unlike group-by (which collapses every context to labels), a label *filter* resolves via- metadata under the label's registered (attribute) context: bare `region` and `attribute.region`- are equivalent, but an explicit mismatched context (`resource.region`) is not found (400)."""+ """Metrics has no per-context storage: every label lives in the `labels` JSON, so a label+ *filter* collapses every context to JSONExtractString(labels,'region') just like group-by does.+ bare `region`, `attribute.region`, and `resource.region` are all equivalent and select `us`."""now = datetime.now(tz=UTC).replace(second=0, microsecond=0)insert_metrics([@@ -106,7 +106,8 @@ def test_metrics_filter_label_context(data = {row[0]: row[-1] for row in querier.get_scalar_table_data(response.json())}assert data == {"us": 30.0}, f"{expr}: {data}"- # resource. is a context the label is not registered under -> hard "not found".+ # resource. is a context the label is not registered under; metrics collapses it to the+ # same labels lookup, so it resolves rather than erroring.response = querier.make_scalar_query_request(signoz,token,@@ -120,7 +121,7 @@ def test_metrics_filter_label_context()],)- assert response.status_code == HTTPStatus.BAD_REQUEST, response.text+ assert response.status_code == HTTPStatus.OK, response.textdef test_metrics_group_by_unknown_label(@@ -208,3 +209,50 @@ def test_metrics_filter_unknown_label_matches_nothing(assert response.status_code == HTTPStatus.OK, response.textassert querier.get_scalar_table_data(response.json()) == []assert querier.get_all_warnings(response.json()) == []+++def test_metrics_full_text_filter_does_not_error(+ signoz: types.SigNoz,+ create_user_admin: None, # pylint: disable=unused-argument+ get_token: Callable[[str, str], str],+ insert_metrics: Callable[[list[Metrics]], None],+) -> None:+ """A bare/quoted term has no key=value form, so the visitor routes it through the metrics+ full-text search column, which is never present in the metadata keys. The condition builder+ must resolve it (not hard-error) so the query runs. Regression: a partial filter like `abc`+ used to 400 with `key <full-text-column> not found` (broke the Metrics Explorer summary)."""+ now = datetime.now(tz=UTC).replace(second=0, microsecond=0)+ insert_metrics(+ [+ Metrics(+ metric_name=METRIC,+ labels={"region": "us"},+ timestamp=now - timedelta(seconds=1),+ temporality="Unspecified",+ type_="Gauge",+ is_monotonic=False,+ value=30.0,+ )+ ]+ )+ token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)++ # bare word and quoted term are both full-text searches; neither may 400.+ for expr in ("abc", '"abc"'):+ response = querier.make_scalar_query_request(+ signoz,+ token,+ now,+ [+ querier.build_scalar_query(+ name="A",+ signal="metrics",+ aggregations=[querier.build_metrics_aggregation(METRIC, "latest", "sum", "unspecified")],+ filter_expression=expr,+ )+ ],+ )+ assert response.status_code == HTTPStatus.OK, f"{expr}: {response.text}"+ # the term matches no series, and metrics emits no key-not-found warning.+ assert querier.get_scalar_table_data(response.json()) == [], f"{expr}: {response.json()}"+ assert querier.get_all_warnings(response.json()) == [], f"{expr}: {querier.get_all_warnings(response.json())}"