Skip to content

Commit

Permalink
[Infra] Add observability feature id to host request (#192898)
Browse files Browse the repository at this point in the history
## Summary

Fixes the Hosts view for serverless by enabling the `observability`
feature id for the `/api/metrics/infra/{assetType}` request.

Closes #191078 

## How to test

- Go to Infrastructure -> Hosts
- Go to Alerts & Rules, Infrastructure Rules and create a new Inventory
Rule, something like alert on cpu usage above certain %.
- Allow the rule/alert to run
- Go back to Infrastructure -> Hosts view
- Hosts table should have a column with alert icons now visible for all
hosts with alerts active on them.

This should be tested against serverless + stateful versions of the
Observability product.


https://github.com/user-attachments/assets/8e0b36e0-30e6-4176-8190-592b3aaf2732

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
Bluefinger and elasticmachine authored Sep 17, 2024
1 parent 5082eef commit 3062292
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { termQuery, termsQuery } from '@kbn/observability-plugin/server';
import { observabilityFeatureId } from '@kbn/observability-shared-plugin/common';
import {
ALERT_RULE_PRODUCER,
ALERT_STATUS,
Expand Down Expand Up @@ -40,7 +41,7 @@ export async function getHostsAlertsCount({
query: {
bool: {
filter: [
...termQuery(ALERT_RULE_PRODUCER, INFRA_ALERT_FEATURE_ID),
...termsQuery(ALERT_RULE_PRODUCER, INFRA_ALERT_FEATURE_ID, observabilityFeatureId),
...termQuery(ALERT_STATUS, ALERT_STATUS_ACTIVE),
...termsQuery(HOST_NAME_FIELD, ...hostNames),
...rangeQuery,
Expand Down

0 comments on commit 3062292

Please sign in to comment.