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

refactor: remove logging for every pull query MINOR #3736

Closed
wants to merge 2 commits into from

Conversation

vpapavas
Copy link
Member

@vpapavas vpapavas commented Nov 4, 2019

Description

Fixes #3672
Remove logging at info level for every pull query. It floods the server.
Logging is done for errors already so that can be used for debugging.

Testing done

Describe the testing strategy. Unit and integration tests are expected for any behavior changes.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@vpapavas vpapavas requested a review from a team as a code owner November 4, 2019 19:24
@ghost
Copy link

ghost commented Nov 4, 2019

@confluentinc It looks like @vpapavas just signed our Contributor License Agreement. 👍

Always at your service,

clabot

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't this affect all queries, not just pull query logging? I feel like this log is useful at some level to know what we've been receiving.

Even for pull queries, I think we should be logging this (perhaps on a different logger). For previous projects*, we'd log all requests including a traceID, the time, the duration, the issuer etc... to help not only debug bad queries, but identify classes of queries that were problematic. I think we should consider doing something like that for pull queries (and it doubles as a primitive audit log). cc @vinothchandar

* the project was a search system handling hundreds of QPS, and the logs would roll on an hourly basis and be cleaned up after 7 days

@agavra agavra requested a review from a team November 4, 2019 19:40
Copy link
Contributor

@vinothchandar vinothchandar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess it's subjective. I prefer not to log every request unless 'interesting' things (errors, asserts failing) happen on them. +1 on having a separate log though, it will flood the ksql-server log completely otherwise.

That said, may be we can file a separate issue for that? For now, we probably just want to avoid logging per request.

@@ -195,7 +195,6 @@ public Response handleKsqlStatements(
@Context final ServiceContext serviceContext,
final KsqlRequest request
) {
LOG.info("Received: " + request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we introduce a log statement somewhere (say where we check for isStatic) that logs the sql statement? That way for non pull queries you still have similar log statement (which i guess would be useful)

@agavra
Copy link
Contributor

agavra commented Nov 4, 2019

That said, may be we can file a separate issue for that? For now, we probably just want to avoid logging per request.

+1 I'll file a ticket for that

EDIT: #3741 - I assigned it to @vinothchandar, but feel free to hot potato it.

@@ -108,6 +109,11 @@ public int validate(
final ConfiguredStatement<?> configured = ConfiguredStatement.of(
prepared, scopedPropertyOverrides, ksqlConfig);

final Class<? extends Statement> statementClass = prepared.getStatement().getClass();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will #3742 solve the need for this PR? after looking at this patch, it seems very out of place to have this in the validator!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still have to discuss that and I expect we will hash it out over the next week or so. So may not have time to land before the release cut. In this scenario, its better to have some fix landed first and then iterate? We should make a note and undo these bandaids +1 on that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, #3742 solve the need for this PR. I added the check in the validator because PR #3711 also requires this check and I didn't want to do it twice.

@rodesai
Copy link
Contributor

rodesai commented Nov 5, 2019

Why are we removing the log msg altogether? We could just as well of at a more verbose level. If the cost of generating the message is a concern, we can log using the format string interfaces to avoid toString on every call.

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock the release, please get one more +1 since this is semi-controversial despite being such a small change 😂 - make sure to rebase this on 5.4.x, and also please add a ticket to move this back after #3742

@rodesai - I think the concern is not performance but spamming the log. I wanted to have the log at INFO level even for normal operation for persistent queries, it's pretty useful to debug things, but it makes sense to have it at DEBUG for pull queries.

@agavra agavra requested review from rodesai and a team November 5, 2019 16:48
@vinothchandar
Copy link
Contributor

The root issue is introducing this statement in the hot path for pull queries. We can also simply remove this for now and think about it in #3741 .. @big-andy-coates can you please chime in here? Are you okay with not having this log statement for now?

Copy link
Contributor

@big-andy-coates big-andy-coates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the pull queries over to the /query end point will fix this issue. We shouldn't commit this change.

@vinothchandar
Copy link
Contributor

@big-andy-coates its not clear to me yet, if the switch to /query is targeted for next week? Can we just disable the log statement or move it to DEBUG for now and remove special casing like I mentioned before? We make move it back to INFO once pull queries are off this end point..

@vpapavas vpapavas changed the title feat: remove logging for every pull query MINOR refactor: remove logging for every pull query MINOR Nov 6, 2019
@vinothchandar
Copy link
Contributor

@big-andy-coates any updates? I am leaning towards simplifying this PR to just remove/change level for the log statement and merge, while we figure out the timelines for moving to /query.

@apurvam
Copy link
Contributor

apurvam commented Nov 8, 2019

I think at this point, we should not be moving functionality to the /query endpoint right now for the following reasons:

  1. I think we will have to re think the API any way and moving pull queries to the /query endpoint is likely not the final state.
  2. having chunked and non-chunked responses in the same endpoint directly jeopardizes the work on grafana integration which is underway to enable an internal use case on KSQL. (see InfluxDB: take advantage of influx chunked reponses grafana/grafana#863)

@vchandar @vicky please feel free to merge your PR and get unblocked. Let’s not pursue any parallel tracks of work to move pull query functionality into the /query endpoint right now. We can think of a redesign of the API to account for the new query types as a separate track of work afterwards. We know we are going to make a bunch of breaking changes, and this can be part of the batch.

@vpapavas
Copy link
Member Author

Closing this PR since pull queries moved to the /query endpoint that does not do logging.

@vpapavas vpapavas closed this Nov 14, 2019
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.

Avoid logging every pull query in INFO level
6 participants