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
[Infrastructure UI] New Hosts API #154179
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
779865d
to
d098626
Compare
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ftr_configs.yml
@@ -0,0 +1,53 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from
https://github.com/elastic/kibana/blob/main/x-pack/plugins/infra/common/runtime_types.ts#L58
The idea is to centralize this function here and remove those duplications.
Hey @tonyghiani ! I'll answer these questions before addressing your comments.
Hm, it'd be confusing to have this as path params, but it's fair to say that returning a 400 if sourceId Is invalid.
I rather not give so much flexibility here. If the client passes relative dates e.g:
yeah. makes sense
Unfortunately, it's not possible because it's a top_metric aggregation. This column will have to be removed from the table, or at least not let the user sort by it.
I'll try to reproduce the issue. |
I don't think terms aggs supports this. Besides, it would complicate things on the query side and I don't even know the performance implications of doing that. If this turns out to be a use-case in the future, we can look into whether or not that's possible.
Yeah. this is a valid point |
Hey @crespocarlos thanks for clarifying all the previous questions!
When the timerange is relative ( |
Indeed, but if you sort by a column, we wouldn't necessarily pass a new timestamp. We would use what's stored in the state and just pass the On the usability side, it's not great that we need to calculate the timestamp on the frontend. But we would need at least a format that looks like |
The filter was filtering too much. There was a clause to filter |
Passing a random |
This is why I also thought about passing the |
I'm not really familiar with this endpoint, but isn't it supposed to return the configuration based on the sourceId - meaning that we're looking at the In this case, I wouldn't say hosts is a resource from You could on the other hand hypothetically have something like Getting back to the fallback object used when the |
Yep agree, I guess what concern me is not explicitly seeing why I'm not getting any metric if the |
@@ -0,0 +1,92 @@ | |||
# Infra Hosts API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we had open-api docs in place
yeah. I get it. It's frustrating. My first thought to solve that is to let the client send what's the index pattern the API needs to use - which could have typos too or refer to a non-existing index. It will make the problem more noticeable, maybe? I'll try to see if there is any combination of conditions we could use to return a 404. |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Closing this PR to rethink the solution |
closes: #152103
fixes: #151768
Summary
This PR adds a new API to return host metrics for the Hosts View page. There are some constraints to what Elasticsearch can do in terms of sorting. The main query runs a
terms
aggregation, whose size is dynamic.The caveat of this solution is that instead of sorting by the actual metric aggregation, it sorts by either a
min
ormax
aggregation of a field. The doc mentions that this is the safest way to sort by a sub-aggregation. This could, however, potentially return a wrong order, but due to Elasticsearch limitations, it's much more likely to return wrong results sorting by anavg
aggregation.Comparison
The comparison below was done with a load of 5 days worth of data, containing 500 hosts on each day, on my local env. For short date ranges, Snapshot API performs consistently better, and the new approach performs better with a large amount of data.
Snapshot API
Returns all 500 hosts
15 minutes
1 day
1 week
Profiler
The profiler results was taken running a query with a 1 day date range.
Hosts API
Returns up to 100 hosts
15 minutes
1 day
1 week
Profiler
The profiler results was taken running a query with a 1 day date range.
How to test