- Notifications
You must be signed in to change notification settings - Fork 4.9k
Record replication stats as part of trace #18909
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
colesnodgrass left a comment
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.
Couple recommendations, otherwise 👍🏻
| } | ||
| | ||
| private static void traceReplicationSummary(final ReplicationAttemptSummary replicationSummary) { | ||
| if (replicationSummary != null) { |
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.
Could flip this around to avoid some of this nesting:
if (replicationSummary == null) { return; } 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.
Will fix
| if (replicationSummary.getStatus() != null) { | ||
| tags.put(REPLICATION_STATUS_KEY, replicationSummary.getStatus().value()); | ||
| } | ||
| if (CollectionUtils.isNotEmpty(tags)) { |
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 not if (!tags.isEmpty()) instead of bringing in a dependency for this one method that simply delegates to calling !isEmpty anyways:
public static boolean isNotEmpty(@Nullable Collection collection) { return collection != null && !collection.isEmpty(); } As tags was created in this block of code, there isn't a chance for it being null. The null check in the isNotEmpty method is not providing anything.
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 not
if (!tags.isEmpty())instead of bringing in dependency for this one method that simply delegates to calling!isEmptyanyways:public static boolean isNotEmpty(@Nullable Collection collection) { return collection != null && !collection.isEmpty(); }As
tagswas created in this block of code, there isn't a chance for it being null. The null check in theisNotEmptymethod is not providing anything.
Will switch. I added that before I made tags not be nullable. That was the only reason for using it (avoiding a potential NPE).
* Record replication stats as part of trace * PR feedback
* Record replication stats as part of trace * PR feedback
cgardens left a comment
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.
woohoo! excited for the data this gives us make better decisions!
* Record replication stats as part of trace * PR feedback
* Record replication stats as part of trace * PR feedback
What
How
Recommended reading order
ReplicationActivityImpl.javaTests
cc: @cgardens