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][APM] Create a service in apm_data_access to provide APM collected host names #188752

Closed
2 of 3 tasks
crespocarlos opened this issue Jul 19, 2024 · 1 comment · Fixed by #189894
Closed
2 of 3 tasks
Assignees
Labels
Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture

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. This makes it harder for UIs to properly work with APM data.

Eg: In the hosts view we need to consider only docs generated by the system module. We could apply a filter by event.module: 'system' but that would filter out APM docs and we need APM docs to make the filter by service.name work.

This ticket is to properly decouple APM from Infra and allow Infra to properly request APM data via apm_data_access plugin

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

    HostsView->>InfraPlugin: Request hosts
    InfraPlugin->>InfraPlugin: Retrieve filtered host names
    InfraPlugin->>APMDataAccess: Request filtered host names
    APMDataAccess-->>InfraPlugin: Return filtered host names
    InfraPlugin->>InfraPlugin: Merge and dedup host names
    InfraPlugin->>InfraPlugin: Collect metrics only for the hosts monitored by the system integration
    InfraPlugin-->>HostsView: Return monitored hosts with metrics
Loading

Implementation hints

  • Create a service that will return the host names from APM indices. The parameters it needs to accept are (this is just a proposal, but it's roughly what's needed):
{
  timeFrom: number
  timeTo: number
  query: QueryDslQueryContainer
  limit: number
}

Issues/Tasks

  1. Team:obs-ux-infra_services backport:skip ci:project-deploy-observability release_note:skip v8.16.0
    crespocarlos
  2. Team:obs-ux-infra_services backport:skip ci:project-deploy-observability release_note:skip v8.16.0
    crespocarlos

AC

  • Service returns host names from APM docs
@botelastic botelastic bot added the needs-team Issues missing a team label label Jul 19, 2024
@crespocarlos crespocarlos added Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team and removed needs-team Issues missing a team label labels Jul 19, 2024
@elasticmachine
Copy link
Contributor

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

@smith smith added the technical debt Improvement of the software architecture and operational architecture label Jul 19, 2024
@crespocarlos crespocarlos self-assigned this Jul 23, 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 added a commit that referenced this issue Aug 1, 2024
part of [#188752](#188752)

## Summary

Move some types to `kbn-apm-types`. These types will be used later in
the `apm-data-access` plugin
#189654.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
crespocarlos added a commit that referenced this issue Aug 2, 2024
part of [#188752](#188752)

## Summary

In order to leverage the same performance benefits from `apm` plugin in
services created in `apm-data-access`, we need to move the
`APMEvenClient` and `get_document_sources` over to `apm-data-access`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
crespocarlos added a commit that referenced this issue Aug 7, 2024
closes [#188752](#188752)

## Summary

This PR creates a service that will return host names collected by APM. 

**NOTE**: At first, we'll use this service to join the host names from
APM with metrics collected by the system module to build the hosts with
metrics lists - not necessarily to be used in the total hosts count
functionality. This service may be adjusted as we start using it in
Infra.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
3 participants