Skip to content

feat(slo): introduce find SLO instances internal route#245333

Merged
kdelemme merged 2 commits intoelastic:mainfrom
kdelemme:feat/slo-instances-api
Dec 8, 2025
Merged

feat(slo): introduce find SLO instances internal route#245333
kdelemme merged 2 commits intoelastic:mainfrom
kdelemme:feat/slo-instances-api

Conversation

@kdelemme
Copy link
Copy Markdown
Contributor

@kdelemme kdelemme commented Dec 5, 2025

Related to #243996

Summary

This PR adds a new internal API endpoint to find instances of a given SLO id, with support for search filtering and pagination.

Testing

  • Create an SLO with groupBy
  • Wait for summary documents to be generated
  • Call GET /internal/observability/slos/{sloId}/_instances?size=5&search=foo
  • Verify instances are returned with pagination support

@github-actions github-actions bot added the author:actionable-obs PRs authored by the actionable obs team label Dec 5, 2025
@kdelemme kdelemme added release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. v9.3.0 backport:skip This PR does not require backporting and removed author:actionable-obs PRs authored by the actionable obs team labels Dec 5, 2025
@kdelemme kdelemme self-assigned this Dec 5, 2025
@kdelemme kdelemme marked this pull request as ready for review December 5, 2025 02:32
@kdelemme kdelemme requested review from a team as code owners December 5, 2025 02:32
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/actionable-obs-team (Team:actionable-obs)

@kdelemme kdelemme changed the title feat(slo): add find SLO instances internal route feat(slo): introduce find SLO instances internal route Dec 5, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new internal API endpoint to find instances of a given SLO (Service Level Objective) by ID, with support for search filtering and pagination. The endpoint enables users to query for specific SLO instances using wildcard search patterns and paginate through large result sets using composite aggregations.

Key Changes

  • New /internal/observability/slos/{id}/_instances GET endpoint with pagination and search capabilities
  • Service layer implementation using Elasticsearch composite aggregations for efficient instance discovery
  • Comprehensive integration tests covering pagination, search filtering, and space isolation

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
x-pack/platform/packages/shared/kbn-slo-schema/src/rest_specs/routes/find_instances.ts Schema definition for the new find instances endpoint with query parameter validation
x-pack/platform/packages/shared/kbn-slo-schema/src/rest_specs/routes/index.ts Exports the new schema types
x-pack/solutions/observability/plugins/slo/server/routes/slo/find_instances.ts Route handler implementing authorization checks and parameter mapping
x-pack/solutions/observability/plugins/slo/server/routes/slo/route.ts Registers the new route in the SLO route repository
x-pack/solutions/observability/plugins/slo/server/services/find_slo_instances.ts Core service implementation using composite aggregations for pagination
x-pack/solutions/observability/plugins/slo/server/utils/queries.ts Removed unused query helper functions (termQuery, wildcardQuery, etc.)
x-pack/solutions/observability/plugins/slo/server/utils/queries.test.ts Removed tests for deleted query helpers
x-pack/solutions/observability/test/api_integration_deployment_agnostic/services/slo_api.ts Test helper method for calling the new endpoint
x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/index.ts Registers the new integration test suite
x-pack/solutions/observability/test/api_integration_deployment_agnostic/apis/slo/find_instances.ts Comprehensive integration tests covering all endpoint features

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observability 1618 1619 +1
slo 1323 1324 +1
synthetics 1377 1378 +1
total +3

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 220 230 +10

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.7MB 1.7MB +131.0B
slo 993.0KB 993.1KB +137.0B
synthetics 1.0MB 1.0MB +130.0B
total +398.0B

Page load bundle

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

id before after diff
observability 95.7KB 95.7KB +2.0B
slo 33.5KB 33.5KB +8.0B
total +10.0B
Unknown metric groups

API count

id before after diff
@kbn/slo-schema 221 231 +10

cc @kdelemme

@mgiota mgiota self-requested a review December 5, 2025 09:43
import type { ESSearchResponse } from '@kbn/es-types';
import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server';

export function isUndefinedOrNull(value: any): value is undefined | null {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

++ for removing duplicated query helpers

Copy link
Copy Markdown
Contributor

@mgiota mgiota left a comment

Choose a reason for hiding this comment

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

LGTM!

Screenshot 2025-12-05 at 12 44 45

Copy link
Copy Markdown
Contributor

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

x-pack/solutions/observability/test/api_integration_deployment_agnostic/services/slo_api.ts changes LGTM

@kdelemme kdelemme merged commit 1c3bbf3 into elastic:main Dec 8, 2025
12 checks passed
@kdelemme kdelemme deleted the feat/slo-instances-api branch December 8, 2025 14:21
mbondyra added a commit to mbondyra/kibana that referenced this pull request Dec 8, 2025
* commit '6647f813c9fa03ac0378e3d4756246e8dc4b4c76': (33 commits)
  [Detection Engine] Extracts Rules/Alerts/Exceptions permission to new Rules feature privileges (elastic#239634)
  [Agent Builder] Add Intro Tour (elastic#245551)
  Add datastream lifecycle support to indices metadata (elastic#245548)
  [Serverless] Update preconfigured connectors (elastic#245445)
  [Metrics][Discover] Discover to prefer line chars for time series data (elastic#244595)
  Update dependency @elastic/ebt to ^1.4.1 (main) (elastic#241629)
  [One Workflow] fix: request bodies with oneof schemas (`kibana.SetAlertsStatus`, etc) (elastic#245344)
  Update dependency ai to v5 (elastic#244675)
  Fix Discover trace waterfall behavior with duplicate spans (elastic#244984)
  [FSH] Migrated fs usage to kbn/fs for sample ingest (elastic#244163)
  Streamlang: Unskip type coercion test (elastic#245519)
  [Response Ops][Reporting] Fixing error in calculating delay value between retries (elastic#245431)
  Add TopNavMenuBeta to navigation plugin (elastic#243578)
  [scout] support custom servers configuration (elastic#244306)
  [Fleet] Run agentless background sync without dry run (elastic#245286)
  Fix Change Password Flaky Test (elastic#245443)
  Add new gap fill status for rules (elastic#242595)
  [Kibana Search] Move SLOs higher up in search results (elastic#245518)
  feat(slo): introduce find SLO instances internal route (elastic#245333)
  [FSH] Dropped unnecessary `fs` persistence for synthetics project code (elastic#244338)
  ...
JordanSh pushed a commit to JordanSh/kibana that referenced this pull request Dec 9, 2025
Related to elastic#243996

## Summary

This PR adds a new internal API endpoint to find instances of a given
SLO id, with support for search filtering and pagination.

## Testing

- Create an SLO with groupBy
- Wait for summary documents to be generated
- Call `GET
/internal/observability/slos/{sloId}/_instances?size=5&search=foo`
- Verify instances are returned with pagination support
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-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. Team:obs-ux-management v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants