fix(slo): use comma separarted list of source index for transform (#166294)

This commit is contained in:
Kevin Delemme 2023-09-13 09:35:21 -04:00 committed by GitHub
parent a18c68f7ac
commit c0417f4d9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 15 deletions

View file

@ -58,7 +58,7 @@ export const createKQLCustomIndicator = (
): Indicator => ({
type: 'sli.kql.custom',
params: {
index: 'my-index*',
index: 'my-index*,my-other-index*',
filter: 'labels.groupId: group-3',
good: 'latency < 300',
total: '',
@ -72,7 +72,7 @@ export const createMetricCustomIndicator = (
): MetricCustomIndicator => ({
type: 'sli.metric.custom',
params: {
index: 'my-index*',
index: 'my-index*,my-other-index*',
filter: 'labels.groupId: group-3',
good: {
metrics: [
@ -95,7 +95,7 @@ export const createHistogramIndicator = (
): HistogramIndicator => ({
type: 'sli.histogram.custom',
params: {
index: 'my-index*',
index: 'my-index*,my-other-index*',
filter: 'labels.groupId: group-3',
good: {
field: 'latency',

View file

@ -209,7 +209,10 @@ Object {
"deduce_mappings": false,
},
"source": Object {
"index": "my-index*",
"index": Array [
"my-index*",
"my-other-index*",
],
"query": Object {
"bool": Object {
"minimum_should_match": 1,
@ -449,7 +452,10 @@ Object {
"deduce_mappings": false,
},
"source": Object {
"index": "my-index*",
"index": Array [
"my-index*",
"my-other-index*",
],
"query": Object {
"bool": Object {
"minimum_should_match": 1,

View file

@ -224,7 +224,10 @@ Object {
"deduce_mappings": false,
},
"source": Object {
"index": "my-index*",
"index": Array [
"my-index*",
"my-other-index*",
],
"query": Object {
"bool": Object {
"minimum_should_match": 1,
@ -438,7 +441,10 @@ Object {
"deduce_mappings": false,
},
"source": Object {
"index": "my-index*",
"index": Array [
"my-index*",
"my-other-index*",
],
"query": Object {
"bool": Object {
"minimum_should_match": 1,

View file

@ -233,7 +233,10 @@ Object {
"deduce_mappings": false,
},
"source": Object {
"index": "my-index*",
"index": Array [
"my-index*",
"my-other-index*",
],
"query": Object {
"bool": Object {
"minimum_should_match": 1,
@ -485,7 +488,10 @@ Object {
"deduce_mappings": false,
},
"source": Object {
"index": "my-index*",
"index": Array [
"my-index*",
"my-other-index*",
],
"query": Object {
"bool": Object {
"minimum_should_match": 1,

View file

@ -14,7 +14,7 @@ import {
import { InvalidTransformError } from '../../../errors';
import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template';
import { getElastichsearchQueryOrThrow, TransformGenerator } from '.';
import { getElastichsearchQueryOrThrow, parseIndex, TransformGenerator } from '.';
import {
SLO_DESTINATION_INDEX_NAME,
SLO_INGEST_PIPELINE_NAME,
@ -47,7 +47,7 @@ export class HistogramTransformGenerator extends TransformGenerator {
private buildSource(slo: SLO, indicator: HistogramIndicator) {
const filter = getElastichsearchQueryOrThrow(indicator.params.filter);
return {
index: indicator.params.index,
index: parseIndex(indicator.params.index),
runtime_mappings: this.buildCommonRuntimeMappings(slo),
query: filter,
};

View file

@ -10,7 +10,7 @@ import { kqlCustomIndicatorSchema, timeslicesBudgetingMethodSchema } from '@kbn/
import { InvalidTransformError } from '../../../errors';
import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template';
import { getElastichsearchQueryOrThrow, TransformGenerator } from '.';
import { getElastichsearchQueryOrThrow, parseIndex, TransformGenerator } from '.';
import {
SLO_DESTINATION_INDEX_NAME,
SLO_INGEST_PIPELINE_NAME,
@ -42,7 +42,7 @@ export class KQLCustomTransformGenerator extends TransformGenerator {
private buildSource(slo: SLO, indicator: KQLCustomIndicator) {
const filter = getElastichsearchQueryOrThrow(indicator.params.filter);
return {
index: indicator.params.index,
index: parseIndex(indicator.params.index),
runtime_mappings: this.buildCommonRuntimeMappings(slo),
query: filter,
};

View file

@ -10,7 +10,7 @@ import { metricCustomIndicatorSchema, timeslicesBudgetingMethodSchema } from '@k
import { InvalidTransformError } from '../../../errors';
import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template';
import { getElastichsearchQueryOrThrow, TransformGenerator } from '.';
import { getElastichsearchQueryOrThrow, parseIndex, TransformGenerator } from '.';
import {
SLO_DESTINATION_INDEX_NAME,
SLO_INGEST_PIPELINE_NAME,
@ -45,7 +45,7 @@ export class MetricCustomTransformGenerator extends TransformGenerator {
private buildSource(slo: SLO, indicator: MetricCustomIndicator) {
const filter = getElastichsearchQueryOrThrow(indicator.params.filter);
return {
index: indicator.params.index,
index: parseIndex(indicator.params.index),
runtime_mappings: this.buildCommonRuntimeMappings(slo),
query: filter,
};