- Notifications
You must be signed in to change notification settings - Fork1.1k
chore: populate connectionlog count using a separate query#18629
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ethanndickson commentedJun 27, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
ed8e139 to8cec6d1Comparea031154 tod03fe73Compare8cec6d1 to482a5d3Compared03fe73 to8cbd44aCompare482a5d3 toccc7539Compare8cbd44a to09cbe49Compare This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
kacpersaw left a comment
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.
LGTM - similar to my PR#18600
ccc7539 to406e3f4Compare713ca71 to33d8acbCompare33d8acb to1e3334bCompare88bf416 tocd30512Compare1e3334b to332f8daComparecd30512 to3a8822dCompare332f8da to6cd9d68Compare3a8822d to02a93e0Compare6cd9d68 to6fa4d22Compare02a93e0 to2231707Compare769b7a5 tofc195c3CompareThere 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.
Pull Request Overview
This PR adds support for returning the total count of connection logs alongside paginated results by issuing a separate COUNT query.
- API handler is updated to fetch and return
CountinConnectionLogResponse, with early exit on zero count. searchquery.ConnectionLogsnow returns a count filter, and corresponding tests are updated.- New SQL query, querier methods, authz, metrics, and tests are added to support
CountConnectionLogs.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| enterprise/coderd/connectionlog.go | CallCountConnectionLogs, early exit on zero, include count. |
| enterprise/coderd/connectionlog_test.go | Updated tests to assertlogs.Count for various scenarios. |
| coderd/searchquery/search.go & coderd/searchquery/search_test.go | ConnectionLogs now returnscountFilter; tests updated. |
| coderd/database/queries/connectionlogs.sql & queries.sql.go | AddedCountConnectionLogs SQL and generated Go code. |
| coderd/database/querier.go & coderd/database/querier_test.go | AddedCountConnectionLogs andCountAuthorizedConnectionLogs with tests. |
| coderd/database/dbmock/dbmock.go | Mock methods forCountConnectionLogs andCountAuthorizedConnectionLogs. |
| coderd/database/dbmetrics/querymetrics.go | Metrics wrappers for the new count methods. |
| coderd/database/dbauthz/*.go & setup_test.go & dbauthz_test.go | Authorization logic and tests for counting connection logs. |
Comments suppressed due to low confidence (1)
coderd/searchquery/search_test.go:430
- [nitpick] The variable name
valuesis ambiguous in this context. Consider renaming it to something likefilterParamsoroffsetParamsto clarify it holds the parameters for the offset query.
})Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
2231707 to133e51dComparefc195c3 todf2d839Compare133e51d tob8faf73Comparedf2d839 to78cc56bCompareb8faf73 to3ec1f06Compare78cc56b toe61fc41Compare3ec1f06 toc013e9fComparee61fc41 to4055dd7Compareethanndickson commentedJul 15, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Merge activity
|
4055dd7 toe10a5cfCompare7c077d3 intomainUh oh!
There was an error while loading.Please reload this page.

Uh oh!
There was an error while loading.Please reload this page.
This is the third PR for moving connection events out of the audit log.
This PR populates
countonConnectionLogResponseusing a separate query, to preemptively mitigate the issue described in#17689. It's structurally identical to a portion of#18600, but for the connection log instead of the audit log.Future PRs: