feat(slo): introduce find SLO instances internal route#245333
feat(slo): introduce find SLO instances internal route#245333kdelemme merged 2 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/actionable-obs-team (Team:actionable-obs) |
e7bcadb to
41e66f2
Compare
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
There was a problem hiding this comment.
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}/_instancesGET 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 |
x-pack/solutions/observability/plugins/slo/server/services/find_slo_instances.ts
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
cc @kdelemme |
| import type { ESSearchResponse } from '@kbn/es-types'; | ||
| import type { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; | ||
|
|
||
| export function isUndefinedOrNull(value: any): value is undefined | null { |
There was a problem hiding this comment.
++ for removing duplicated query helpers
dmlemeshko
left a comment
There was a problem hiding this comment.
x-pack/solutions/observability/test/api_integration_deployment_agnostic/services/slo_api.ts changes LGTM
* 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) ...
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

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
GET /internal/observability/slos/{sloId}/_instances?size=5&search=foo