mirror of
https://github.com/grafana/grafana.git
synced 2024-12-26 00:41:20 -06:00
Alerting: Make query wrapper match up datasource UIDs if necessary (#93057)
This commit is contained in:
parent
3fde6bd730
commit
ef486133c2
@ -15,6 +15,7 @@ import {
|
||||
} from '@grafana/data';
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
import { GraphThresholdsStyleMode, Icon, InlineField, Input, Tooltip, useStyles2, Stack } from '@grafana/ui';
|
||||
import { logInfo } from 'app/features/alerting/unified/Analytics';
|
||||
import { QueryEditorRow } from 'app/features/query/components/QueryEditorRow';
|
||||
import { AlertDataQuery, AlertQuery } from 'app/types/unified-alerting-dto';
|
||||
|
||||
@ -82,6 +83,19 @@ export const QueryWrapper = ({
|
||||
...cloneDeep(query.model),
|
||||
};
|
||||
|
||||
if (queryWithDefaults.datasource && queryWithDefaults.datasource?.uid !== query.datasourceUid) {
|
||||
logInfo('rule query datasource and datasourceUid mismatch', {
|
||||
queryModelDatasourceUid: queryWithDefaults.datasource?.uid || '',
|
||||
queryDatasourceUid: query.datasourceUid,
|
||||
datasourceType: query.model.datasource?.type || 'unknown type',
|
||||
});
|
||||
// There are occasions when the rule query model datasource UID and the datasourceUid do not match
|
||||
// It's unclear as to why this happens, but we need better visibility on why this happens,
|
||||
// so we log when it does, and make the query model datasource UID match the datasource UID
|
||||
// We already elsewhere work under the assumption that the datasource settings are fetched from the datasourceUid property
|
||||
queryWithDefaults.datasource.uid = query.datasourceUid;
|
||||
}
|
||||
|
||||
function SelectingDataSourceTooltip() {
|
||||
const styles = useStyles2(getStyles);
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user