Browse Source

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

master
rozetko 6 years ago committed by GitHub
parent
commit
e868fb60d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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

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

@ -319,7 +319,7 @@ export class AnalyticController {
const ids = this.analyticUnits.map(analyticUnit => analyticUnit.id); const ids = this.analyticUnits.map(analyticUnit => analyticUnit.id);
await this._analyticService.runDetect(ids); await this._analyticService.runDetect(ids);
_.each(this.analyticUnits, analyticUnit => this._runStatusWaiter(analyticUnit)); this.fetchAnalyticUnitsStatuses();
} }
async runDetect(analyticUnitId: AnalyticUnitId, from?: number, to?: number) { async runDetect(analyticUnitId: AnalyticUnitId, from?: number, to?: number) {

21
src/panel/graph_panel/graph_ctrl.ts

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

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

@ -12,7 +12,7 @@
<div class="gf-form"> <div class="gf-form">
<div class="gf-form-button-row" ng-if="ctrl.analyticsController.serverStatus === false"> <div class="gf-form-button-row" ng-if="ctrl.analyticsController.serverStatus === false">
<h5>Hastic server at "{{ctrl.hasticDatasource.url}}" is not available</h5> <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> <i class="fa fa-plug"></i>
Reconnect to Hastic server Reconnect to Hastic server
</button> </button>

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

@ -251,7 +251,7 @@ export class AnalyticService {
} catch(error) { } catch(error) {
// xhrStatus may be one of: ('complete', 'error', 'timeout' or 'abort') // 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 // 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.displayConnectionErrorAlert();
this._isUp = false; this._isUp = false;
} else { } else {

Loading…
Cancel
Save