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 Log() to ottlfuncs #21825

Merged
merged 6 commits into from
May 15, 2023
Merged

Conversation

mterhar
Copy link
Contributor

@mterhar mterhar commented May 11, 2023

Addresses issue #18076

Description:

Adds a feature to allow OTTL expressions to get a logarithm of a value.

Link to tracking Issue: 18076

Testing: Tests were added in the same way the Int() function is tested

Documentation: Added a readme section following the same pattern as Int() which covers type for inputs and return values and examples.

@github-actions github-actions bot requested a review from kentquirk May 11, 2023 16:41
@mterhar mterhar mentioned this pull request May 11, 2023
@mterhar mterhar changed the title Add Log() to ottlfuncs [pkg/ottl] Add Log() to ottlfuncs May 11, 2023
.chloggen/add-logarithm-to-ottlfuncs.yaml Outdated Show resolved Hide resolved
.chloggen/add-logarithm-to-ottlfuncs.yaml Outdated Show resolved Hide resolved
pkg/ottl/ottlfuncs/func_log.go Outdated Show resolved Hide resolved
pkg/ottl/ottlfuncs/func_log.go Outdated Show resolved Hide resolved
Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a suggestion for the README to bring it in line with IsMatch, which is the only other function using a Like getter. Otherwise LGTM

pkg/ottl/ottlfuncs/README.md Outdated Show resolved Hide resolved
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
@TylerHelmuth TylerHelmuth merged commit 929903c into open-telemetry:main May 15, 2023
84 checks passed
@github-actions github-actions bot added this to the next release milestone May 15, 2023
varunraiko pushed a commit to varunraiko/opentelemetry-collector-contrib that referenced this pull request May 17, 2023
* Add Log() to ottlfuncs

Addresses issue open-telemetry#18076

* redo the logarithm ottl with the new format

* Handle negatives and zero as nil rather than NaN

* replace lots of logic with FloatLikeGetter

* Updated tests to work with FloatLikeGetter

* Update readme with suggestion

Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>

---------

Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants