Skip to content

Commit

Permalink
[Metrics UI] Make composite size configurable to avoid max buckets (#…
Browse files Browse the repository at this point in the history
…72955) (#73537)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
simianhacker and elasticmachine committed Jul 28, 2020
1 parent fcbbbf5 commit 34fee44
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/infra/common/http_api/snapshot_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const SnapshotRequestRT = rt.intersection([
region: rt.string,
filterQuery: rt.union([rt.string, rt.null]),
includeTimeseries: rt.boolean,
overrideCompositeSize: rt.number,
}),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('Metrics UI Observability Homepage Functions', () => {
groupBy: [],
nodeType: 'host',
includeTimeseries: true,
overrideCompositeSize: 5,
timerange: {
from: startTime.valueOf(),
to: endTime.valueOf(),
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/infra/public/metrics_overview_fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const createMetricsFetchData = (
groupBy: [],
nodeType: 'host',
includeTimeseries: true,
overrideCompositeSize: 5,
timerange: {
from: start,
to: end,
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/infra/server/lib/snapshot/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const requestGroupedNodes = async (
aggregations: {
nodes: {
composite: {
size: SNAPSHOT_COMPOSITE_REQUEST_SIZE,
size: options.overrideCompositeSize || SNAPSHOT_COMPOSITE_REQUEST_SIZE,
sources: getGroupedNodesSources(options),
},
aggs: {
Expand Down Expand Up @@ -142,7 +142,7 @@ const requestNodeMetrics = async (
aggregations: {
nodes: {
composite: {
size: SNAPSHOT_COMPOSITE_REQUEST_SIZE,
size: options.overrideCompositeSize || SNAPSHOT_COMPOSITE_REQUEST_SIZE,
sources: getMetricsSources(options),
},
aggregations: {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/infra/server/routes/snapshot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const initSnapshotRoute = (libs: InfraBackendLibs) => {
accountId,
region,
includeTimeseries,
overrideCompositeSize,
} = pipe(
SnapshotRequestRT.decode(request.body),
fold(throwErrors(Boom.badRequest), identity)
Expand All @@ -59,6 +60,7 @@ export const initSnapshotRoute = (libs: InfraBackendLibs) => {
metrics,
timerange,
includeTimeseries,
overrideCompositeSize,
};

const searchES = <Hit = {}, Aggregation = undefined>(
Expand Down

0 comments on commit 34fee44

Please sign in to comment.