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

Add millis to consumed messages #260

Open
romankristof opened this issue Nov 10, 2023 · 4 comments
Open

Add millis to consumed messages #260

romankristof opened this issue Nov 10, 2023 · 4 comments
Labels
✨ Feature Request New feature or request 🧑‍💻 Good First Issue Good for newcomers 💪 Help Wanted Extra attention is needed

Comments

@romankristof
Copy link

Hi @mostafa,
my scenario is that I am sending kafka requests with Writer to an tested app and I consume response messages with Reader.
I want to measure the duration between sending the message until the app writes a response into result topic.
I guess the time field on the message object coming from the Reader would be the right timestamp to collect as an time when the response was published, but since it is formated in RFC3339 format, I am missing milliseconds.
Would it be possible to use different format that includes millis? Or maybe add new reponse field to keep backwards compatibility?

Thanks a lot for your time and work
Roman

@mostafa
Copy link
Owner

mostafa commented Nov 10, 2023

Hey @romankristof,

That is to make Goja (and the user) happy when exporting datetime to JSON, so you can use it in your JS code. I'd be happy to see contributions, though. As in, make this a configurable field on the consume function using the ConsumeConfig struct, which eventually gets passed down to the consume function.

@mostafa mostafa added ✨ Feature Request New feature or request 💪 Help Wanted Extra attention is needed 🧑‍💻 Good First Issue Good for newcomers labels Dec 6, 2023
@AndreasKorn
Copy link

As long as there is no way to get the original (meaning with full precision) timestamp of the consumed message this is unusable to measure timings or generate metrics for the messages. Which is actually what one would like to do in load tests.
Please add a way to get the message timestamp with better precision.

@mostafa
Copy link
Owner

mostafa commented Mar 21, 2024

Hey @AndreasKorn,

I'd be happy if you contribute this feature.

@ChrisDev83
Copy link
Contributor

ChrisDev83 commented Apr 10, 2024

A new consumer option for nanos precision was added. You can set nanoPrecision: true in the consumer configuration in order to have the time return in RFC3339Nano format.

Time field by default = "time": "2024-04-10T14:13:46+01:00"
With nanoPrecision: true = "time": "2024-04-10T13:08:49.127Z"

To have more flexibility this could be change further to allow specification of the exact format (as per @mostafa). We had questions around the format, whether it be javascript or go formats. Or constants for each format type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature Request New feature or request 🧑‍💻 Good First Issue Good for newcomers 💪 Help Wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants