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

ref: A better commit log format pt2 #290

Merged
merged 2 commits into from
Sep 29, 2023
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
18 changes: 9 additions & 9 deletions arroyo/backends/kafka/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class CommitCodec(Codec[KafkaPayload, Commit]):
def encode(self, value: Commit) -> KafkaPayload:
assert value.orig_message_ts is not None

payload = json.dumps(
{
"offset": value.offset,
"orig_message_ts": datetime.timestamp(value.orig_message_ts),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for the alerts e2e SLO ?

Copy link
Member Author

@lynnagara lynnagara Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, this is the same information that was already there, just in a float format and in the body not the header now so we don't need to do the custom decoding dance

}
).encode("utf-8")

return KafkaPayload(
f"{value.partition.topic.name}:{value.partition.index}:{value.group}".encode(
"utf-8"
),
f"{value.offset}".encode("utf-8"),
[
(
"orig_message_ts",
datetime.strftime(value.orig_message_ts, DATETIME_FORMAT).encode(
"utf-8"
),
)
],
payload,
[],
)

def decode_legacy(self, value: KafkaPayload) -> Commit:
Expand Down
Loading