Skip to content

Commit

Permalink
Overwrite the transform document _id from the rollup pipeline to ensu…
Browse files Browse the repository at this point in the history
…re uniqness
  • Loading branch information
kdelemme committed Oct 31, 2024
1 parent 0cd2d92 commit b6fa512
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export const getSLOPipelineTemplate = (slo: SLODefinition) => ({
id: getSLOPipelineId(slo.id, slo.revision),
description: `Ingest pipeline for SLO rollup data [id: ${slo.id}, revision: ${slo.revision}]`,
processors: [
{
set: {
field: '_id',
value: `${slo.id}-${slo.revision}-{{{_id}}}`,
},
},
{
set: {
field: 'event.ingested',
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.

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 @@ -5,13 +5,12 @@
* 2.0.
*/

import { ALL_VALUE } from '@kbn/slo-schema';
import { dataViewsService } from '@kbn/data-views-plugin/server/mocks';
import { ALL_VALUE } from '@kbn/slo-schema';
import { SLODefinition } from '../../domain/models';
import { twoMinute } from '../fixtures/duration';
import { createSLO, createSyntheticsAvailabilityIndicator } from '../fixtures/slo';
import { SyntheticsAvailabilityTransformGenerator } from './synthetics_availability';
import { SYNTHETICS_INDEX_PATTERN } from '../../../common/constants';
import { twoMinute } from '../fixtures/duration';

const generator = new SyntheticsAvailabilityTransformGenerator();

Expand All @@ -22,119 +21,7 @@ describe('Synthetics Availability Transform Generator', () => {
const slo = createSLO({ id: 'irrelevant', indicator: createSyntheticsAvailabilityIndicator() });
const transform = await generator.getTransformParams(slo, spaceId, dataViewsService);

expect(transform).toEqual({
_meta: {
managed: true,
managed_by: 'observability',
version: 3.3,
},
defer_validation: true,
description: 'Rolled-up SLI data for SLO: irrelevant [id: irrelevant, revision: 1]',
dest: {
index: '.slo-observability.sli-v3.3',
pipeline: '.slo-observability.sli.pipeline-irrelevant-1',
},
frequency: '1m',
pivot: {
aggregations: {
'slo.denominator': {
filter: {
term: {
'summary.final_attempt': true,
},
},
},
'slo.numerator': {
filter: {
term: {
'monitor.status': 'up',
},
},
},
},
group_by: {
'@timestamp': {
date_histogram: {
field: '@timestamp',
fixed_interval: '1m',
},
},
'monitor.config_id': {
terms: {
field: 'config_id',
},
},
'monitor.name': {
terms: {
field: 'monitor.name',
},
},
'observer.name': {
terms: {
field: 'observer.name',
},
},
'observer.geo.name': {
terms: {
field: 'observer.geo.name',
},
},
'slo.groupings.monitor.name': {
terms: {
field: 'monitor.name',
},
},
'slo.groupings.observer.geo.name': {
terms: {
field: 'observer.geo.name',
},
},
'slo.groupings.monitor.id': {
terms: {
field: 'monitor.id',
},
},
},
},
settings: {
deduce_mappings: false,
unattended: true,
},
source: {
index: SYNTHETICS_INDEX_PATTERN,
query: {
bool: {
filter: [
{
term: {
'summary.final_attempt': true,
},
},
{
term: {
'meta.space_id': 'custom-space',
},
},
{
range: {
'@timestamp': {
gte: 'now-7d/d',
},
},
},
],
},
},
runtime_mappings: {},
},
sync: {
time: {
delay: '1m',
field: 'event.ingested',
},
},
transform_id: 'slo-irrelevant-1',
});
expect(transform).toMatchSnapshot();
expect(transform.source.query?.bool?.filter).toContainEqual({
term: {
'summary.final_attempt': true,
Expand Down
Loading

0 comments on commit b6fa512

Please sign in to comment.