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] Provide troubleshooting information on the host details page #191104

Conversation

jennypavlova
Copy link
Member

@jennypavlova jennypavlova commented Aug 22, 2024

Closes #190523

Summary

This PR provides troubleshooting information in the services section on the host details page.

Testing

Go to the hosts details page / host flyout

  • using a host without services monitored with system integration
    image

  • using a host without services not monitored with system integration ( only detected by APM )
    image

  • icon next to the title (same as the table)

image

For hosts with services, nothing changes (the service is shown):
image

@jennypavlova jennypavlova self-assigned this Aug 22, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jennypavlova jennypavlova added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Aug 22, 2024
@jennypavlova
Copy link
Member Author

/ci

@jennypavlova jennypavlova marked this pull request as ready for review August 22, 2024 16:16
@jennypavlova jennypavlova requested a review from a team as a code owner August 22, 2024 16:16
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this change!

The only thing that seems to be missing is the? icon next to the host name (first item of the AC).

image

Comment on lines 75 to 88
monitoredHost: {
filter: getFilterByIntegration(SYSTEM_INTEGRATION),
aggs: {
name: {
terms: {
field: HOST_NAME_FIELD,
size: 1,
order: {
_key: 'asc',
},
},
},
},
},
Copy link
Contributor

@crespocarlos crespocarlos Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint is used for other asset types. We might want to run this agg only if nodeType === 'host'.

Also, perhaps running a query like getHasDataFromSystemIntegration parallel to this query might be faster than this term agg because it early terminates as soon as it finds a document that satisfies the criteria.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the aggregation conditional so it will be set only if we have nodeType === 'host' In this query we already filter by node name so it shouldn't be slow I think 🤔 Wdyt? I can also write an extra query again filtered by node name and use it as a boolean flag (if any data is returned or not) but I am not sure if there is a big benefit in this case as you need to query and filter again to get the results as the aggregation is added to an existing query.

Copy link
Contributor

@crespocarlos crespocarlos Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for adding the condition.

The fact that the query filters by host.name helps, but elasticsearch still needs to collect documents to build the aggregation. getHasDataFromSystemIntegration requires less computation - this function could even be reused.

Another potential downside is if we need to do something similar for other asset types. I'm not sure if adding aggregations to this query will scale nicely.

But it's up to you. We can always revisit this in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. Yeah, when I think about it it is a good idea - it brings dependency to the infraMetricsClient but I guess that is fine as we can use it in case we have similar queries for different assets.


return {
id: nodeId,
name: get(response, ['aggregations', 'nodeName', 'buckets', 0, 'key'], nodeId),
hasSystemIntegration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute kind of makes it harder to extend the same idea to other asset types because this condition is specific to hosts.

For now, I think it's OK because we don't know if the problem we're solving here will happen to other asset types, but I would return this attribute only when nodeType === host. wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed that to be returned only for hosts, thanks for catching that!

Comment on lines 106 to 111
const hostWithSystemIntegration =
response.aggregations && (response.aggregations?.monitoredHost?.name?.buckets ?? []).length > 0
? response.aggregations?.monitoredHost?.name.buckets[0]?.key
: null;

const hasSystemIntegration = hostWithSystemIntegration === nodeId;
Copy link
Contributor

@crespocarlos crespocarlos Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be done only when nodeType === 'host'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Aug 23, 2024
Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the missing (?) to the header! Left a couple more comments.

@@ -53,7 +55,7 @@ export const Flyout = ({
data-component-name={ASSET_DETAILS_FLYOUT_COMPONENT_NAME}
data-asset-type={asset.type}
>
{loading ? (
{loading || metadataLoading ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will block the loading of components in the flyout that doesn't depend on metadata.

blocking_loading_spinner.mov

This is not necessarily part of this PR, but how about removing this InfraLoadingPanel and passing loading and metadataLoading via props to FlyoutHeader? This way we can have a loading spinner that doesn't block the loading rest of the flyout.

For the full page view, we do this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting that! I changed it to use the loading spinner inside FlyoutHeader like on the page view:

flyout_loading.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great now! thanks.

Comment on lines 80 to 94
set(metricQuery, 'body.aggs', {
monitoredHost: {
filter: getFilterByIntegration(SYSTEM_INTEGRATION),
aggs: {
name: {
terms: {
field: HOST_NAME_FIELD,
size: 1,
order: {
_key: 'asc',
},
},
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q and nit: Do we need lodash for this?

We could do this directly on the metricQuery

Suggested change
set(metricQuery, 'body.aggs', {
monitoredHost: {
filter: getFilterByIntegration(SYSTEM_INTEGRATION),
aggs: {
name: {
terms: {
field: HOST_NAME_FIELD,
size: 1,
order: {
_key: 'asc',
},
},
},
},
},
...(nodeType === 'host'
? {
monitoredHost: {
filter: getFilterByIntegration(SYSTEM_INTEGRATION),
aggs: {
name: {
terms: {
field: HOST_NAME_FIELD,
size: 1,
order: {
_key: 'asc',
},
},
},
},
},
}
: undefined),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced it with a getHasDataFromSystemIntegration as discussed

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏 ! Thanks for the changes!

@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 23, 2024

💚 Build Succeeded

  • Buildkite Build
  • Commit: ad40529
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-191104-ad4052963450

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
infra 1575 1576 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 1.5MB 1.5MB +2.3KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jennypavlova

@jennypavlova jennypavlova enabled auto-merge (squash) August 23, 2024 16:39
@jennypavlova jennypavlova merged commit 3628fda into elastic:main Aug 23, 2024
23 checks passed
MiriamAparicio added a commit that referenced this pull request Sep 3, 2024
…1908)

Closes #191579

### Summary

When working on finding the root cause of the bug, another bug related
was discovered on the host detected by APM tooltip, it was introduced by
this [PR](#191104) when we check
for `metadataLoading` to finish, as we don’t do it for the asset details
page the loading spinner wasn’t shown there when refreshing the page,
but the tooltip shows because is still waiting for the metadata request
to finish in order to retrieve the integration.
To fix this, we don't apply loading spinner to the asset name, but we do
it for the tooltip

BEFORE


https://github.com/user-attachments/assets/3a946e84-1256-440c-bb65-56df30d8d3a5

AFTER


https://github.com/user-attachments/assets/689a6583-c66d-4e96-8605-9cce6c9aff24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infra] Provide troubleshooting information on the Host Details page
6 participants