mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
chore(slo): optional filter fields (#164630)
This commit is contained in:
parent
631d9c2bd6
commit
65573fc93e
6 changed files with 42 additions and 24 deletions
|
@ -46,13 +46,17 @@ const apmTransactionErrorRateIndicatorSchema = t.type({
|
|||
const kqlCustomIndicatorTypeSchema = t.literal('sli.kql.custom');
|
||||
const kqlCustomIndicatorSchema = t.type({
|
||||
type: kqlCustomIndicatorTypeSchema,
|
||||
params: t.type({
|
||||
index: t.string,
|
||||
filter: t.string,
|
||||
good: t.string,
|
||||
total: t.string,
|
||||
timestampField: t.string,
|
||||
}),
|
||||
params: t.intersection([
|
||||
t.type({
|
||||
index: t.string,
|
||||
good: t.string,
|
||||
total: t.string,
|
||||
timestampField: t.string,
|
||||
}),
|
||||
t.partial({
|
||||
filter: t.string,
|
||||
}),
|
||||
]),
|
||||
});
|
||||
|
||||
const metricCustomValidAggregations = t.keyof({
|
||||
|
@ -76,13 +80,17 @@ const metricCustomMetricDef = t.type({
|
|||
const metricCustomIndicatorTypeSchema = t.literal('sli.metric.custom');
|
||||
const metricCustomIndicatorSchema = t.type({
|
||||
type: metricCustomIndicatorTypeSchema,
|
||||
params: t.type({
|
||||
index: t.string,
|
||||
filter: t.string,
|
||||
good: metricCustomMetricDef,
|
||||
total: metricCustomMetricDef,
|
||||
timestampField: t.string,
|
||||
}),
|
||||
params: t.intersection([
|
||||
t.type({
|
||||
index: t.string,
|
||||
good: metricCustomMetricDef,
|
||||
total: metricCustomMetricDef,
|
||||
timestampField: t.string,
|
||||
}),
|
||||
t.partial({
|
||||
filter: t.string,
|
||||
}),
|
||||
]),
|
||||
});
|
||||
|
||||
const rangeHistogramMetricType = t.literal('range');
|
||||
|
@ -117,13 +125,17 @@ const histogramMetricDef = t.union([
|
|||
const histogramIndicatorTypeSchema = t.literal('sli.histogram.custom');
|
||||
const histogramIndicatorSchema = t.type({
|
||||
type: histogramIndicatorTypeSchema,
|
||||
params: t.type({
|
||||
index: t.string,
|
||||
timestampField: t.string,
|
||||
filter: t.string,
|
||||
good: histogramMetricDef,
|
||||
total: histogramMetricDef,
|
||||
}),
|
||||
params: t.intersection([
|
||||
t.type({
|
||||
index: t.string,
|
||||
timestampField: t.string,
|
||||
good: histogramMetricDef,
|
||||
total: histogramMetricDef,
|
||||
}),
|
||||
t.partial({
|
||||
filter: t.string,
|
||||
}),
|
||||
]),
|
||||
});
|
||||
|
||||
const indicatorDataSchema = t.type({
|
||||
|
|
|
@ -798,7 +798,9 @@
|
|||
"nullable": false,
|
||||
"required": [
|
||||
"index",
|
||||
"timestampField"
|
||||
"timestampField",
|
||||
"good",
|
||||
"total"
|
||||
],
|
||||
"properties": {
|
||||
"index": {
|
||||
|
|
|
@ -504,6 +504,8 @@ components:
|
|||
required:
|
||||
- index
|
||||
- timestampField
|
||||
- good
|
||||
- total
|
||||
properties:
|
||||
index:
|
||||
description: The index or index pattern to use
|
||||
|
|
|
@ -12,6 +12,8 @@ properties:
|
|||
required:
|
||||
- index
|
||||
- timestampField
|
||||
- good
|
||||
- total
|
||||
properties:
|
||||
index:
|
||||
description: The index or index pattern to use
|
||||
|
|
|
@ -316,7 +316,7 @@ export class GetPreviewData {
|
|||
}
|
||||
}
|
||||
|
||||
function getElastichsearchQueryOrThrow(kuery: string) {
|
||||
function getElastichsearchQueryOrThrow(kuery: string | undefined = '') {
|
||||
try {
|
||||
return toElasticsearchQuery(fromKueryExpression(kuery));
|
||||
} catch (err) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
|
||||
import { InvalidTransformError } from '../../../errors';
|
||||
|
||||
export function getElastichsearchQueryOrThrow(kuery: string) {
|
||||
export function getElastichsearchQueryOrThrow(kuery: string | undefined = '') {
|
||||
try {
|
||||
return toElasticsearchQuery(fromKueryExpression(kuery));
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue