Skip to content

Commit

Permalink
fix(slo): use comma separarted list of source index for transform (el…
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme authored Sep 13, 2023
1 parent a18c68f commit c0417f4
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand All @@ -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: [
Expand All @@ -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',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit c0417f4

Please sign in to comment.