mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
chore(slo): require customkql timestamp field (#154654)
This commit is contained in:
parent
a727ba183a
commit
450e19598e
8 changed files with 18 additions and 21 deletions
|
@ -50,17 +50,13 @@ const apmTransactionErrorRateIndicatorSchema = t.type({
|
|||
const kqlCustomIndicatorTypeSchema = t.literal('sli.kql.custom');
|
||||
const kqlCustomIndicatorSchema = t.type({
|
||||
type: kqlCustomIndicatorTypeSchema,
|
||||
params: t.intersection([
|
||||
t.type({
|
||||
index: t.string,
|
||||
filter: t.string,
|
||||
good: t.string,
|
||||
total: t.string,
|
||||
}),
|
||||
t.partial({
|
||||
timestampField: t.string,
|
||||
}),
|
||||
]),
|
||||
params: t.type({
|
||||
index: t.string,
|
||||
filter: t.string,
|
||||
good: t.string,
|
||||
total: t.string,
|
||||
timestampField: t.string,
|
||||
}),
|
||||
});
|
||||
|
||||
const indicatorDataSchema = t.type({
|
||||
|
|
|
@ -362,6 +362,7 @@ components:
|
|||
nullable: false
|
||||
required:
|
||||
- index
|
||||
- timestampField
|
||||
properties:
|
||||
index:
|
||||
description: The index or index pattern to use
|
||||
|
|
|
@ -11,6 +11,7 @@ properties:
|
|||
nullable: false
|
||||
required:
|
||||
- index
|
||||
- timestampField
|
||||
properties:
|
||||
index:
|
||||
description: The index or index pattern to use
|
||||
|
|
|
@ -51,6 +51,7 @@ export const buildCustomKqlIndicator = (
|
|||
good: 'latency < 300',
|
||||
total: 'latency > 0',
|
||||
filter: 'labels.eventId: event-0',
|
||||
timestampField: '@timestamp',
|
||||
...params,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -62,6 +62,7 @@ export const SLO_EDIT_FORM_DEFAULT_VALUES: CreateSLOInput = {
|
|||
filter: '',
|
||||
good: '',
|
||||
total: '',
|
||||
timestampField: '',
|
||||
},
|
||||
},
|
||||
timeWindow: {
|
||||
|
|
|
@ -64,6 +64,7 @@ export const createKQLCustomIndicator = (
|
|||
filter: 'labels.groupId: group-3',
|
||||
good: 'latency < 300',
|
||||
total: '',
|
||||
timestampField: 'log_timestamp',
|
||||
...params,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -147,7 +147,7 @@ Object {
|
|||
"group_by": Object {
|
||||
"@timestamp": Object {
|
||||
"date_histogram": Object {
|
||||
"field": "@timestamp",
|
||||
"field": "log_timestamp",
|
||||
"fixed_interval": "2m",
|
||||
},
|
||||
},
|
||||
|
@ -198,7 +198,7 @@ Object {
|
|||
"sync": Object {
|
||||
"time": Object {
|
||||
"delay": "1m",
|
||||
"field": "@timestamp",
|
||||
"field": "log_timestamp",
|
||||
},
|
||||
},
|
||||
"transform_id": Any<String>,
|
||||
|
@ -243,7 +243,7 @@ Object {
|
|||
"group_by": Object {
|
||||
"@timestamp": Object {
|
||||
"date_histogram": Object {
|
||||
"field": "@timestamp",
|
||||
"field": "log_timestamp",
|
||||
"fixed_interval": "1m",
|
||||
},
|
||||
},
|
||||
|
@ -294,7 +294,7 @@ Object {
|
|||
"sync": Object {
|
||||
"time": Object {
|
||||
"delay": "1m",
|
||||
"field": "@timestamp",
|
||||
"field": "log_timestamp",
|
||||
},
|
||||
},
|
||||
"transform_id": Any<String>,
|
||||
|
|
|
@ -29,9 +29,9 @@ export class KQLCustomTransformGenerator extends TransformGenerator {
|
|||
this.buildDescription(slo),
|
||||
this.buildSource(slo, slo.indicator),
|
||||
this.buildDestination(),
|
||||
this.buildGroupBy(slo, this.getTimestampFieldOrDefault(slo.indicator.params.timestampField)),
|
||||
this.buildGroupBy(slo, slo.indicator.params.timestampField),
|
||||
this.buildAggregations(slo, slo.indicator),
|
||||
this.buildSettings(slo, this.getTimestampFieldOrDefault(slo.indicator.params.timestampField))
|
||||
this.buildSettings(slo, slo.indicator.params.timestampField)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,4 @@ export class KQLCustomTransformGenerator extends TransformGenerator {
|
|||
}),
|
||||
};
|
||||
}
|
||||
|
||||
private getTimestampFieldOrDefault(timestampField: string | undefined): string {
|
||||
return !!timestampField && timestampField.length > 0 ? timestampField : '@timestamp';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue