-
Notifications
You must be signed in to change notification settings - Fork 84
Conversation
From experience this kind of changes can be very dangerous. For multiple reasons.
I'm not that worried about CloudWatch compatibility (we can always ask @luben for that)
Imagine a customer creating a script to analyze some logs and expecting a strict format, or worse blindly exporting the logs to another database with a strict schema.
My idea here is that we should opt-in the new format, so the customer won't be surprised by the change.
darklight3it
commented
Jun 17, 2026
Also I think this is also highlighting a design flaw. The RIC should not be concerned with the time format.
It should flush to the sink the biggest possible epoch and CW should do the conversion to human readable time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used by any other code? I nothing else is using it we can just append .%f here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be safer to leave that string and just use another format string in the formatTime override
benrkia
commented
Jun 18, 2026
Also I think this is also highlighting a design flaw. The RIC should not be concerned with the time format.
I agree, can we consider that in a major version change?
bd81f21 to
e9520b3
Compare
This is done to support millisecond precision timestamp in the structured logs in cloudwatch as requested in #156. Changing directly to millisecond is a potentially breaking change, so we agreed on supporting this environmental variable on this version of the RIC. We'll remove the support in RIC v5, defaulting to milisecond.
darklight3it
commented
Jun 25, 2026
Did some manual integration tests for that. Here the results.
=== Invoking ric-timestamp-demo-seconds (default - seconds precision) ===
START RequestId: 08362ce1-8885-4a72-9909-da5fffe1a480 Version: $LATEST
{"timestamp": "2026-06-25T22:14:30Z", "level": "INFO", "message": "First log message", "logger": "root", "requestId": "08362ce1-8885-4a72-9909-da5fffe1a480"}
{"timestamp": "2026-06-25T22:14:30Z", "level": "INFO", "message": "Second log message", "logger": "root", "requestId": "08362ce1-8885-4a72-9909-da5fffe1a480"}
{"timestamp": "2026-06-25T22:14:30Z", "level": "WARNING", "message": "A warning with sub-second timing", "logger": "root", "requestId": "08362ce1-8885-4a72-9909-da5fffe1a480"}
END RequestId: 08362ce1-8885-4a72-9909-da5fffe1a480
REPORT RequestId: 08362ce1-8885-4a72-9909-da5fffe1a480 Duration: 2.46 ms Billed Duration: 460 ms Memory Size: 128 MB Max Memory Used: 35 MB Init Duration: 456.96 ms
=== Invoking ric-timestamp-demo-milliseconds (milliseconds precision) ===
START RequestId: fba920c6-24e8-4380-a34c-e7eff76c6f9e Version: $LATEST
{"timestamp": "2026-06-25T22:14:34.512Z", "level": "INFO", "message": "First log message", "logger": "root", "requestId": "fba920c6-24e8-4380-a34c-e7eff76c6f9e"}
{"timestamp": "2026-06-25T22:14:34.513Z", "level": "INFO", "message": "Second log message", "logger": "root", "requestId": "fba920c6-24e8-4380-a34c-e7eff76c6f9e"}
{"timestamp": "2026-06-25T22:14:34.513Z", "level": "WARNING", "message": "A warning with sub-second timing", "logger": "root", "requestId": "fba920c6-24e8-4380-a34c-e7eff76c6f9e"}
END RequestId: fba920c6-24e8-4380-a34c-e7eff76c6f9e
REPORT RequestId: fba920c6-24e8-4380-a34c-e7eff76c6f9e Duration: 2.63 ms Billed Duration: 358 ms Memory Size: 128 MB Max Memory Used: 35 MB Init Duration: 355.10 ms
Uh oh!
There was an error while loading. Please reload this page.
Issue #, if available:
#156
Description of changes:
Adds opt-in millisecond timestamp precision for JSON structured logs. When
AWS_LAMBDA_LOG_TIMESTAMP_PRECISION=millisecondsis set, timestamps are formatted as2024年06月19日T23:13:05.068Zinstead of the default2024年06月19日T23:13:05Z.Key changes:
_format_timestamp()function used by bothJsonFormatterandbootstrap.pyerror logging, ensuring consistent output.demo/) for end-to-end validation.Target (OCI, Managed Runtime, both):
Both
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.