CloudMonitoring: Fixes broken variable queries that use group bys (#43914)

This commit is contained in:
Erik Sundell
2022-01-17 15:51:24 +01:00
committed by GitHub
parent 9fb8339f87
commit 715166baf3
5 changed files with 59 additions and 10 deletions

View File

@@ -61,15 +61,15 @@ function Editor({
variableOptionGroup,
}: React.PropsWithChildren<Props>) {
const [state, setState] = useState<State>(defaultState);
const { projectName, metricType, groupBys, editorMode } = query;
const { projectName, metricType, groupBys, editorMode, crossSeriesReducer } = query;
useEffect(() => {
if (projectName && metricType) {
datasource
.getLabels(metricType, refId, projectName, groupBys)
.getLabels(metricType, refId, projectName, { groupBys, crossSeriesReducer })
.then((labels) => setState((prevState) => ({ ...prevState, labels })));
}
}, [datasource, groupBys, metricType, projectName, refId]);
}, [datasource, groupBys, metricType, projectName, refId, crossSeriesReducer]);
const onChange = useCallback(
(metricQuery: MetricQuery | SLOQuery) => {