Skip to content

feat(coderd/database): add dbrollup service to rollup insights #12665

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 2 commits into from
Mar 22, 2024

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Mar 19, 2024

This PR adds the dbrollup service that runs the UpsertTemplateUsageStats query every 5 minutes, on the minute. This allows us to have fairly real-time data when viewing "today".

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

👍 once CI is happy

@@ -0,0 +1,127 @@
package dbrollup
Copy link
Member

Choose a reason for hiding this comment

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

I see a potential abstraction here -- the PR I'm working on in parallel #12659 has a similar logic of "run a query every interval". There are definitely other areas of the codebase that could benefit from a similar framework.

}
}

func (r *Rolluper) Close() error {
Copy link
Member

Choose a reason for hiding this comment

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

Is the error return value here to satisfy an interface? Do we need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I feel the io.Closer interface is so common it's worth using this signature even if the error is not used at the moment or ever in the future.

@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from c9fe7c5 to 46bc0f0 Compare March 20, 2024 10:25
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch 2 times, most recently from 7fc6fb5 to 91fb8e4 Compare March 20, 2024 10:37
@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from b64c291 to b3bdea2 Compare March 20, 2024 13:56
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch 3 times, most recently from 32a5d2c to e77ca25 Compare March 20, 2024 16:02
@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from df37ae9 to cafcc7b Compare March 20, 2024 19:03
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch 4 times, most recently from 28c5885 to 4374753 Compare March 20, 2024 19:43
@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from 8f207e3 to 310f545 Compare March 20, 2024 19:55
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch from 4374753 to 7145189 Compare March 20, 2024 19:55
@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from 310f545 to fc0b87c Compare March 21, 2024 15:06
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch from 7145189 to c2926ef Compare March 21, 2024 15:06
@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from fc0b87c to cba0c08 Compare March 21, 2024 17:53
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch from c2926ef to 8ccae5f Compare March 21, 2024 17:54
@mafredri mafredri force-pushed the mafredri/add-template-usage-stats-table-and-rollup-query branch from cba0c08 to 8b96a59 Compare March 22, 2024 15:40
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch from 8ccae5f to c8221f3 Compare March 22, 2024 15:40
@mafredri mafredri marked this pull request as ready for review March 22, 2024 16:21
Copy link
Member Author

mafredri commented Mar 22, 2024

Merge activity

  • Mar 22, 12:33 PM EDT: @mafredri started a stack merge that includes this pull request via Graphite.
  • Mar 22, 12:34 PM EDT: Graphite rebased this pull request as part of a merge.
  • Mar 22, 12:42 PM EDT: @mafredri merged this pull request with Graphite.

Base automatically changed from mafredri/add-template-usage-stats-table-and-rollup-query to main March 22, 2024 16:33
@mafredri mafredri force-pushed the mafredri/add-dbrollup-service-for-insights branch from c8221f3 to 2040b87 Compare March 22, 2024 16:33
@mafredri mafredri merged commit 12e6fbf into main Mar 22, 2024
@mafredri mafredri deleted the mafredri/add-dbrollup-service-for-insights branch March 22, 2024 16:42
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants