Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra] Consider only docs from system and APM in the hosts view #188756

Closed
crespocarlos opened this issue Jul 19, 2024 · 3 comments · Fixed by #190049
Closed

[Infra] Consider only docs from system and APM in the hosts view #188756

crespocarlos opened this issue Jul 19, 2024 · 3 comments · Fixed by #190049
Assignees
Labels
enhancement New value added to drive a business result Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team

Comments

@crespocarlos
Copy link
Contributor

crespocarlos commented Jul 19, 2024

Summary

Infra has only one setting to define the index pattern. The index pattern can be as generic as metric-* which also includes APM indices and any other integration that sends host.name field.

In the hosts view we need to consider only docs generated by the system module and APM.

For that we can apply a filter by event.module: 'system' or metricset.module: 'system' to the queries. To continue supporting filter by service.name (or any other APM fields), we'll build a service in APM data access to return host names,

This is what the API needs to do:

sequenceDiagram
    participant HostsView as Hosts View
    participant InfraPlugin as Infra Plugin
    participant APMDataAccess as APM Data Access

    HostsView->>InfraPlugin: Request hosts
    InfraPlugin->>InfraPlugin: Retrieve system module filtered host names
    InfraPlugin->>APMDataAccess: Request filtered host names
    APMDataAccess-->>InfraPlugin: Return filtered host names
    InfraPlugin->>InfraPlugin: Collect metrics for the hosts names
    InfraPlugin->>InfraPlugin: Identify which hosts are monitored with the system module
    InfraPlugin-->>HostsView: Return hosts with metrics
Loading

Extra

Change the metrics/infra endpoint to accept the type as path parameter -> metrics/infra/{assetType}

Acceptance Criteria

  • Only hosts collected by system module and APM are returned by the API
  • Only hosts collected by system module and APM are considered in the hosts count.
  • Filter by service.name works
    • NOTE: it is expected that not all APM services will have a matching host name in system module docs. In order for the filter to work, it's required that the user configure their environment correctly (see https://github.com/elastic/observability-dev/issues/3321#issuecomment-2238890762)
    • In the oblt cluster, the following services should work: adservice, packetbeat, frontend, cartservice, recommendationservice, frauddetectionservice, accountingservice, cartservice, productcatalogservice
@crespocarlos crespocarlos added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Jul 19, 2024
@elasticmachine
Copy link
Contributor

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

@crespocarlos crespocarlos added the Feature:ObsHosts Hosts feature within Observability label Jul 19, 2024
@crespocarlos
Copy link
Contributor Author

The new filter will affect the otel onboarding. I created a proposal to address it: https://github.com/elastic/opentelemetry-dev/issues/338

@smith smith added the enhancement New value added to drive a business result label Jul 19, 2024
jennypavlova added a commit that referenced this issue Jul 25, 2024
Closes #188757 

## Summary
 
This PR adds an endpoint to get the hosts (monitored by the system
integration) count. Currently, it supports only hosts but it can be
extended to other asset types (if/when needed). So the endpoint ( **POST
/api/infra/{assetType}/count** ) supports only 'host' as `{assetType}`.

⚠️ This PR adds only the endpoint - it is not used yet! To avoid having
different host counts and results shown on the UI this PR is not
updating the hook responsible for the request because currently the
hosts shown in the table are not filtered by the system integration
(showing the filtered result of this endpoint can lead to
inconsistencies between the count and the results shown in the table)
Once [#188756](#188756) and
[#188752](#188752) are done we
can use this endpoint.

## Testing

It can't be tested in the UI so we can test it:

<details>

<summary>Using curl:</summary> 

```bash

curl --location -u elastic:changeme 'http://0.0.0.0:5601/ftw/api/infra/host/count' \
--header 'kbn-xsrf: xxxx' \
--header 'Content-Type: application/json' \
--data '{
   "query": {
      "bool": {
         "must": [],
         "filter": [],
         "should": [],
         "must_not": []
      }
   },
   "from": "2024-07-23T11:34:11.640Z",
   "to": "2024-07-23T11:49:11.640Z",
   "sourceId": "default"
}'

```
</details>

In case of testing with oblt replace the `elastic:changeme` with your
user and password
@crespocarlos crespocarlos self-assigned this Jul 30, 2024
@crespocarlos crespocarlos changed the title [Infra] Consider only docs from system integration in the hosts view [Infra] Consider only docs from system and APM in the hosts view Aug 7, 2024
@crespocarlos
Copy link
Contributor Author

crespocarlos commented Aug 7, 2024

The scope of the ticket was changed due to the impossibility of successfully filter out APM docs without compromising the current feature too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants