Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: reduce impact of GetPrebuildMetrics on database#19694

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cstyan merged 3 commits intomainfromcallum/prebuild-metrics-query
Sep 4, 2025

Conversation

cstyan
Copy link
Contributor

seecoder/internal#959 but the tl; dr is:

  • we call this DB query on an interval (every 15s) and it would be called on each coderd replica as well
  • the generated values update very infrequently (for our most used internal template I saw the builds created/claimed update twice in a 1h period)
  • we have no index on the initiator ID, so this query has to scan the entire workspace_builds table on every request

In reality this should likely just be a Prometheus metric, and Prometheus can handle the counter reset behaviour at query time, but for now this should at least cut the load of the query to 25% of it's current impact.

Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

LGTM 👍

It'd be helpful to share query analyses to justify this change either in this PR's description or in the linked issue.


As an aside: I wonder why we don't have an FK frominitiator_id tousers onworkspace_builds. I checked in dogfood and there aren't any records where aninitiator_id does not match ausers id.

Likewise forprovisioner_jobs.

@cstyan
Copy link
ContributorAuthor

I added some additional details to the linked issue 👍

Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyancstyanforce-pushed thecallum/prebuild-metrics-query branch from570880f to6c9ad14CompareSeptember 4, 2025 20:23
Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyancstyan merged commit0ec9df3 intomainSep 4, 2025
26 checks passed
@cstyancstyan deleted the callum/prebuild-metrics-query branchSeptember 4, 2025 20:43
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 4, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

Assignees

@cstyancstyan

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@cstyan@dannykopping

[8]ページ先頭

©2009-2025 Movatter.jp