CloudMonitoring: Ensure variables can be used in all variable queries (#86377)

* Allow specifying project when querying services

* Ensure metricType is interpolated
This commit is contained in:
Andreas Christou
2024-04-19 20:52:39 +01:00
committed by GitHub
parent d6e84dbf0a
commit d8a8db3750
2 changed files with 3 additions and 2 deletions

View File

@ -160,7 +160,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
async onMetricTypeChange(metricType: string) {
const state = {
selectedMetricType: metricType,
...(await this.getLabels(metricType, this.state.projectName)),
...(await this.getLabels(getTemplateSrv().replace(metricType), this.state.projectName)),
};
this.setState(state, () => this.onPropsChange());
}
@ -278,6 +278,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
/>
</>
);
case MetricFindQueryTypes.Services:
case MetricFindQueryTypes.SLOServices:
return (
<>

View File

@ -108,7 +108,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
crossSeriesReducer: aggregation?.crossSeriesReducer ?? 'REDUCE_NONE',
view: 'HEADERS',
},
metricType
this.templateSrv.replace(metricType)
),
},
],