-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs UI / Metrics UI] New Platform migration server followups (#51615)…
… (#53320)
- Loading branch information
Showing
35 changed files
with
278 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
|
||
export * from './log_analysis'; | ||
export * from './metadata_api'; | ||
export * from './metrics_explorer'; |
96 changes: 96 additions & 0 deletions
96
x-pack/legacy/plugins/infra/common/http_api/metrics_explorer/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
|
||
export const METRIC_EXPLORER_AGGREGATIONS = [ | ||
'avg', | ||
'max', | ||
'min', | ||
'cardinality', | ||
'rate', | ||
'count', | ||
] as const; | ||
|
||
type MetricExplorerAggregations = typeof METRIC_EXPLORER_AGGREGATIONS[number]; | ||
|
||
const metricsExplorerAggregationKeys = METRIC_EXPLORER_AGGREGATIONS.reduce< | ||
Record<MetricExplorerAggregations, null> | ||
>((acc, agg) => ({ ...acc, [agg]: null }), {} as Record<MetricExplorerAggregations, null>); | ||
|
||
export const metricsExplorerAggregationRT = rt.keyof(metricsExplorerAggregationKeys); | ||
|
||
export const metricsExplorerMetricRequiredFieldsRT = rt.type({ | ||
aggregation: metricsExplorerAggregationRT, | ||
}); | ||
|
||
export const metricsExplorerMetricOptionalFieldsRT = rt.partial({ | ||
field: rt.union([rt.string, rt.undefined]), | ||
}); | ||
|
||
export const metricsExplorerMetricRT = rt.intersection([ | ||
metricsExplorerMetricRequiredFieldsRT, | ||
metricsExplorerMetricOptionalFieldsRT, | ||
]); | ||
|
||
export const timeRangeRT = rt.type({ | ||
field: rt.string, | ||
from: rt.number, | ||
to: rt.number, | ||
interval: rt.string, | ||
}); | ||
|
||
export const metricsExplorerRequestBodyRequiredFieldsRT = rt.type({ | ||
timerange: timeRangeRT, | ||
indexPattern: rt.string, | ||
metrics: rt.array(metricsExplorerMetricRT), | ||
}); | ||
|
||
export const metricsExplorerRequestBodyOptionalFieldsRT = rt.partial({ | ||
groupBy: rt.union([rt.string, rt.null, rt.undefined]), | ||
afterKey: rt.union([rt.string, rt.null, rt.undefined]), | ||
limit: rt.union([rt.number, rt.null, rt.undefined]), | ||
filterQuery: rt.union([rt.string, rt.null, rt.undefined]), | ||
}); | ||
|
||
export const metricsExplorerRequestBodyRT = rt.intersection([ | ||
metricsExplorerRequestBodyRequiredFieldsRT, | ||
metricsExplorerRequestBodyOptionalFieldsRT, | ||
]); | ||
|
||
export const metricsExplorerPageInfoRT = rt.type({ | ||
total: rt.number, | ||
afterKey: rt.union([rt.string, rt.null]), | ||
}); | ||
|
||
export const metricsExplorerColumnTypeRT = rt.keyof({ | ||
date: null, | ||
number: null, | ||
string: null, | ||
}); | ||
|
||
export const metricsExplorerColumnRT = rt.type({ | ||
name: rt.string, | ||
type: metricsExplorerColumnTypeRT, | ||
}); | ||
|
||
export const metricsExplorerRowRT = rt.intersection([ | ||
rt.type({ | ||
timestamp: rt.number, | ||
}), | ||
rt.record(rt.string, rt.union([rt.string, rt.number, rt.null, rt.undefined])), | ||
]); | ||
|
||
export const metricsExplorerSeriesRT = rt.type({ | ||
id: rt.string, | ||
columns: rt.array(metricsExplorerColumnRT), | ||
rows: rt.array(metricsExplorerRowRT), | ||
}); | ||
|
||
export const metricsExplorerResponseRT = rt.type({ | ||
series: rt.array(metricsExplorerSeriesRT), | ||
pageInfo: metricsExplorerPageInfoRT, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.