- Notifications
You must be signed in to change notification settings - Fork1k
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
to8cec6d1
Comparea031154
tod03fe73
Compare8cec6d1
to482a5d3
Compared03fe73
to8cbd44a
Compare482a5d3
toccc7539
Compare8cbd44a
to09cbe49
Compare 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.
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
to406e3f4
Compare713ca71
to33d8acb
Compare33d8acb
to1e3334b
Compare88bf416
tocd30512
Compare1e3334b
to332f8da
Comparecd30512
to3a8822d
Compare332f8da
to6cd9d68
Compare3a8822d
to02a93e0
Compare6cd9d68
to6fa4d22
Compare02a93e0
to2231707
Compare769b7a5
tofc195c3
CompareThere 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
Count
inConnectionLogResponse
, with early exit on zero count. searchquery.ConnectionLogs
now 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
values
is ambiguous in this context. Consider renaming it to something likefilterParams
oroffsetParams
to 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
to133e51d
Comparefc195c3
todf2d839
Compare133e51d
tob8faf73
Comparedf2d839
to78cc56b
Compareb8faf73
to3ec1f06
Compare78cc56b
toe61fc41
Compare3ec1f06
toc013e9f
Comparee61fc41
to4055dd7
Compareethanndickson 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
toe10a5cf
Compare7c077d3
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
count
onConnectionLogResponse
using 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: