Skip to content
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

Fix: Improve alignment with Airbyte Cloud on data sizes and MB/s #369

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions airbyte/_connector_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,32 @@ def _execute(
# Fail early if the connector is not installed.
self.executor.ensure_installation(auto_fix=False)

# When calculating MB read, we need to account for the envelope size.
# Note our priority is to keep performance up, while providing at least rough
# alignment with comparable metrics in Airbyte Cloud.
envelope_size = len(
json.dumps(
{
"type": "RECORD",
"record": {
"stream": "",
"data": {},
"emitted_at": 1234567890,
# "namespace": "", # We're knowingly omitting this to keep perf impact low.
},
}
)
)

try:
for line in self.executor.execute(args, stdin=stdin):
try:
message: AirbyteMessage = AirbyteMessage.model_validate_json(json_data=line)
if progress_tracker and message.record:
stream_name = message.record.stream
progress_tracker.tally_bytes_read(
len(line),
stream_name=message.record.stream,
bytes_read=len(line) - envelope_size - len(stream_name),
stream_name=stream_name,
)
self._peek_airbyte_message(message)
yield message
Expand Down
Loading