From b73f0c4f110b2ba667a7951e2c18d175f42ccba3 Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Wed, 20 Nov 2024 13:46:10 -0500 Subject: [PATCH] Add filter agg to healthy SLO agg to remove stale SLOs from doc_count. --- .../slo/server/services/get_slos_overview.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slos_overview.ts b/x-pack/plugins/observability_solution/slo/server/services/get_slos_overview.ts index 2c1ff46f57ef5..d9a43b776908c 100644 --- a/x-pack/plugins/observability_solution/slo/server/services/get_slos_overview.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/get_slos_overview.ts @@ -88,6 +88,17 @@ export class GetSLOsOverview { status: 'HEALTHY', }, }, + aggs: { + not_stale: { + filter: { + range: { + summaryUpdatedAt: { + gte: 'now-48h', + }, + }, + }, + }, + }, }, degrading: { filter: { @@ -133,7 +144,7 @@ export class GetSLOsOverview { return { violated: aggs?.violated.doc_count ?? 0, degrading: aggs?.degrading.doc_count ?? 0, - healthy: aggs?.healthy.doc_count ?? 0, + healthy: aggs?.healthy?.not_stale?.doc_count ?? 0, noData: aggs?.noData.doc_count ?? 0, stale: aggs?.stale.doc_count ?? 0, worst: {