mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Correlations: Add error logging (#78272)
* Add error logging when parsing correlations * Make orgId optional * Add module property and move source and target to context for better readability
This commit is contained in:
parent
58d0c51cf4
commit
b64802ed3b
@ -42,6 +42,7 @@ export interface Correlation {
|
|||||||
label?: string;
|
label?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
provisioned: boolean;
|
provisioned: boolean;
|
||||||
|
orgId?: number;
|
||||||
config: CorrelationConfig;
|
config: CorrelationConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { useAsyncFn } from 'react-use';
|
|||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
|
|
||||||
import { DataSourceInstanceSettings } from '@grafana/data';
|
import { DataSourceInstanceSettings } from '@grafana/data';
|
||||||
import { getDataSourceSrv, FetchResponse } from '@grafana/runtime';
|
import { getDataSourceSrv, FetchResponse, logWarning } from '@grafana/runtime';
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -43,6 +43,13 @@ const toEnrichedCorrelationData = ({
|
|||||||
const sourceDatasource = getDataSourceSrv().getInstanceSettings(sourceUID);
|
const sourceDatasource = getDataSourceSrv().getInstanceSettings(sourceUID);
|
||||||
const targetDatasource = getDataSourceSrv().getInstanceSettings(targetUID);
|
const targetDatasource = getDataSourceSrv().getInstanceSettings(targetUID);
|
||||||
|
|
||||||
|
// According to #72258 we will remove logic to handle orgId=0/null as global correlations.
|
||||||
|
// This logging is to check if there are any customers who did not migrate existing correlations.
|
||||||
|
// See Deprecation Notice in https://github.com/grafana/grafana/pull/72258 for more details
|
||||||
|
if (correlation?.orgId === undefined || correlation?.orgId === null || correlation?.orgId === 0) {
|
||||||
|
logWarning('Invalid correlation config: Missing org id.', { module: 'Explore' });
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
sourceDatasource &&
|
sourceDatasource &&
|
||||||
sourceDatasource?.uid !== undefined &&
|
sourceDatasource?.uid !== undefined &&
|
||||||
@ -55,6 +62,11 @@ const toEnrichedCorrelationData = ({
|
|||||||
target: targetDatasource,
|
target: targetDatasource,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
logWarning(`Invalid correlation config: Missing source or target.`, {
|
||||||
|
module: 'Explore',
|
||||||
|
source: JSON.stringify(sourceDatasource),
|
||||||
|
target: JSON.stringify(targetDatasource),
|
||||||
|
});
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user