Skip to content

feat: add health check monitoring to workspace apps #4114

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

Merged
merged 64 commits into from
Sep 23, 2022
Merged

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Sep 19, 2022

chrome_oDa7c0k4fz

There is more to do to make this feature functional but this is safe to merge at this point since the default state is disabled.

@f0ssel f0ssel force-pushed the f0ssel/app-healthcheck branch from 9aad6cb to f30a2e4 Compare September 19, 2022 20:41
@f0ssel f0ssel marked this pull request as ready for review September 19, 2022 20:58
@f0ssel f0ssel requested a review from a team as a code owner September 19, 2022 20:58
@f0ssel f0ssel requested review from code-asher and removed request for a team September 19, 2022 20:58
@f0ssel f0ssel changed the title feat: add health check monitoring to workspace apps feat: add health check monitoring to workspace apps pt. 1 Sep 19, 2022
@f0ssel f0ssel requested review from BrunoQuaresma and a team September 19, 2022 21:23
Copy link
Member

@kylecarbs kylecarbs 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 so far. I assume we'll be adding the agent code that reports health as part of this too?

@f0ssel
Copy link
Contributor Author

f0ssel commented Sep 19, 2022

Yeah I can just continue on this branch until I get the tf connected.

Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

FE looks good to me

@f0ssel f0ssel force-pushed the f0ssel/app-healthcheck branch from cb8c83a to 658c6dc Compare September 20, 2022 14:34
@f0ssel f0ssel changed the title feat: add health check monitoring to workspace apps pt. 1 feat: add health check monitoring to workspace apps Sep 20, 2022
@code-asher code-asher removed their request for review September 20, 2022 15:09
@f0ssel
Copy link
Contributor Author

f0ssel commented Sep 20, 2022

EOD Tuesday update - This is getting pretty close to end to end functional. I have a loop running on the agent, it reports the changes to coderd, and coderd exposes this in the api for the dashboard to display. Mostly just cleaning up and some more tests.

@f0ssel
Copy link
Contributor Author

f0ssel commented Sep 20, 2022

PS - All of the changes around the agent package structs moving into codersdk - our general rule is to put everything shared in codersdk to prevent import cycle issues. When these types were put in the agent package it made it impossible for the agent package to import the codersdk client, resulting in duplicated types. This PR now solves that so we can reference codersdk types inside the agent code and do sane things like fetch resources.

@f0ssel
Copy link
Contributor Author

f0ssel commented Sep 22, 2022

@kylecarbs I think this is ready to merge, I'm down to go through this on a call or something since it's large but hopefully since it's been reviewed multiple times already it shouldn't be too bad.

@deansheather deansheather removed their request for review September 22, 2022 21:58
@f0ssel f0ssel requested a review from kylecarbs September 23, 2022 17:31
@@ -0,0 +1,7 @@
CREATE TYPE workspace_app_health AS ENUM ('disabled', 'initializing', 'healthy', 'unhealthy');
Copy link
Member

Choose a reason for hiding this comment

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

initializing might be a bit misleading because it's really just paused waiting for the delay. What do you think about waiting instead?

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe enabled instead re the code checking if the URL is set below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It stays in initializing until it either gets healthy or unhealthy, which could take up to threshold * interval. I like initializing because it implies both enabled and waiting but no determined value yet.

}

for _, app := range newApps {
err = api.Database.UpdateWorkspaceAppHealthByID(r.Context(), database.UpdateWorkspaceAppHealthByIDParams{
Copy link
Member

Choose a reason for hiding this comment

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

We could update these in one bulk request instead, similar to how we fetch by multiple IDs. That way, we wouldn't need to do any comparison logic I believe, and it'd be less DB requests.

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 wasn't sure how to do bulk updates in sqlc so I settled for this. I'm down to improve this in a separate PR if we can.

@f0ssel f0ssel merged commit 4c8be34 into main Sep 23, 2022
@f0ssel f0ssel deleted the f0ssel/app-healthcheck branch September 23, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants