-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 support for Nanosecond-precision timetamps #12797
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roaksoax
added
status:needs-review
status:work-in-progress
and removed
status:needs-review
status:work-in-progress
labels
Apr 5, 2021
If you can address the notes on the javadoc comments, then the PR is LGTM |
andsel
approved these changes
Sep 14, 2021
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.
LGTM
The red CI is solved aligning this to |
yaauie
force-pushed
the
nanoseconds-support
branch
from
October 6, 2021 15:00
d31f006
to
d38a309
Compare
Migrates internals of `org.logstash.Timestamp` from legacy `org.joda.time.*` which is limited to millisecond-precision to modern `java.time.Instant`, allowing us to retain nanosecond granularity of `@timestamp` values. Timestamps that are generated by Logstash (such as when creating an event that does _not_ have a `@timestamp` field) will be generated at the highest precision available to the JVM and/or platform (in many cases, this is microseconds). Timestamps that are _parsed_ from user input will capture the entire provided precision, up to and including nanosecond granularity. Throughout the flow in the pipeline, including serialization to PQ, DLQ, and JSON, will retain all available precision. BREAKING: This produces an effectively-breaking change to the serialization format of both the persistent queue (PQ) and dead-letter queue (DLQ), as the serialized format this changeset contains a higher granularity of timestamp than previous releases of Logstash were capable of parsing without error. As such, it _MUST NOT_ be back-ported to the 7.x series.
yaauie
force-pushed
the
nanoseconds-support
branch
from
October 11, 2021 14:55
d38a309
to
780da01
Compare
Jenkins test this again please |
This was referenced Oct 14, 2021
5 tasks
5 tasks
Closed
4 tasks
Tsukiand
pushed a commit
to PanoBigData/logstash
that referenced
this pull request
Nov 9, 2021
3 tasks
This was referenced May 4, 2022
Merged
3 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release notes
Adds support for nanosecond-precision timestamps on events.
Adds support in the Event API's
@timestamp
formatters to use java-style format strings (using a new syntax%{{
+JAVA_FORMAT
+}}
that aligns with Elasticsearch date math), while retaining support for the now-legacy joda-time format strings (%{+
+JODA_FORMAT
+}
). This enables our users to tap into the improved formatting options available in their JVM, or to continue without modification.What does this PR do?
Changes our
org.logstash.Timestamp
to wrap Java 8+'sjava.time.Instant
, which allows us to maintain nanosecond-precision timestamps throughout processing. Access to an equivalentorg.joda.time.DateTime
is still available via the existingorg.logstash.Timestamp#getTime()
method, but has been deprecated in favor oforg.logstash.Timestamp#getInstant()
.Why is it important/What is the impact to the user?
As processing times speed up, millisecond granularity is not always enough. Inbound data increasingly has sub-millisecond granularity timestamps, and as long as we wrap
org.joda.time.DateTime
this granularity is truncated. This change-set allows the internal mechanisms of Logstash that hold moment-in-time data to have nanosecond granularity.Timestamps produced here maintain their granularity through serialization to the PQ, the DLQ,
toString
and when JSON-encoded, whether those timestamps were parsed from a string or generated by Logstash. Generated timestamps are limited to the JVM and Platform's available granularity, which in many cases is microseconds.Users also gain access to Java time's improved formatters, which include support fort ISO quarters, week-of-month, and a variety of timezone/offset-related format substitutions.
NOTE: Serialized events written by this code contain a higher granularity than can be safely parsed by releases of Logstash prior to these changes. As such, neither the PQ nor DLQ would support a "downgrade" after upgrading to a release of Logstash that includes these changes. This is why I am not aiming to back-port these changes to Logstash 7.x
Checklist
[ ] I have made corresponding change to the default configuration files (and/or docker env variables)Author's Checklist
It is unclear just yet if changing
org.logstash.Timestamp
is enough.