Skip to content

Commit

Permalink
fix: labels and annotations merged only from the first alert (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
andriimaryskevych authored May 9, 2022
1 parent 8c2cdc3 commit a49e90e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,8 @@ export class AlertmanagerDataSource extends DataSourceApi<CustomQuery, GenericOp
const fields = [{ name: 'Time', type: FieldType.time }];

if (data.length > 0) {
const annotations: string[] = data
.map((alert: any) => Object.keys(alert.annotations))
.reduce((data: string[][]) => data.flat());
const labels: string[] = data
.map((alert: any) => Object.keys(alert.labels))
.reduce((data: string[][]) => data.flat());
const annotations: string[] = data.map((alert: any) => Object.keys(alert.annotations)).flat();
const labels: string[] = data.map((alert: any) => Object.keys(alert.labels)).flat();
const alertstatus: string[] = ['alertstatus', 'alertstatus_code'];
const attributes: string[] = [...new Set([...annotations, ...labels, ...alertstatus])];

Expand Down

0 comments on commit a49e90e

Please sign in to comment.