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

Initial pass at agents list #47177

Merged

Conversation

jen-huang
Copy link
Contributor

Relates to #45631

This PR contains registering a new section in Management called Data Ingestion and adds the Fleet app in it. More importantly it contains the initial pass at agents list table:

image

The current endpoint for retrieving list of agents does not contain all information needed for the table (at least the ones shown in prototype), so some table columns are commented out in the meantime.

agent: any;
}

export const AgentHealth: React.SFC<Props> = ({ agent }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a simplified component for now as the information returned doesn't contain detailed status information, only active: (true|false)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is due to the events API being added secondary to this. Active has nothing to do with the status though. An unenrolled agent becomes active:false

Copy link
Contributor

Choose a reason for hiding this comment

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

The status needs to be derived from the (events of an agent) + (last checkin with the timeout of the last checkin based on the agent type, with ephemeral agents having not been seen in X time having no effect to the status , temporary showing in just an nuteral offline state if not seen in polling time from policy * 3 with the default polling time being 30sec, permanent is in a degraded status if not seen in 2x polling time, and an error status of offline if not seen in 4x)

Copy link
Contributor

Choose a reason for hiding this comment

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

Until we have events flowing in, just using the calculation of the last checkin time should be fine

import { EuiHealth } from '@elastic/eui';

interface Props {
agent: any;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this type should be Agent but the response doesn't return that type atm, so just using any for now

Copy link
Contributor

Choose a reason for hiding this comment

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

it should be Agent less access_token and enrollment_token... we prob need to adjust these types a bit / create a new type

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I re adjusted the type for the agent detail page, I can create a PR with it later tonight

agent: any;
}

export const AgentHealth: React.SFC<Props> = ({ agent }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is due to the events API being added secondary to this. Active has nothing to do with the status though. An unenrolled agent becomes active:false

};

// Load agents
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should prob use a timer, and poll every X seconds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, I will change this when I do the refactoring work to support manual pagination. with EuiInMemoryTable, refreshing data resets the table state!

Copy link
Contributor

Choose a reason for hiding this comment

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

ah true I forgot it did that

agent: any;
}

export const AgentHealth: React.SFC<Props> = ({ agent }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The status needs to be derived from the (events of an agent) + (last checkin with the timeout of the last checkin based on the agent type, with ephemeral agents having not been seen in X time having no effect to the status , temporary showing in just an nuteral offline state if not seen in polling time from policy * 3 with the default polling time being 30sec, permanent is in a degraded status if not seen in 2x polling time, and an error status of offline if not seen in 4x)

agent: any;
}

export const AgentHealth: React.SFC<Props> = ({ agent }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Until we have events flowing in, just using the calculation of the last checkin time should be fine

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

</EuiText>
</EuiTitle>
<EuiSpacer size="m" />
<EuiInMemoryTable
Copy link
Member

Choose a reason for hiding this comment

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

I am not really familiar with elastic components but it is ok to load all the agents?

Copy link
Contributor Author

@jen-huang jen-huang Oct 3, 2019

Choose a reason for hiding this comment

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

this component has built in pagination but will likely run into performance problems once there are thousands of items. my intention is to refactor this into EuiBasicTable with manual pagination after this week since I see that we intend to support pagination in the API endpoints via page query param (correct me if I'm wrong!)

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

Looks good on my side 👍 I suggest we create a separate issue to handle the agent status (both UI and API side).

@jen-huang
Copy link
Contributor Author

I updated AgentHealth with with logic that uses last_checkin and added tooltip with last check-in time:

image

Thanks for updating the return type btw @nchaulet 😄

@jen-huang
Copy link
Contributor Author

Also I pulled agent type constants into /common since they are needed for client-side conditionals: https://github.com/elastic/kibana/pull/47177/files#diff-f253602c6d807630dd60b521cc3a652eR12

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@jen-huang
Copy link
Contributor Author

Failing on unrelated tests; gonna merge for now and see if merging master into the feature branch helps.

@jen-huang jen-huang merged commit 57e9b96 into elastic:feature-make-it-ingest Oct 4, 2019
@jen-huang jen-huang deleted the feature/fleet-agent-list branch October 4, 2019 00:04
@jen-huang jen-huang added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants