[Synthetics] Schema configuration and Server side changes for CCS settings#262497
[Synthetics] Schema configuration and Server side changes for CCS settings#262497mgiota merged 59 commits intoelastic:mainfrom
Conversation
Add runtime type definitions for cross-cluster search (CCS) settings and remote monitor info, in preparation for federated views support. Closes elastic#259264
ApprovabilityVerdict: Needs human review This PR introduces a new Cross-Cluster Search (CCS) feature for Synthetics, including new UI settings, schema changes, and modifications to how ES queries are constructed to potentially include remote cluster indices. The significant scope of new functionality and unresolved architectural questions from reviewers warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Implement the persistence and server-side integration layer for cross-cluster search support: settings saved object with per-space isolation, repository, GET/PUT API routes, index resolution service, and route wrapper wiring gated behind experimental.ccs.enabled flag. Closes elastic#259265
Wire remoteKibanaUrls through RouteContext so route handlers can resolve deep links to remote Kibana instances. Add remote_result_utils with helpers to detect CCS index names and build RemoteMonitorInfo, and extend PingType and OverviewStatusMetaData with an optional remote field.
Thread remoteKibanaUrls into queryPings and attach remote monitor info to each ping based on its _index field. Verified get_journey_steps and get_certs work with CCS indices as-is. Overview status remote monitor visibility deferred to the UI phase.
…tic#259269) Add a "Remote Clusters" tab to the Settings page (stateful only) with controls for selecting remote clusters and configuring Kibana URLs for deep linking. Includes toggle for all clusters, combo box for specific selection, and a full-width URL mapping table per cluster.
The remote monitor detection logic in processOverviewStatus (building localMonitorIds Set, scanning statusData for unmatched IDs, and calling getRemoteMonitorDetails) was running unconditionally on every overview status request, even when CCS was disabled. This added unnecessary processing on a hot path and contributed to OOM failures in CI tests that create large datasets (15k buckets). Wrap the entire block in the same isCCSEnabled check already used by getEsDataFilters, so the work is only done when CCS is actually active. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ination test Extract SUMMARIES_PAGE_SIZE to a separate constants module so the test can mock it to a small value (10 instead of 5000) and eliminate the OOM crash in CI Jest shard 1/3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0407ae2 to
190913f
Compare
|
@mgiota for kibana url we should index it via fields api to synthetics data automatically when monitor is being created for private locations and for public location when sync is happening i think this UI would be a burden for users
|
|
@shahzad31 I removed remoteKibanaUrls changes from current PR in this commit. I will handle kibanaRemoteUrls separately in this issue
|
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
cc @mgiota |
|
@shahzad31 CI is finally green. I started an initial attempt to index kibanaUrl in this draft WIP PR. Let me know if we can merge current PR. |
| method: 'PUT', | ||
| path: SYNTHETICS_API_URLS.CCS_SETTINGS, | ||
| validate: { | ||
| body: CCSSettingsSchema, | ||
| }, | ||
| writeAccess: true, |
There was a problem hiding this comment.
i am double minded on this one as well, if we need a separate route here, i guess since we are using existing settings object, probably makes sense to use that
There was a problem hiding this comment.
Yep makes sense, I removed separate route in this commit. I see you already approved, I have one more question. The current dynamic_settings.ts route has no serverless guard. It will happily persist useAllRemoteClusters/selectedRemoteClusters to the saved object even in serverless mode.
In practice this is low risk, since the UI hides the entire Remote Clusters tab when isServerless || !isCCSEnabled. However if we want to hard block the PUT in serverless, we'd need to add a serverless guard inside dynamic_settings.ts for the CCS-specific fields. Is the UI + query-path gating sufficient or we should add that guard (could be follow up)
There was a problem hiding this comment.
I merge now that CI is green and we address things as follow ups
| let heartbeatIndices = SYNTHETICS_INDEX_PATTERN; | ||
| if (isCCSEnabled(server)) { | ||
| try { | ||
| const dynamicSettings = await getSyntheticsDynamicSettings(savedObjectsClient); | ||
| const ccsSettings = { | ||
| useAllRemoteClusters: dynamicSettings.useAllRemoteClusters ?? false, | ||
| selectedRemoteClusters: dynamicSettings.selectedRemoteClusters ?? [], | ||
| }; | ||
| const { indices } = await getSyntheticsIndices(esClient.asCurrentUser, ccsSettings); | ||
| heartbeatIndices = indices; | ||
| } catch (e) { | ||
| server.logger.warn(`Failed to resolve CCS indices, falling back to local: ${e.message}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
i wonder if it's worth caching this, since this is being used against all routes, so it will also impacts the routes which are for example simple routes like creating a monitor or editing a monitor, perhaps create a follow up issue to apply this only where this is required?
other way might be to make it a service like a funciton which gets called getHeartbeatIndices() and pass that, that way it will be only called when its being used in the route.
There was a problem hiding this comment.
worth caching this
Yep I had that in my todo list for a follow up.
shahzad31
left a comment
There was a problem hiding this comment.
Only two remaining comments and we should be good to go


Closes #259264
Closes #259265
Closes #259266
Closes #259267
Closes #259269
Summary
Add runtime type definitions for cross-cluster search (CCS) settings and remote monitor info, in preparation for federated views support - [Synthetics] [CCS] Define remote cluster settings types and extend API response types #259264
Add CCS settings API, saved object, and route wrapper wiring. Implement the persistence and server-side integration layer for cross-cluster search support: settings saved object with per-space isolation, repository, GET/PUT API routes, index resolution service, and route wrapper wiring gated behind experimental.ccs.enabled flag - [Synthetics] [CCS] Implement settings API and saved object for remote cluster preferences #259265
SyntheticsEsClient constructor accepts CCS index patterns, search/msearch/count use resolved indices, and route wrapper passes CCS-aware indices. [Synthetics] [CCS] Extend SyntheticsEsClient to support cross-cluster search index expressions #259266
Update server-side query modules [Synthetics] [CCS] Update server-side query modules to support CCS-aware index patterns #259267
Add Remote Settings UI - 259269