-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: add --flux-log-enabled
flag for detailed flux logs
#22072
Conversation
http/query_handler.go
Outdated
|
||
} | ||
|
||
func (h *FluxHandler) logFluxQuery(n int64, stats flux.Statistics, compiler lang.FluxCompiler, err error) { |
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.
Very nearly a 1:1 copy of the equivalent 1.x code, see:
influxdb/services/httpd/handler.go
Line 1442 in 444c22b
func (h *Handler) logFluxQuery(n int64, stats flux.Statistics, compiler flux.Compiler, err error) { |
http/query_handler.go
Outdated
|
||
// Detailed logging for flux queries if enabled | ||
if h.FluxLogEnabled { | ||
c, ok := req.Request.Compiler.(lang.FluxCompiler) |
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.
I don't think we need this type assertion?
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.
I needed to get the interface into the lang.FluxCompiler
struct to access the Query
property in the logFluxQuery
method.
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.
instead of logging an error, could we just set the query string as 'unknown' if Compiler
doesn't havea Query
accessor?
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.
Pushed a change along those lines...still has the type assertion but will set the query string to 'unknown' if for some reason the underlying type of Compiler
isn't a lang.FluxCompiler
. This is now more similar 1.x logging function, which uses a type switch. An assertion seems to make more sense, since there is only the one type that we expect for this.
c0d8d7f
to
370d9bf
Compare
Closes #22071
Adds a flag
--flux-log-enabled
which when active will show detailed logs for flux queries.