Skip to content

feat(slo): Add support for custom index for APM indicator types#147281

Merged
kdelemme merged 8 commits intoelastic:mainfrom
kdelemme:feat/add-index-apm-indicator
Dec 12, 2022
Merged

feat(slo): Add support for custom index for APM indicator types#147281
kdelemme merged 8 commits intoelastic:mainfrom
kdelemme:feat/add-index-apm-indicator

Conversation

@kdelemme
Copy link
Contributor

@kdelemme kdelemme commented Dec 8, 2022

📝 Summary

Resolves #147280

This PR add an optional index parameter for both APM indicator types to allow custom integration to configure which source index to use.

🧪 Manual testing

Create SLO with specified index
curl --request POST \
  --url http://localhost:5601/kibana/api/observability/slos \
  --header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
  --header 'Content-Type: application/json' \
  --header 'kbn-xsrf: oui' \
  --data '{
	"name": "My SLO Service Latency",
	"description": "My SLO Desc",
	"indicator": {
		"type": "sli.apm.transaction_duration",
		"params": {
			"environment": "development",
			"service": "o11y-app",
			"transaction_type": "request",
			"transaction_name": "GET /slow",
			"threshold.us": 5000000,
			"index": "custom-metrics-apm*"
		}
	},
	"time_window": {
		"duration": "7d",
		"is_rolling": true
	},
	"budgeting_method": "occurrences",
	"objective": {
		"target": 0.99
	}
}'

✅ Check the index is returned:

Fetch all SLO
curl --request GET \
  --url 'http://localhost:5601/kibana/api/observability/slos?per_page=10&page=1&=' \
  --header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
  --header 'kbn-xsrf: oui'

✅ Check the transform > json in stack management is using the specified index

@kdelemme kdelemme added release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.7.0 labels Dec 8, 2022
@kdelemme kdelemme self-assigned this Dec 8, 2022
@kdelemme kdelemme requested review from a team and CoenWarmer December 8, 2022 18:52
@kdelemme
Copy link
Contributor Author

kdelemme commented Dec 8, 2022

Pinging you @CoenWarmer since you discovered this while testing with CCS :)

@kdelemme kdelemme marked this pull request as ready for review December 8, 2022 18:52
@elasticmachine
Copy link
Contributor

Pinging @elastic/actionable-observability (Team: Actionable Observability)

Copy link
Member

@maryam-saeidi maryam-saeidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and worked as expected, just added some minor comments.

it('uses the provided index params as source index', async () => {
const anSLO = createSLO({
indicator: createAPMTransactionErrorRateIndicator({
index: 'my-custom-apm-index*',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: saving 'my-custom-apm-index*' in a const to use it in both places.

import { TransformGenerator } from '.';

const APM_SOURCE_INDEX = 'metrics-apm*';
const DEFAULT_APM_INDEX = 'metrics-apm*';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to define DEFAULT_APM_INDEX twice? (also in apm_transaction_error_rate.ts)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason, I tend to prefer having the constants defined in the module instead of an external file, but not attached to that rule

@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 60 66 +6
osquery 109 115 +6
securitySolution 445 451 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 69 75 +6
osquery 110 117 +7
securitySolution 521 527 +6
total +21

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @kdelemme

@kdelemme kdelemme merged commit b80a23e into elastic:main Dec 12, 2022
@kdelemme kdelemme deleted the feat/add-index-apm-indicator branch December 12, 2022 18:18
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SLO] Add support for index settings when creating APM indicator types

5 participants