-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[pkg/ottl] Improve Time converter error messages #35176
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners: See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I would like to work on this |
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
The
Time
converter errors messages currently refer to the Go's layout elements instead of the ctime-like substitutes. It might be confusing for users not familiar with the Go layout and/or non-developers.For example, when converter
Time(attributes["time.attribute"], "%B %g %A, %Y, %r")
receives the valueInvalid 25 Thursday, 1993, 02:03:04 pm
, it results into the following error:parsing time "Invalid 25 Thursday, 1993, 02:03:04 pm" as "January 2 Monday, 2006, 03:04:05 pm": cannot parse "Invalid 25 Thursday, 1993, 02:03:04 pm" as "January"
IMO, there's no clear relation between the
Time
configured format and the error message details.Describe the solution you'd like
Considering the ctime-like directives are first citizens for the
Time
converter format, reflecting those delimiters on the errors message would be helpful for users. For example, the above error message could be changed to something like:parsing time "Invalid 25 Thursday, 1993, 02:03:04 pm" as "%B %g %A, %Y, %r": cannot parse "Invalid 25 Thursday, 1993, 02:03:04 pm" as "%B"
The Go's
time.ParseError
does provide all necessary pieces to build the message like that, so the change could be proxying the standard parse functions errors and provide customised messages.Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: