-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further simplify metrics tracker. (#19988)
Follow up from ##19814, where we introduced the StreamStats object to consolidate/simplify some of the stats memory objects. In this PR, we extend the StreamStats object to also include the emitted records and bytes. - Make StreamStats into a proper object. We cannot use a record as record fields are immutable. We need mutable fields to count. - Consolidate the emitted records into StreamStats. - Take the chance to move all the stats/metrics related classes into a book_keeping package to keep things clean.
- Loading branch information
Showing
13 changed files
with
99 additions
and
43 deletions.
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
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
50 changes: 50 additions & 0 deletions
50
...te-commons-worker/src/main/java/io/airbyte/workers/internal/book_keeping/StreamStats.java
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.workers.internal.book_keeping; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* POJO for all per-stream stats. | ||
* <p> | ||
* We are not able to use a {@link Record} since we want non-final fields to accumulate counts. | ||
*/ | ||
public class StreamStats { | ||
|
||
public long estimatedRecords; | ||
public long estimatedBytes; | ||
public long emittedRecords; | ||
public long emittedBytes; | ||
|
||
public StreamStats() { | ||
this(0L, 0L, 0L, 0L); | ||
} | ||
|
||
public StreamStats(final long estimatedBytes, final long emittedBytes, final long estimatedRecords, final long emittedRecords) { | ||
this.estimatedRecords = estimatedRecords; | ||
this.estimatedBytes = estimatedBytes; | ||
this.emittedRecords = emittedRecords; | ||
this.emittedBytes = emittedBytes; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
final StreamStats that = (StreamStats) o; | ||
return estimatedRecords == that.estimatedRecords && estimatedBytes == that.estimatedBytes && emittedRecords == that.emittedRecords | ||
&& emittedBytes == that.emittedBytes; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(estimatedRecords, estimatedBytes, emittedRecords, emittedBytes); | ||
} | ||
|
||
} |
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
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
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