-
Notifications
You must be signed in to change notification settings - Fork 894
feat: expose workspace statuses (with details) as a prometheus metric #12762
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
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
843d650
Add metric to show operators what statuses workspaces are in, with re…
dannykopping 2ed42a3
Clear gauges if no db entries are found
dannykopping c31b498
Change default refresh rates of Agent and Workspaces calls which seem…
dannykopping 2f5a948
Added tests for workspace detail metrics
dannykopping fc61d37
Refactor common funcs
dannykopping 6f95371
Remove unnecessary metric from test
dannykopping f42af07
Use NoLock variety to fix hung tests
dannykopping 2cb8ccc
Fix duration on windows builds
dannykopping b118044
Changing join type so that latest_build_status is non-nullable
dannykopping acd104c
Remove SuperShort duration as extraneous
dannykopping a333f98
Remove workspace cardinality; rename for clarity
dannykopping c920508
Fixing tests
dannykopping cf14b9d
Merge branch 'main' of github.com:/coder/coder into dk/workspace-metric
dannykopping a94914f
Merge branch 'main' of github.com:/coder/coder into dk/workspace-metric
dannykopping 8e6cde9
Renaming for clarity
dannykopping File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Changing join type so that latest_build_status is non-nullable
Signed-off-by: Danny Kopping <danny@coder.com>
- Loading branch information
commit b118044549d20a76ffe6c1a45a440a64e3f7f9a9
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Check this with @mafredri if it was not intentional 👍
Uh oh!
There was an error while loading. Please reload this page.
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 would avoid making this change. I believe there's a window of time when there exists a new build but it's not assigned to a job. So the nullability is something that should be handled.
This logic change essentially results in returning the previous build until the it's been assigned to a job.
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'm not sure if that's possible?
These keys are all non-nullable.
Is there something I'm missing?
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 should say though that I'd rather not make this change if you in any way suspect this will cause issues.
The way I had it prior to #12762 (comment) worked fine.
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.
Builds are inserted with their respective job in a single transaction. c.f.
wsbuilder
Also, Danny's right that job_id is
NOT NULL
with a foreign key constraint, so even if we brokewsbuilder
it still wouldn't be possible to have a build with no job.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.
Given the constraint, the change is perfectly fine 👍. I should’ve checked it myself before commenting. Sorry for the noise @dannykopping.
Uh oh!
There was an error while loading. Please reload this page.
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.
The DB schema should probably be updated to include NOT NULL on the foreign keys, though. Otherwise NULL entries are not enforced by the DB.Actually, where did you get the schema @dannykopping you referenced above? Doesn’t look the same as our dump which has NOT NULL.
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.
No worries @mafredri!
I just generated the DDL from an existing database in my IDE (GoLand). The above also has
not null
but you have to scroll over a bit to the right.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.
Haha, it was perfectly hidden by the code block size 😂.
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 know right??! Sorry about that lol