Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(slo): Make APM indicator's index required #153311

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/kbn-slo-schema/src/schema/indicators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const apmTransactionDurationIndicatorSchema = t.type({
transactionType: allOrAnyString,
transactionName: allOrAnyString,
threshold: t.number,
index: t.string,
}),
t.partial({
index: t.string,
filter: t.string,
}),
]),
Expand All @@ -36,12 +36,12 @@ const apmTransactionErrorRateIndicatorSchema = t.type({
service: allOrAnyString,
transactionType: allOrAnyString,
transactionName: allOrAnyString,
index: t.string,
}),
t.partial({
goodStatusCodes: t.array(
t.union([t.literal('2xx'), t.literal('3xx'), t.literal('4xx'), t.literal('5xx')])
),
index: t.string,
filter: t.string,
}),
]),
Expand Down
18 changes: 12 additions & 6 deletions x-pack/plugins/observability/dev_docs/slo.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ curl --request POST \
"service": "o11y-app",
"transactionType": "request",
"transactionName": "GET /api",
"goodStatusCodes": ["2xx", "3xx", "4xx"]
"goodStatusCodes": ["2xx", "3xx", "4xx"],
"index": "metrics-apm*"
}
},
"timeWindow": {
Expand Down Expand Up @@ -105,7 +106,8 @@ curl --request POST \
"service": "o11y-app",
"transactionType": "request",
"transactionName": "GET /api",
"goodStatusCodes": ["2xx", "3xx", "4xx"]
"goodStatusCodes": ["2xx", "3xx", "4xx"],
"index": "metrics-apm*"
}
},
"timeWindow": {
Expand Down Expand Up @@ -142,7 +144,8 @@ curl --request POST \
"service": "o11y-app",
"transactionType": "request",
"transactionName": "GET /api",
"goodStatusCodes": ["2xx", "3xx", "4xx"]
"goodStatusCodes": ["2xx", "3xx", "4xx"],
"index": "metrics-apm*"
}
},
"timeWindow": {
Expand Down Expand Up @@ -181,7 +184,8 @@ curl --request POST \
"service": "o11y-app",
"transactionType": "request",
"transactionName": "GET /api",
"threshold": 500000
"threshold": 500,
"index": "metrics-apm*"
}
},
"timeWindow": {
Expand Down Expand Up @@ -216,7 +220,8 @@ curl --request POST \
"service": "o11y-app",
"transactionType": "request",
"transactionName": "GET /api",
"threshold": 500000
"threshold": 500,
"index": "metrics-apm*"
}
},
"timeWindow": {
Expand Down Expand Up @@ -253,7 +258,8 @@ curl --request POST \
"service": "o11y-app",
"transactionType": "request",
"transactionName": "GET /api",
"threshold": 500000
"threshold": 500,
"index": "metrics-apm*"
}
},
"timeWindow": {
Expand Down
12 changes: 7 additions & 5 deletions x-pack/plugins/observability/docs/openapi/slo/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ paths:
- $ref: '#/components/parameters/slo_id'
responses:
'200':
description: Succesful request
description: Successful request
content:
application/json:
schema:
Expand Down Expand Up @@ -181,7 +181,7 @@ paths:
$ref: '#/components/schemas/update_slo_request'
responses:
'200':
description: Succesful request
description: Successful request
content:
application/json:
schema:
Expand Down Expand Up @@ -211,7 +211,7 @@ paths:
- $ref: '#/components/parameters/slo_id'
responses:
'204':
description: Succesful request
description: Successful request
'400':
description: Bad request
content:
Expand All @@ -238,7 +238,7 @@ paths:
- $ref: '#/components/parameters/slo_id'
responses:
'204':
description: Succesful request
description: Successful request
'400':
description: Bad request
content:
Expand All @@ -265,7 +265,7 @@ paths:
- $ref: '#/components/parameters/slo_id'
responses:
'200':
description: Succesful request
description: Successful request
'400':
description: Bad request
content:
Expand Down Expand Up @@ -400,6 +400,7 @@ components:
- environment
- transactionType
- transactionName
- index
properties:
service:
description: The APM service name
Expand Down Expand Up @@ -455,6 +456,7 @@ components:
- environment
- transactionType
- transactionName
- index
properties:
service:
description: The APM service name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ properties:
- environment
- transactionType
- transactionName
- index
properties:
service:
description: The APM service name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ properties:
- environment
- transactionType
- transactionName
- index
properties:
service:
description: The APM service name
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/observability/public/data/slo/indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const buildApmAvailabilityIndicator = (
transactionType: 'request',
transactionName: 'GET /flaky',
goodStatusCodes: ['2xx', '3xx', '4xx'],
index: 'metrics-apm*',
...params,
},
};
Expand All @@ -33,7 +34,8 @@ export const buildApmLatencyIndicator = (
service: 'o11y-app',
transactionType: 'request',
transactionName: 'GET /slow',
threshold: 5000000,
threshold: 500,
index: 'metrics-apm*',
...params,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('FindSLO', () => {
transactionName: 'irrelevant',
transactionType: 'irrelevant',
threshold: 500,
index: 'metrics-apm*',
},
type: 'sli.apm.transactionDuration',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const createAPMTransactionErrorRateIndicator = (
transactionName: 'irrelevant',
transactionType: 'irrelevant',
goodStatusCodes: ['2xx', '3xx', '4xx'],
index: 'metrics-apm*',
...params,
},
});
Expand All @@ -49,6 +50,7 @@ export const createAPMTransactionDurationIndicator = (
transactionName: 'irrelevant',
transactionType: 'irrelevant',
threshold: 500,
index: 'metrics-apm*',
...params,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('GetSLO', () => {
transactionName: 'irrelevant',
transactionType: 'irrelevant',
goodStatusCodes: ['2xx', '3xx', '4xx'],
index: 'metrics-apm*',
},
type: 'sli.apm.transactionErrorRate',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template';
import { SLO, APMTransactionDurationIndicator } from '../../../domain/models';
import { getElastichsearchQueryOrThrow, TransformGenerator } from '.';
import { DEFAULT_APM_INDEX } from './constants';
import { Query } from './types';
import { parseIndex } from './common';

Expand Down Expand Up @@ -92,7 +91,7 @@ export class ApmTransactionDurationTransformGenerator extends TransformGenerator
}

return {
index: parseIndex(indicator.params.index ?? DEFAULT_APM_INDEX),
index: parseIndex(indicator.params.index),
runtime_mappings: this.buildCommonRuntimeMappings(slo),
query: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
getSLOTransformId,
} from '../../../assets/constants';
import { APMTransactionErrorRateIndicator, SLO } from '../../../domain/models';
import { DEFAULT_APM_INDEX } from './constants';
import { Query } from './types';
import { parseIndex } from './common';

Expand Down Expand Up @@ -97,7 +96,7 @@ export class ApmTransactionErrorRateTransformGenerator extends TransformGenerato
}

return {
index: parseIndex(indicator.params.index ?? DEFAULT_APM_INDEX),
index: parseIndex(indicator.params.index),
runtime_mappings: this.buildCommonRuntimeMappings(slo),
query: {
bool: {
Expand Down

This file was deleted.