-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 a Duration Processor implementation #40753
Add a Duration Processor implementation #40753
Conversation
Update TimeValue to accept fractional values with added protections against overflow and underflow. Included are tests and documentation.
Pinging @elastic/es-core-infra |
Pinging @elastic/es-core-features |
It was deliberate that |
I had a feeling that was the case. One of the main drivers for supporting the fractional time values was that this processor may be used for monitoring Elasticsearch itself, which may occasionally report time values in fractional format. Perhaps it makes sense to move the fractional parsing to the processor only? |
That would be my inclination if we absolutely must do this, but I think we should consider changing Elasticsearch so that it doesn't report fractional time values in these APIs. |
relates #39857 |
One of the driving factors, for reference: elastic/beats#9603 Looking into the service, the TimeValue's toString method is relied on for logging these events. I wouldn't be surprised if that were the case in countless other places. Maybe we should have a discussion about breaking out the |
Closing this PR for now. There's quite a bit of contention around parsing fractional time values. In order to solve the original problem it would probably be better to remove the logging of fractional time values and simply log the un-formatted time value in places where it might need to be captured for further processing. |
This processor allows for human readable durations (e.g.
5s
) to be converted into a value representing the duration in milliseconds (e.g.5000
). The processor can be configured to convert the duration into a time unit other thanmilliseconds
.This processor makes use of the
TimeValue.parseTimeValue(String, String)
method to parse the given field value into an instance ofTimeValue
before converting it into a number of milliseconds (or other configured time unit).In order to support some general monitoring use cases, the
TimeValue
class has been modified to accept fractional time values, with additional guards in place to avoid long overflow/underflow when converting large units.