-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Progress Bar Estimate #19814
Merged
Merged
Progress Bar Estimate #19814
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
10aaa8c
Add all the required interface methods for message tracking.
davinchia 63436da
Slight reformat.
davinchia b86fdf3
Minor refactor of the AirbyteMessageUtils and the AirbyteMessageTrack…
davinchia 6dee0fd
Make test literals variables.
davinchia ea43a2d
Add javadocs.
davinchia 2effea7
Add logic to distinguish between SYNC and STREAM messages/
davinchia 3dfefc7
Update message utils to reflect STREAM vs SYNC estimates.
davinchia 8cf5dde
Add tests to clarify stream and sync estimate behavior.
davinchia 8117afa
Format and add more tests.
davinchia d2b3e52
Merge branch 'master' into davinchia/progress-bar-estimate
davinchia 225f541
Respond to PR feedback.
davinchia ace577f
Use the StreamStats POJO instead of creating new maps.
davinchia ca082fe
Use the StreamStats POJO instead of creating new maps.
davinchia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
import com.google.common.collect.ImmutableMap; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.protocol.models.AirbyteErrorTraceMessage; | ||
import io.airbyte.protocol.models.AirbyteEstimateTraceMessage; | ||
import io.airbyte.protocol.models.AirbyteGlobalState; | ||
import io.airbyte.protocol.models.AirbyteLogMessage; | ||
import io.airbyte.protocol.models.AirbyteMessage; | ||
|
@@ -102,29 +103,60 @@ public static AirbyteStreamState createStreamState(final String streamName) { | |
return new AirbyteStreamState().withStreamDescriptor(new StreamDescriptor().withName(streamName)); | ||
} | ||
|
||
public static AirbyteMessage createStreamEstimateMessage(final String name, final String namespace, final long byteEst, final long rowEst) { | ||
return createEstimateMessage(AirbyteEstimateTraceMessage.Type.STREAM, name, namespace, byteEst, rowEst); | ||
} | ||
|
||
public static AirbyteMessage createSyncEstimateMessage(final long byteEst, final long rowEst) { | ||
return createEstimateMessage(AirbyteEstimateTraceMessage.Type.SYNC, null, null, byteEst, rowEst); | ||
} | ||
|
||
public static AirbyteMessage createEstimateMessage(AirbyteEstimateTraceMessage.Type type, | ||
final String name, | ||
final String namespace, | ||
final long byteEst, | ||
final long rowEst) { | ||
final var est = new AirbyteEstimateTraceMessage() | ||
.withType(type) | ||
.withByteEstimate(byteEst) | ||
.withRowEstimate(rowEst); | ||
|
||
if (name != null) { | ||
est.withName(name); | ||
} | ||
if (namespace != null) { | ||
est.withNamespace(namespace); | ||
} | ||
|
||
return new AirbyteMessage() | ||
.withType(Type.TRACE) | ||
.withTrace(new AirbyteTraceMessage().withType(AirbyteTraceMessage.Type.ESTIMATE) | ||
.withEstimate(est)); | ||
} | ||
|
||
public static AirbyteMessage createErrorMessage(final String message, final Double emittedAt) { | ||
return new AirbyteMessage() | ||
.withType(AirbyteMessage.Type.TRACE) | ||
.withTrace(createErrorTraceMessage(message, emittedAt)); | ||
} | ||
|
||
public static AirbyteTraceMessage createErrorTraceMessage(final String message, final Double emittedAt) { | ||
return new AirbyteTraceMessage() | ||
.withType(io.airbyte.protocol.models.AirbyteTraceMessage.Type.ERROR) | ||
.withEmittedAt(emittedAt) | ||
.withError(new AirbyteErrorTraceMessage().withMessage(message)); | ||
return createErrorTraceMessage(message, emittedAt, null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consolidate the various trace message creation into one function to avoid duplication. |
||
} | ||
|
||
public static AirbyteTraceMessage createErrorTraceMessage(final String message, | ||
final Double emittedAt, | ||
final AirbyteErrorTraceMessage.FailureType failureType) { | ||
return new AirbyteTraceMessage() | ||
final var msg = new AirbyteTraceMessage() | ||
.withType(io.airbyte.protocol.models.AirbyteTraceMessage.Type.ERROR) | ||
.withEmittedAt(emittedAt) | ||
.withError(new AirbyteErrorTraceMessage().withMessage(message).withFailureType(failureType)); | ||
} | ||
.withError(new AirbyteErrorTraceMessage().withMessage(message)) | ||
.withEmittedAt(emittedAt); | ||
|
||
public static AirbyteMessage createTraceMessage(final String message, final Double emittedAt) { | ||
return new AirbyteMessage() | ||
.withType(AirbyteMessage.Type.TRACE) | ||
.withTrace(new AirbyteTraceMessage() | ||
.withType(AirbyteTraceMessage.Type.ERROR) | ||
.withEmittedAt(emittedAt) | ||
.withError(new AirbyteErrorTraceMessage().withMessage(message))); | ||
if (failureType != null) { | ||
msg.getError().withFailureType(failureType); | ||
} | ||
|
||
return msg; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like we are adding a new concept of Sync vs Stream, instead, would it make sense to use STREAM vs GLOBAL?
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'm following from the AirbyteTraceEstimateMessage type. Slight preference to keep the names consistent though happy to change the name within this file to Global.
With the AirbyteTraceEstiamteMessage, I do think STREAM vs SYNC are decent names for now.
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 am thinking about consistency for the near future, Sync feels very coupled to how we current run the replication. For STREAM, I think we want to modify our current replication model to be able to replicate data at stream level rather than connection. If we are running per stream replication in parallel, Sync mode for progress looks outdated.
It probably feels more like future-proofing, I don't have reasons to feel strongly either way at this moment.
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.
Agree with your thoughts. Honestly, not 100% how the stream-as-first-class citizen refactor will play with CDC w.r.t the stats here.
In that case, I'm guessing we will be able to do away with the SYNC field. I'm inclined to keep this as is for now and revisit when we cross that. How does that sound?
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.
Sounds good to me, conceptually, I think we are tracking the right way, we can address the naming later on.