-
Notifications
You must be signed in to change notification settings - Fork 0
Log prefix updates for CASSJAVA-97 (request traceability) #3
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
… distinct entity (which keeps support for session names configured in the config) and (2) makes the request ID scoped by CqlRequestHandler.
The current impl appears to work (in very limited testing). Using this code and this config:
I'm getting log messages such as the following:
I want to try a few other changes to see if I can clean up the API a bit but hopefully this conveys the general idea. |
Bah, API changes didn't exactly work out. I thought there might be some way to cleanly create a LogPrefix object which encapsulated the policies around log prefixes within a given space... but that doesn't come out as cleanly as one might like. Going with this for now... we can revise in the future if need be. |
Oh, and while we're on the topic of future things... it prolly makes sense to move away from log prefixes like we're using now and towards a purer notion of something like structured logging. The Go folks certainly seem to like it and this "session ID|handler ID|execution count?" usage is doing something very similar already (albeit with a custom format). There's already some notion of support for this in logback, although we may have to flesh it out a bit. |
Oh, and for the record... my local "request-traceability" branch corresponds to the branch used to create the PR at this commit. |
Can we make both methods of |
*/ | ||
String getNodeRequestId( | ||
@NonNull Request statement, @NonNull String sessionRequestId, int executionCount); | ||
String getRequestId(@NonNull Request statement, @NonNull String parentId); |
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.
Why do we want to use the term "parent ID" and "request ID"?
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.
apache#2037
Bret agreed to keep consistent with C# driver
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.
But Bret wants getSessionId
and getNodeId
, and preferably getRequestId
and getMessageId
.
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 think getSessionId
and getNodeId
will be very confusing because users will expect sessionid
as the name of the CqlSession
, like s0
, and nodeId
as the host ID.
Re: getRequestId
and getMessageId
, they won't be consistent with our RequestTracker
interface, e.g. onError
and onNodeError
.
I think sessionRequestId
and nodeRequestId
are still largely consistent with onError
and onNodeError
than requestId
and messageId
*/ | ||
String getNodeRequestId( | ||
@NonNull Request statement, @NonNull String sessionRequestId, int executionCount); | ||
String getRequestId(@NonNull Request statement, @NonNull String parentId); |
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.
apache#2037
Bret agreed to keep consistent with C# driver
: sessionLogPrefix + "|" + this.hashCode(); | ||
LOG.trace("[{}] Creating new handler for request {}", logPrefix, statement); | ||
this.sessionName = sessionName; | ||
this.sessionId = |
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.
sessionId
will be confusing because it sounds like the id of the session (e.g. s0
) instead of the id of the request. Maybe sessionRequestId
*/ | ||
String getNodeRequestId( | ||
@NonNull Request statement, @NonNull String sessionRequestId, int executionCount); | ||
String getRequestId(@NonNull Request statement, @NonNull String parentId); |
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.
But Bret wants getSessionId
and getNodeId
, and preferably getRequestId
and getMessageId
.
*/ | ||
String getNodeRequestId( | ||
@NonNull Request statement, @NonNull String sessionRequestId, int executionCount); | ||
String getRequestId(@NonNull Request statement, @NonNull String parentId); |
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 think getSessionId
and getNodeId
will be very confusing because users will expect sessionid
as the name of the CqlSession
, like s0
, and nodeId
as the host ID.
Re: getRequestId
and getMessageId
, they won't be consistent with our RequestTracker
interface, e.g. onError
and onNodeError
.
I think sessionRequestId
and nodeRequestId
are still largely consistent with onError
and onNodeError
than requestId
and messageId
@SiyaoIsHiding and I talked about this pretty extensively in a meeting today. Our plan going forward is to merge this PR into @SiyaoIsHiding 's PR for CASSJAVA-97 and pick up the naming conversation(s) there. I definitely want to keep questions around naming consolidated in one place and this PR isn't ideal for that. The primary point for this PR was to demonstrate that log prefix and request ID aren't the same thing and that we need to keep the logic for each separate. That goal seems to be accomplished (and seems to be relatively uncontroversial) so the simplest path forward was to get that change in and then move on to any questions around params/naming. |
This PR has now been merged into the main PR for CASSJAVA-97. We'll continue any outstanding discussions on that PR. |
This PR represents a proposal to update the implementation of log prefix in the current PR for CASSJAVA-97. Specifically I'm aiming to address two distinct goals: