- Notifications
You must be signed in to change notification settings - Fork563
fix: log all API requests not just RPC ones#21102
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
base:3.6
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This updates the root HTTP Mux that we use, so that every connection ends upbeing logged. Our current system only creates a ConnectionID for RPC connectionsthat are upgraded from raw HTTP connections. That means we weren't logginganything for connections to '/log' or '/offerdispatch', etc.To make these connections traceable, I just use the underlying socket filedescriptor. Which does have the nice property that it matches your lsof output.
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.
Works as expected.
| // Hide the fact that the model does not exist. | ||
| returnnil,errors.Unauthorizedf("invalid entity name or password") | ||
| } | ||
| // TODO(wallyworld) - we can't yet observe anonymous logins as entity must be non-nil |
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.
question: is this todo still valid?
| p:pat.New(), | ||
| added:make(map[string][]patternHandler), | ||
| // TODO(jam): 2025-11-03 We could make the logger a muxOption instead | ||
| logger:loggo.GetLoggerWithLabels("juju.apiserver.http","api"), |
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.
todo: make "api" a const incore/logger/labels.go.
Requires a doc update as well,manage-logs.md
This updates the root HTTP Mux that we use, so that every connection ends up being logged. Our current system only creates a ConnectionID for RPC connections that are upgraded from raw HTTP connections. That means we weren't logging anything for connections to '/log' or '/offerdispatch', etc.
To make these connections traceable, I just use the underlying socket file descriptor. Which does have the nice property that it matches your lsof output.
Checklist
QA steps
$ juju bootstrap lxd src36$ juju add-modeltest$ juju deploy juju-qa-testThen in debug-log you should see:
Documentation changes
We could document the juju.apiserver.http log matcher, but it will also show up when you just DEBUG log the regular juju.apiserver key.
Links
None