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:
@@ -19,6 +19,7 @@ import {
|
|||||||
AdHocVariableFilter,
|
AdHocVariableFilter,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
|
|
||||||
|
import { reportInteraction } from '../analytics/utils';
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
import {
|
import {
|
||||||
BackendSrvRequest,
|
BackendSrvRequest,
|
||||||
@@ -355,8 +356,17 @@ class DataSourceWithBackend<
|
|||||||
headers: this.getRequestHeaders(),
|
headers: this.getRequestHeaders(),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then((v: FetchResponse) => v.data)
|
.then((v: FetchResponse<HealthCheckResult>) => v.data)
|
||||||
.catch((err) => err.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;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user