Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 8448726

Browse files
sort series in Grafana response object before returning
1 parent fcc8808 commit 8448726

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

dist/datasource.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ var ApmDatasource = /** @class */ (function () {
207207
datapoints: metrics[metric]
208208
});
209209
});
210+
grafanaResponse.data.sort(function (a, b) { return +(a.target > b.target) || -(a.target < b.target); });
210211
};
211212
ApmDatasource.prototype.escapeQueryString = function (queryString) {
212213
return (queryString + '').replace(new RegExp('[|()]', 'g'), '\\$&');

src/datasource.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ export class ApmDatasource {
236236
datapoints: metrics[metric]
237237
});
238238
})
239+
240+
grafanaResponse.data.sort((a, b) => +(a.target > b.target) || -(a.target < b.target));
239241
}
240242

241243
private escapeQueryString(queryString) {

0 commit comments

Comments
 (0)