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

[pkg/ottl] Add math operators to the grammar #15675

Closed
TylerHelmuth opened this issue Oct 26, 2022 · 0 comments · Fixed by #15711
Closed

[pkg/ottl] Add math operators to the grammar #15675

TylerHelmuth opened this issue Oct 26, 2022 · 0 comments · Fixed by #15711
Assignees
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium

Comments

@TylerHelmuth
Copy link
Member

Is your feature request related to a problem? Please describe.

Currently the grammar does not have a solution for combining numeric values.

Describe the solution you'd like

Update the grammar to understand +, -, *, and /. For now this symbols will only apply to int64 and float64, but could be made to work on other types that the grammar understands later.

Describe alternatives you've considered

Add functions to represent Add, Sub, Mult, and Div. While possible to solve this problem with new functions, updating the grammar to understand these operators natively will mean less overall functions to maintain and more flexibility with combining non-numeric types and mixed types.

Additional context

The specific use case I have heard from an OTEL user that will benefit from this feature is being able to calculate the difference between a span's end_time_unix_nano and start_time_unix_nano with a condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant