-
Notifications
You must be signed in to change notification settings - Fork 943
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ed8e139
to
8cec6d1
Compare
a031154
to
d03fe73
Compare
8cec6d1
to
482a5d3
Compare
d03fe73
to
8cbd44a
Compare
482a5d3
to
ccc7539
Compare
8cbd44a
to
09cbe49
Compare
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
to
406e3f4
Compare
713ca71
to
33d8acb
Compare
33d8acb
to
1e3334b
Compare
88bf416
to
cd30512
Compare
1e3334b
to
332f8da
Compare
cd30512
to
3a8822d
Compare
332f8da
to
6cd9d68
Compare
3a8822d
to
02a93e0
Compare
6cd9d68
to
6fa4d22
Compare
02a93e0
to
2231707
Compare
769b7a5
to
fc195c3
Compare
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.
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 | Call CountConnectionLogs , early exit on zero, include count. |
enterprise/coderd/connectionlog_test.go | Updated tests to assert logs.Count for various scenarios. |
coderd/searchquery/search.go & coderd/searchquery/search_test.go | ConnectionLogs now returns countFilter ; tests updated. |
coderd/database/queries/connectionlogs.sql & queries.sql.go | Added CountConnectionLogs SQL and generated Go code. |
coderd/database/querier.go & coderd/database/querier_test.go | Added CountConnectionLogs and CountAuthorizedConnectionLogs with tests. |
coderd/database/dbmock/dbmock.go | Mock methods for CountConnectionLogs and CountAuthorizedConnectionLogs . |
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.
})
2231707
to
133e51d
Compare
fc195c3
to
df2d839
Compare
133e51d
to
b8faf73
Compare
df2d839
to
78cc56b
Compare
b8faf73
to
3ec1f06
Compare
78cc56b
to
e61fc41
Compare
3ec1f06
to
c013e9f
Compare
e61fc41
to
4055dd7
Compare
Merge activity
|
4055dd7
to
e10a5cf
Compare
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: