fix(viz): deduce metric name if empty (#16194)

* fix(viz): deduce metric name if empty

* fix unit test
This commit is contained in:
Ville Brofeldt
2021-08-12 11:16:05 +03:00
committed by GitHub
parent 7de54d016e
commit b61c34f7c9
6 changed files with 177 additions and 15 deletions

View File

@@ -177,7 +177,7 @@ class QueryObject:
# 2. { label: 'label_name' } - legacy format for a predefined metric
# 3. { expressionType: 'SIMPLE' | 'SQL', ... } - adhoc metric
self.metrics = metrics and [
x if isinstance(x, str) or is_adhoc_metric(x) else x["label"]
x if isinstance(x, str) or is_adhoc_metric(x) else x["label"] # type: ignore
for x in metrics
]