[Infra] Fix Hosts filter options to match selected schema#259825
[Infra] Fix Hosts filter options to match selected schema#259825rmyz merged 10 commits intoelastic:mainfrom
Conversation
The Options List filter controls on the Hosts page showed suggestions from all documents in the metrics data view regardless of the selected schema (ECS vs semconv), leading to filter values that produced zero results when applied. This change: - Fixes the semconv OS filter field from `os.name` (non-existent) to `os.type` which is the actual field populated by the OTel collector - Adds a schema-scoped filter to the ControlGroupRenderer that restricts suggestions to documents matching the selected schema's metrics (nodeFilter) or APM transaction data (dataset-based filter) - ECS controls query: system integration docs OR `apm.transaction.*` docs - semconv controls query: hostmetricsreceiver docs OR `transaction.*.otel` docs Closes elastic#256158 Made-with: Cursor
The infra routing transform routed all docs with `metricset.name: cpu` (etc.) to `metrics-system.*-default` regardless of schema. When both ECS and semconv scenarios were ingested, semconv hosts leaked into the ECS view because they shared indices. - Add early return in routing transform for docs with pre-set `_index` - Set `_index: metrics-generic.otel-default` on semconv scenario docs - Add `metrics-generic.otel*` to infraEsClient cleanup data streams - Fix semconv metric field names (add `metrics.*` prefix for Lens) - Fix disk metrics to use state-based `metrics.system.filesystem.usage` Made-with: Cursor
|
/ci |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
Fixes Hosts page filter suggestions so Options List controls are scoped to the selected schema (ECS vs semconv), and adds synthtrace coverage for semconv hosts with OTel APM services.
Changes:
- Injects a schema-specific ES filter into the Hosts Control Group to scope suggestions to schema-appropriate metrics/APM datasets.
- Updates semconv OS control to use
os.typeinstead of the non-existentos.name. - Adds a new semconv + OTel APM synthtrace scenario and adjusts existing ECS scenario to avoid APM service name collisions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| x-pack/solutions/observability/plugins/metrics_data_access/common/index.ts | Re-exports the semconv OS field constant as OS_TYPE. |
| x-pack/solutions/observability/plugins/metrics_data_access/common/constants.ts | Changes semconv OS field constant from os.name to os.type. |
| x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsx | Adds schema-scoped filters to ControlGroupRenderer so suggestions align with ECS/semconv selection. |
| x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/control_panels_config.ts | Switches semconv OS control to OS_TYPE and updates replacement mapping for schema switching. |
| src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_with_apm_hosts.ts | Avoids APM service-name collisions by making service names unique per instance. |
| src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts | Adds a new semconv scenario combining host metrics with OTel APM traces. |
| src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv.ts | Aligns semconv host docs by adding os.type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...vability/plugins/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsx
Outdated
Show resolved
Hide resolved
...vability/plugins/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsx
Outdated
Show resolved
Hide resolved
src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts
Outdated
Show resolved
Hide resolved
src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts
Outdated
Show resolved
Hide resolved
|
/ci |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis pull request modifies Synthtrace data generation scenarios and updates the infrastructure hosts metrics filter UI to use OpenTelemetry semantic convention fields more consistently. Changes include adding 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Comment |
|
/ci |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts`:
- Around line 49-50: The os.type fields are set to the distro 'ubuntu' but must
use the OS family 'linux'; update both occurrences of the key names shown in
this diff ('resource.attributes.os.type' and 'os.type') in the
infra_hosts_semconv_with_apm_hosts scenario so their values are 'linux'
(matching infra_hosts_semconv.ts) to avoid filter mismatches.
- Around line 133-147: The networkDocs entries currently only set
'system.network.io' but should also include the Lens-compatible prefixed field;
update the mapping that creates networkDocs (the array mapped into objects with
...base, ...net, 'metricset.name': 'network', 'device.keyword': 'eth0') to also
set 'metrics.system.network.io' to the same value as 'system.network.io' for
both transmit and receive docs so they match CPU/memory/disk patterns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: b8dffe3d-e8fb-4bdd-aacf-bf5d471d6f79
📒 Files selected for processing (9)
src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv.tssrc/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.tssrc/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_with_apm_hosts.tsx-pack/solutions/observability/plugins/infra/moon.ymlx-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/control_panels_config.tsx-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsxx-pack/solutions/observability/plugins/infra/tsconfig.jsonx-pack/solutions/observability/plugins/metrics_data_access/common/constants.tsx-pack/solutions/observability/plugins/metrics_data_access/common/index.ts
src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts
Show resolved
Hide resolved
src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts
Show resolved
Hide resolved
The Lens formulas for semconv network KPIs use the metrics.* prefixed field. Without it, TX/RX tiles would show blank — same pattern already applied for CPU, memory, and disk metrics. Made-with: Cursor
|
/ci |
|
Pinging @elastic/obs-presentation-team (Team:obs-presentation) |
ApprovabilityVerdict: Needs human review This PR introduces new runtime filtering logic in the hosts search bar that changes what filter options are displayed based on schema selection. While framed as a fix, the new You can customize Macroscope's approvability policy. Learn more. |
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @rmyz |
flash1293
left a comment
There was a problem hiding this comment.
synthtrace change only, LGTM
iblancof
left a comment
There was a problem hiding this comment.
Obs-exploration code changes (synthtrace) lgtm
sbelastic
left a comment
There was a problem hiding this comment.
code LGTM, also tested locally and everything seems to be working :)
|
Starting backport for target branches: 9.2, 9.3 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…9825) Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 988eba6) # Conflicts: # src/platform/packages/shared/kbn-apm-synthtrace/src/scenarios/infra_hosts_semconv_with_apm_hosts.ts # src/platform/packages/shared/kbn-synthtrace/src/scenarios/infra_hosts_semconv.ts # x-pack/solutions/observability/plugins/infra/moon.yml # x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/control_panels_config.ts # x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsx # x-pack/solutions/observability/plugins/infra/tsconfig.json
…9825) Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 988eba6) # Conflicts: # x-pack/solutions/observability/plugins/infra/moon.yml # x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/control_panels_config.ts # x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsx # x-pack/solutions/observability/plugins/infra/tsconfig.json
…e_for_children6 * commit '3402744f63ca1196e97b11ffac4e7f7efab240df': (80 commits) [PerUserAuth] Add EARS auth type for Connectors V2 (elastic#253695) Fix `@elastic/eui/require-aria-label-for-modals` lint violations across `@elastic/kibana-core` files (elastic#259757) [Entity Analytics][Leads generation][4] Add API routes, LeadDataClient, and async generation (elastic#257046) [Agent Builder] Agent-centric UX redesign (elastic#258005) fix query streams failing test (elastic#260277) [Lens as code] Add list layout to the new API (elastic#259967) [FTR] Add warning comments to deployment-agnostic FTR base configs (elastic#260018) [Discover][Logs profile] Fix missing search highlights (elastic#260056) Plugin system: safe deletion (elastic#259038) [Infra] Fix Hosts filter options to match selected schema (elastic#259825) Manual Entity Resolution and flyout representation (elastic#260162) [Cascade] Handle grouping on fields with unset values (elastic#260033) [Fleet] generate OTel config for integration packages with otelcol inputs (elastic#259968) [Search] Switch over to V2 index management details (elastic#259866) [inference] increase timeout for ES inference calls (elastic#260382) [ES|QL] Enable subqueries (elastic#257455) [ES|QL] Change Point order free options (elastic#260282) [Auth] Added authentication strategy for UIAM OAuth (elastic#256182) [Security Solution] Add "alerts_candidate_count" rule execution metric (elastic#259917) [api-docs] 2026-03-31 Daily api_docs build (elastic#260380) ...
) (#260399) # Backport This will backport the following commits from `main` to `9.3`: - [[Infra] Fix Hosts filter options to match selected schema (#259825)](#259825) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Sergi Romeu","email":"sergi.romeu@elastic.co"},"sourceCommit":{"committedDate":"2026-03-31T08:32:45Z","message":"[Infra] Fix Hosts filter options to match selected schema (#259825)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"988eba69b1526d638fde30cd4fa31be1f5f79ba7","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","v9.4.0","Team:obs-presentation","v9.3.3","v9.2.8"],"title":"[Infra] Fix Hosts filter options to match selected schema","number":259825,"url":"https://github.com/elastic/kibana/pull/259825","mergeCommit":{"message":"[Infra] Fix Hosts filter options to match selected schema (#259825)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"988eba69b1526d638fde30cd4fa31be1f5f79ba7"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/259825","number":259825,"mergeCommit":{"message":"[Infra] Fix Hosts filter options to match selected schema (#259825)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"988eba69b1526d638fde30cd4fa31be1f5f79ba7"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
) (#260403) # Backport This will backport the following commits from `main` to `9.2`: - [[Infra] Fix Hosts filter options to match selected schema (#259825)](#259825) <!--- Backport version: 11.0.1 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Sergi Romeu","email":"sergi.romeu@elastic.co"},"sourceCommit":{"committedDate":"2026-03-31T08:32:45Z","message":"[Infra] Fix Hosts filter options to match selected schema (#259825)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"988eba69b1526d638fde30cd4fa31be1f5f79ba7","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","v9.4.0","Team:obs-presentation","v9.3.3","v9.2.8"],"title":"[Infra] Fix Hosts filter options to match selected schema","number":259825,"url":"https://github.com/elastic/kibana/pull/259825","mergeCommit":{"message":"[Infra] Fix Hosts filter options to match selected schema (#259825)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"988eba69b1526d638fde30cd4fa31be1f5f79ba7"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/259825","number":259825,"mergeCommit":{"message":"[Infra] Fix Hosts filter options to match selected schema (#259825)\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"988eba69b1526d638fde30cd4fa31be1f5f79ba7"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.2","label":"v9.2.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
…9825) Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…9825) Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
Closes #256158
Fixes the filter controls on the Hosts page so that suggested values match the selected data schema (ECS vs semconv), and adds a semconv+APM synthtrace scenario for testing.
Problem
The Options List filter controls (Operating System, Cloud Provider, Service Name) showed suggestions from all documents in the metrics data view regardless of the selected schema. Selecting a filter value from the wrong schema produced zero results.
Additionally, the semconv OS filter used
os.namewhich doesn't exist in OTel data, and there was no synthtrace scenario to test semconv hosts with APM services.Changes
Filter scoping (
controls_content.tsx)schemaFiltersmemo that injects a schema-specific Elasticsearch filter into theControlGroupRendererbool.shouldcombining:event.module: systemfor ECS,data_stream.dataset: hostmetricsreceiver.otelfor semconv)data_stream.dataset: apm.transaction.*for ECS,data_stream.dataset: transaction.*.otelfor semconv)OS field fix (
constants.ts,control_panels_config.ts)os.name(non-existent) toos.type, which is the actual field populated by the OTel collectorNew synthtrace scenario (
infra_hosts_semconv_with_apm_hosts.ts)ApmSynthtracePipelineSchema.Otelfor APM data soservice.nameappears under semconv filtersSemconv metric field alignment
metrics.*-prefixed fields alongside non-prefixed ones in both semconv scenarios (e.g.,metrics.system.cpu.utilizationalongsidesystem.cpu.utilization). In real OTel indices, themetrics.*prefix is added automatically via passthrough mappings, but synthtrace bypasses those templatesmetrics.system.filesystem.utilizationvalue to state-basedmetrics.system.filesystem.usagedocs (matching what the Lens formula expects)APM service name collision fix
synth-node-${index % 3}tosynth-node-${index}in the ECS scenario to avoidversion_conflict_engine_exceptiononservice_summarymetricsDemo
Before
Kapture.2026-03-27.at.11.02.04.mp4
After
ECS
Kapture.2026-03-27.at.10.30.57.mp4
SEMCONV
Kapture.2026-03-27.at.10.58.22.mp4
Testing