-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-29567][connector/common] Change numRecordsSend / numBytesSend / numRecordsSendError back to numRecordsOut / numBytesOut / numRecordsOutError in sink #21065
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -71,10 +71,10 @@ public abstract class AsyncSinkWriter<InputT, RequestEntryT extends Serializable | |
| private final SinkWriterMetricGroup metrics; | ||
|
|
||
| /* Counter for number of bytes this sink has attempted to send to the destination. */ | ||
| private final Counter numBytesSendCounter; | ||
| private final Counter numBytesOutCounter; | ||
|
|
||
| /* Counter for number of records this sink has attempted to send to the destination. */ | ||
| private final Counter numRecordsSendCounter; | ||
|
Contributor
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. The decision was to point both |
||
| private final Counter numRecordsOutCounter; | ||
|
|
||
| private final RateLimitingStrategy rateLimitingStrategy; | ||
|
|
||
|
|
@@ -292,8 +292,8 @@ public AsyncSinkWriter( | |
|
|
||
| this.metrics = context.metricGroup(); | ||
| this.metrics.setCurrentSendTimeGauge(() -> this.ackTime - this.lastSendTimestamp); | ||
| this.numBytesSendCounter = this.metrics.getNumBytesSendCounter(); | ||
| this.numRecordsSendCounter = this.metrics.getNumRecordsSendCounter(); | ||
| this.numBytesOutCounter = this.metrics.getIOMetricGroup().getNumBytesOutCounter(); | ||
| this.numRecordsOutCounter = this.metrics.getIOMetricGroup().getNumRecordsOutCounter(); | ||
|
|
||
| this.fatalExceptionCons = | ||
| exception -> | ||
|
|
@@ -410,8 +410,8 @@ private List<RequestEntryT> createNextAvailableBatch(RequestInfo requestInfo) { | |
| batchSizeBytes += requestEntrySize; | ||
| } | ||
|
|
||
| numRecordsSendCounter.inc(batch.size()); | ||
| numBytesSendCounter.inc(batchSizeBytes); | ||
| numRecordsOutCounter.inc(batch.size()); | ||
| numBytesOutCounter.inc(batchSizeBytes); | ||
|
|
||
| return batch; | ||
| } | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Why remove it?
numRecordsOutErrorsCounteris deprecated but still contains the errors counter.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.
numRecordsSendandnumRecordsSendErrorsare registered inInternalSinkWriterMetricGroupusing the same counter ofnumRecordsOutandnumRecordsOutErrors, in order to make these metrics having the same value. Thus we only need to keep one counter in the sink writer implementation.Uh oh!
There was an error while loading. Please reload this page.
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.
They are using different counters:
flink/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/InternalSinkWriterMetricGroup.java
Line 48 in 1902699
BTW, removing it breaks the backward compatibility with 1.15.x too.
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've also modified
InternalSinkWriterMetricGroupto make these two metrics share the same counter:https://github.com/apache/flink/pull/21065/files#diff-6ecdbb02f8667509442f88d7d251838f6388b0919df9390867f987bcc6423678R46-R48
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.
That is what I tried to explain. The consensus we have in the discussion is to modify
numXXXOutCounterto have the same count number asnumXXXSendErrorsinstead of reverting the change we did withnumXXXSendErrors.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 not sure if I understand your argument. Please correct me if I'm wrong.
Firstly, we need to keep only one counter variable (no matter
sendCounteroroutCounter) in sink writer implementations, as these two variables are pointing to the same underlying counter actually, andInternalSinkWriterMetricGroupregisters the underlying counter twice in the registry with two different metric namesoutandsend. Keeping two variables and increasing both of them will finally count twice towards the same underlying counter.Then about which variable to remove. I think what we are arguing with is just the name of the variable in sink writer's implementation. From the user's perspective, the result is the same no matter whether the variable name is
sendCounteroroutCounterorfooCounter: the sink will register two metricsnumXXXSendandnumXXXOuthaving the same value. I think it's better to respect the original definition in FLIP-33 to useoutto name variables for consistency.