mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datasources: Health check error tracking (#96629)
* datasource health check error tracking * type fix
This commit is contained in:
parent
89e7e25b60
commit
bd56b47bb5
@ -19,6 +19,7 @@ import {
|
||||
AdHocVariableFilter,
|
||||
} from '@grafana/data';
|
||||
|
||||
import { reportInteraction } from '../analytics/utils';
|
||||
import { config } from '../config';
|
||||
import {
|
||||
BackendSrvRequest,
|
||||
@ -355,8 +356,17 @@ class DataSourceWithBackend<
|
||||
headers: this.getRequestHeaders(),
|
||||
})
|
||||
)
|
||||
.then((v: FetchResponse) => v.data)
|
||||
.catch((err) => err.data);
|
||||
.then((v: FetchResponse<HealthCheckResult>) => v.data)
|
||||
.catch((err) => {
|
||||
let properties: Record<string, string> = {
|
||||
plugin_id: this.meta?.id || '',
|
||||
plugin_version: this.meta?.info?.version || '',
|
||||
datasource_healthcheck_status: err?.data?.status || 'error',
|
||||
datasource_healthcheck_message: err?.data?.message || '',
|
||||
};
|
||||
reportInteraction('datasource_health_check_completed', properties);
|
||||
return err.data;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user