Skip to content
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

Merged
merged 2 commits into from
Aug 30, 2021

Conversation

williamhbaker
Copy link
Contributor

Closes #22071

Adds a flag --flux-log-enabled which when active will show detailed logs for flux queries.


}

func (h *FluxHandler) logFluxQuery(n int64, stats flux.Statistics, compiler lang.FluxCompiler, err error) {
Copy link
Contributor Author

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:

func (h *Handler) logFluxQuery(n int64, stats flux.Statistics, compiler flux.Compiler, err error) {


// Detailed logging for flux queries if enabled
if h.FluxLogEnabled {
c, ok := req.Request.Compiler.(lang.FluxCompiler)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable flux logs on 2.x
2 participants