From 1cea0299acc641b8bd90cfc9812caffa61853a9a Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Mon, 14 Nov 2022 12:31:22 -0700 Subject: [PATCH] [Metrics UI] Use bucketSize from request options for overview query (#145032) ## Summary This PR fixes #145030 by using the `options.bucketSize` in the `date_histogram` for the Overview query. --- .../infra/server/routes/overview/lib/create_top_nodes_query.ts | 2 +- .../api_integration/apis/metrics_ui/metrics_overview_top.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/infra/server/routes/overview/lib/create_top_nodes_query.ts b/x-pack/plugins/infra/server/routes/overview/lib/create_top_nodes_query.ts index 20bf2324c29d1..1419971db175b 100644 --- a/x-pack/plugins/infra/server/routes/overview/lib/create_top_nodes_query.ts +++ b/x-pack/plugins/infra/server/routes/overview/lib/create_top_nodes_query.ts @@ -142,7 +142,7 @@ export const createTopNodesQuery = ( timeseries: { date_histogram: { field: '@timestamp', - fixed_interval: '1m', + fixed_interval: options.bucketSize, extended_bounds: { min: options.timerange.from, max: options.timerange.to, diff --git a/x-pack/test/api_integration/apis/metrics_ui/metrics_overview_top.ts b/x-pack/test/api_integration/apis/metrics_ui/metrics_overview_top.ts index b3b3f53d6d6c3..0d88e78841f8e 100644 --- a/x-pack/test/api_integration/apis/metrics_ui/metrics_overview_top.ts +++ b/x-pack/test/api_integration/apis/metrics_ui/metrics_overview_top.ts @@ -47,6 +47,7 @@ export default function ({ getService }: FtrProviderContext) { expect(series.length).to.be(1); expect(series[0].id).to.be('demo-stack-mysql-01'); + expect(series[0].timeseries[1].timestamp - series[0].timeseries[0].timestamp).to.be(300_000); }); }); }