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(kafka): fix kafka timestamps sent from application #4709

Merged
merged 5 commits into from
May 23, 2024

Conversation

lsampras
Copy link
Member

@lsampras lsampras commented May 20, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

fixes #4706

Convert secs to millis when sending creation timestamp to kafka

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

  • This will fix problems encountered down the pipeline with data retention

How did you test it?

  • the timestamp listed in kafka-ui
  • can't be tested without infra access and no visible changes on UI

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@lsampras lsampras added A-framework Area: Framework C-bug Category: Bug A-Analytics labels May 20, 2024
@lsampras lsampras self-assigned this May 20, 2024
@lsampras lsampras requested review from a team as code owners May 20, 2024 14:16
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

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

Should we consider adding an extension trait if we'll use Unix timestamps in milliseconds frequently?

trait OffsetDateTimeExt {
    fn unix_timestamp_millis(self) -> i128;
}

impl OffsetDateTimeExt for time::OffsetDateTime {
    fn unix_timestamp_millis(self) -> i128 {
        self.unix_timestamp_nanos() / 1_000_000
    }
}

@lsampras
Copy link
Member Author

Should we consider adding an extension trait if we'll use Unix timestamps in milliseconds frequently?

trait OffsetDateTimeExt {
    fn unix_timestamp_millis(self) -> i128;
}

impl OffsetDateTimeExt for time::OffsetDateTime {
    fn unix_timestamp_millis(self) -> i128 {
        self.unix_timestamp_nanos() / 1_000_000
    }
}

This conversion to timestamp millis is specific to kafka and would be abstracted away soon....
I'd rather the individual events provide me the PrimitiveDateTime/OffsetDateTime & kafka assumes it's representation

ivor-juspay
ivor-juspay previously approved these changes May 21, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue May 23, 2024
Merged via the queue into main with commit c778af2 May 23, 2024
13 checks passed
@likhinbopanna likhinbopanna deleted the fix_kafka_timestamps branch May 23, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Analytics A-framework Area: Framework C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: fix timestamp sent to kafka events
5 participants