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

feat(slo): add reset api #170473

Merged
merged 21 commits into from
Nov 16, 2023
Merged

feat(slo): add reset api #170473

merged 21 commits into from
Nov 16, 2023

Conversation

kdelemme
Copy link
Contributor

@kdelemme kdelemme commented Nov 2, 2023

Resolves #170455

🌮 Summary

This PR introduces the reset api for individual SLOs. This API is used to fully reset (aka a factory reset) an SLO. It deletes the related transform if it exists, and recreates it. It also delete the rollup and summary documents related to that SLO (included all revision and all instance ids)

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -38,6 +37,21 @@ export const slo: SavedObjectsType = {
name: SO_SLO_TYPE,
hidden: false,
namespaceType: 'multiple-isolated',
switchToModelVersionAt: '8.10.0',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

💬 I tried setting this to 8.12.0 but the framework was complaining.

Copy link
Contributor

Choose a reason for hiding this comment

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

You effectively don't need to set this option, as it gets applied with the default/max value (8.10.0) if unspecified . It was exposed for type owners that wanted to switch before 8.10.0 (and for testing purposes)

Comment on lines 37 to 42
try {
await this.transformManager.install(slo);
} catch (err) {
// what can we do in this case?
throw err;
}
Copy link
Member

@simianhacker simianhacker Nov 3, 2023

Choose a reason for hiding this comment

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

I think throwing the error is the best thing we can do at this point. As long as we bubble up the actual error message from ES so they can understand what the problem is. My guess is that if this failed (missing transform permissions OR missing transform node) the two previous calls (stop and uninstall) would have failed too.

Maybe we don't need the try/catch since we're just going to throw at this point and there is nothing to rollback. The SLO model version will still be 1, so once they've resolved the issue that prevented the install call, they could just reset again.

@kdelemme kdelemme marked this pull request as ready for review November 6, 2023 16:44
@kdelemme kdelemme requested review from a team as code owners November 6, 2023 16:44
@kdelemme kdelemme self-assigned this Nov 6, 2023
@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.12.0 labels Nov 6, 2023
@elasticmachine
Copy link
Contributor

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

Copy link
Member

@simianhacker simianhacker left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

slo SO type changes LGTM

@@ -38,6 +37,21 @@ export const slo: SavedObjectsType = {
name: SO_SLO_TYPE,
hidden: false,
namespaceType: 'multiple-isolated',
switchToModelVersionAt: '8.10.0',
Copy link
Contributor

Choose a reason for hiding this comment

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

You effectively don't need to set this option, as it gets applied with the default/max value (8.10.0) if unspecified . It was exposed for type owners that wanted to switch before 8.10.0 (and for testing purposes)

@kdelemme kdelemme changed the title feat(slo): reset api feat(slo): add reset api Nov 7, 2023
Comment on lines 8 to 10
export const SLO_MODEL_VERSION = 2;
export const SLO_RESOURCES_VERSION = 2;
export const SLO_SUMMARY_TRANSFORMS_VERSION = 3;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@simianhacker Let's sync with the value we want to use. So we don't have different version to keep track

Copy link
Member

Choose a reason for hiding this comment

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

Good question, whatever value we use, any time that changes, it will trigger the need to reset the SLO definitions. What's the harm in leaving it "as is" other than the complexity of having three values?

What if we added a comment to above SLO_MODEL_VERSION that says:

Anytime we increment SLO_MODEL_VERSION, this will notify the user to "RESET" their SLO definitions which in turn re-indexes the SLI values and SLO summaries. Be judicious about changing this value.

@kdelemme kdelemme added the Team:obs-ux-management Observability Management User Experience Team label Nov 9, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@kdelemme kdelemme removed the Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" label Nov 9, 2023
@kdelemme kdelemme requested a review from a team as a code owner November 15, 2023 21:47
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observability 480 501 +21

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/slo-schema 128 144 +16

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observability 1.1MB 1.0MB -15.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observability 100.4KB 100.4KB +22.0B

Saved Objects .kibana field count

Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/saved-objects-service.html#_mappings

id before after diff
slo 10 11 +1
Unknown metric groups

API count

id before after diff
@kbn/slo-schema 131 144 +13

async chunk count

id before after diff
observability 15 16 +1

History

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

cc @kdelemme

@kdelemme kdelemme merged commit af1ad47 into elastic:main Nov 16, 2023
26 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 16, 2023
@kdelemme kdelemme deleted the slo-reset-api branch November 16, 2023 12:58
kdelemme added a commit to kdelemme/kibana that referenced this pull request Nov 16, 2023
kdelemme added a commit that referenced this pull request Nov 16, 2023
- Revert "feat(slo): add reset api (#170473)"
- Revert "[SLO] Use enrich policy to add SLO details to summary
(#169993)"
kdelemme added a commit to kdelemme/kibana that referenced this pull request Nov 20, 2023
@kdelemme kdelemme mentioned this pull request Nov 29, 2023
8 tasks
kdelemme added a commit to kdelemme/kibana that referenced this pull request Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SLO] API to reset an SLO (Create api/observability/slos/{id}/_reset)
7 participants