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: query builder update legend on empty values (#1367)

Pranshu Chittora4ee92b7c55a0
diff --git a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/promQL/index.tsx b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/promQL/index.tsx
index 1d96297d04..4dee33c779 100644
--- a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/promQL/index.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/promQL/index.tsx
@@ -30,8 +30,8 @@ function PromQLQueryContainer({
}: IPromQLQueryHandleChange): void => {
const allQueries = queryData[WIDGET_PROMQL_QUERY_KEY_NAME];
const currentIndexQuery = allQueries[queryIndex];
- if (query) currentIndexQuery.query = query;
- if (legend) currentIndexQuery.legend = legend;
+ if (query !== undefined) currentIndexQuery.query = query;
+ if (legend !== undefined) currentIndexQuery.legend = legend;
if (toggleDisable) {
currentIndexQuery.disabled = !currentIndexQuery.disabled;
diff --git a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/queryBuilder/index.tsx b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/queryBuilder/index.tsx
index fd5d7f32ad..5b05eeca91 100644
--- a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/queryBuilder/index.tsx
+++ b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/queryBuilder/index.tsx
@@ -55,7 +55,7 @@ function QueryBuilderQueryContainer({
currentIndexQuery.aggregateOperator = aggregateFunction;
}
- if (metricName) {
+ if (metricName !== undefined) {
currentIndexQuery.metricName = metricName;
}