Skip to content

Conversation

@jdpgrailsdev
Copy link
Contributor

What

  • Improve visibility into replication syncs

How

  • Record the number of bytes/records synced with each trace to improve visibility into performance of replication.

Recommended reading order

  1. ReplicationActivityImpl.java

Tests

  • Project builds locally
  • All tests pass

cc: @cgardens

@github-actions github-actions bot added area/platform issues related to the platform area/worker Related to worker labels Nov 3, 2022
@jdpgrailsdev jdpgrailsdev temporarily deployed to more-secrets November 3, 2022 14:32 Inactive
@jdpgrailsdev jdpgrailsdev temporarily deployed to more-secrets November 3, 2022 15:03 Inactive
Copy link
Member

@colesnodgrass colesnodgrass left a 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) {
Copy link
Member

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; } 
Copy link
Contributor Author

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)) {
Copy link
Member

@colesnodgrass colesnodgrass Nov 3, 2022

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.

Copy link
Contributor Author

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 !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.

Will switch. I added that before I made tags not be nullable. That was the only reason for using it (avoiding a potential NPE).

@jdpgrailsdev jdpgrailsdev temporarily deployed to more-secrets November 3, 2022 16:01 Inactive
@jdpgrailsdev jdpgrailsdev merged commit 9777797 into master Nov 3, 2022
@jdpgrailsdev jdpgrailsdev deleted the jonathan/replication-stats-apm-trace branch November 3, 2022 16:04
girarda pushed a commit that referenced this pull request Nov 3, 2022
* Record replication stats as part of trace * PR feedback
girarda pushed a commit that referenced this pull request Nov 3, 2022
* Record replication stats as part of trace * PR feedback
Copy link
Contributor

@cgardens cgardens left a 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!

mlavoie-sm360 pushed a commit to mlavoie-sm360/airbyte that referenced this pull request Nov 8, 2022
* Record replication stats as part of trace * PR feedback
mlavoie-sm360 pushed a commit to mlavoie-sm360/airbyte that referenced this pull request Nov 8, 2022
* Record replication stats as part of trace * PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform issues related to the platform area/worker Related to worker

4 participants