Browse Source

Missing detections on a bigger zoom #269 (#308)

master
rozetko 5 years ago committed by GitHub
parent
commit
e868fb60d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/panel/graph_panel/controllers/analytic_controller.ts
  2. 21
      src/panel/graph_panel/graph_ctrl.ts
  3. 2
      src/panel/graph_panel/partials/tab_analytics.html
  4. 2
      src/panel/graph_panel/services/analytic_service.ts

4
src/panel/graph_panel/controllers/analytic_controller.ts

@ -319,7 +319,7 @@ export class AnalyticController {
const ids = this.analyticUnits.map(analyticUnit => analyticUnit.id);
await this._analyticService.runDetect(ids);
_.each(this.analyticUnits, analyticUnit => this._runStatusWaiter(analyticUnit));
this.fetchAnalyticUnitsStatuses();
}
async runDetect(analyticUnitId: AnalyticUnitId, from?: number, to?: number) {
@ -617,7 +617,7 @@ export class AnalyticController {
}
analyticUnit.detectionSpans = data;
let isFinished = true;
for (let detection of data) {
for(let detection of data) {
if(detection.status === DetectionStatus.RUNNING) {
isFinished = false;
}

21
src/panel/graph_panel/graph_ctrl.ts

@ -272,12 +272,7 @@ class GraphCtrl extends MetricsPanelCtrl {
if(analyticUnit.status === '404') {
await this.analyticsController.removeAnalyticUnit(analyticUnit.id, true);
}
if(analyticUnit.status === 'READY') {
const { from, to } = this.rangeTimestamp;
await this.analyticsController.fetchSegments(analyticUnit, from, to);
}
this.render(this.seriesList);
this.$scope.$digest();
this.refresh();
});
appEvents.on('ds-request-response', data => {
@ -326,7 +321,6 @@ class GraphCtrl extends MetricsPanelCtrl {
}
this.analyticsController = new AnalyticController(this._grafanaUrl, this._panelId, this.panel, this.events, this.analyticService);
this.analyticsController.fetchAnalyticUnitsStatuses();
this._updatePanelInfo();
this.analyticsController.updateServerInfo();
@ -409,15 +403,12 @@ class GraphCtrl extends MetricsPanelCtrl {
}
if(this.analyticsController !== undefined) {
await this.analyticsController.fetchAnalyticUnitsSegments(from, to);
// TODO: make statuses and detection spans connected
this.analyticsController.fetchAnalyticUnitsStatuses();
this.analyticsController.stopAnalyticUnitsDetectionsFetching();
const loadTasks = [
// this.annotationsPromise,
this.analyticsController.fetchAnalyticUnitsSegments(from, to)
];
await Promise.all(loadTasks);
// this.annotations = results[0].annotations;
await this.analyticsController.fetchAnalyticUnitsDetections(
// TODO: re-run detection waiters if this._dataTimerange is changed
this.analyticsController.fetchAnalyticUnitsDetections(
this._dataTimerange.from,
this._dataTimerange.to
);

2
src/panel/graph_panel/partials/tab_analytics.html

@ -12,7 +12,7 @@
<div class="gf-form">
<div class="gf-form-button-row" ng-if="ctrl.analyticsController.serverStatus === false">
<h5>Hastic server at "{{ctrl.hasticDatasource.url}}" is not available</h5>
<button class="btn btn-inverse" ng-click="ctrl.runDatasourceConnectivityCheck()">
<button class="btn btn-inverse" ng-click="ctrl.onHasticDatasourceChange()">
<i class="fa fa-plug"></i>
Reconnect to Hastic server
</button>

2
src/panel/graph_panel/services/analytic_service.ts

@ -251,7 +251,7 @@ export class AnalyticService {
} catch(error) {
// xhrStatus may be one of: ('complete', 'error', 'timeout' or 'abort')
// See: https://github.com/angular/angular.js/blob/55075b840c9194b8524627a293d6166528b9a1c2/src/ng/http.js#L919-L920
if(error.xhrStatus !== 'complete') {
if(error.xhrStatus !== 'complete' || error.status === 502) {
this.displayConnectionErrorAlert();
this._isUp = false;
} else {

Loading…
Cancel
Save