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 Double converter #22056

Closed
kamalmarhubi opened this issue May 17, 2023 · 9 comments · Fixed by #27457
Closed

[pkg/ottl]: Add Double converter #22056

kamalmarhubi opened this issue May 17, 2023 · 9 comments · Fixed by #27457
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers pkg/ottl priority:p2 Medium

Comments

@kamalmarhubi
Copy link
Contributor

kamalmarhubi commented May 17, 2023

Component(s)

pkg/ottl

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

There's currently an Int converter, but no obvious way to force a value to be a Double. If you have an attribute that's a string representation of a double, it'd be nice to just parse it the way you currently for string representations of integers with Int.

Describe the solution you'd like

Add a Double converter that can convert Double, Int, String values.

Describe alternatives you've considered

The best I've come up with is going via JSON:

ParseJSON(Concat(["{\"value\":", attributes["some_attr"], "}"], ""))["value"]

which does in fact work for Double, Int, and String.

Additional context

No response

@kamalmarhubi kamalmarhubi added enhancement New feature or request needs triage New item requiring triage labels May 17, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@TylerHelmuth TylerHelmuth added priority:p2 Medium and removed needs triage New item requiring triage labels May 17, 2023
@TylerHelmuth
Copy link
Member

@kamalmarhubi that is an ingenious workaround.

This is definitely something we want to do. We already have FloatLikeGetter so this function is ready to be added. Would you like to work on it?

@kamalmarhubi
Copy link
Contributor Author

@TylerHelmuth sure. Should it be called Float or Double? I thought Double made more sense because it's the name of the ValueType in pcommon, but open to either.

@TylerHelmuth
Copy link
Member

Probably Double. @dmitryax @evan-bradley do you have an opinion?

@dmitryax
Copy link
Member

I agree with using Double

@evan-bradley
Copy link
Contributor

Double makes sense to me as well.

@github-actions
Copy link
Contributor

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 @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions
Copy link
Contributor

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 @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Sep 18, 2023
@TylerHelmuth TylerHelmuth added help wanted Extra attention is needed good first issue Good for newcomers and removed Stale labels Sep 18, 2023
@gord02
Copy link
Contributor

gord02 commented Oct 6, 2023

Hello everyone! I have recently joined the community and I have started my contributions by working on "good first issue" tasks like this one. I wrote some code for this task here: #27457. Please let me know of any suggestions you have for it.

@evan-bradley evan-bradley removed the help wanted Extra attention is needed label Oct 6, 2023
dmitryax pushed a commit that referenced this issue Oct 19, 2023
**Description:** Adding a Double converter to pkg/ottl

**Link to tracking Issue:** closes #22056
martin-majlis-s1 pushed a commit to scalyr/opentelemetry-collector-contrib that referenced this issue Oct 20, 2023
**Description:** Adding a Double converter to pkg/ottl

**Link to tracking Issue:** closes open-telemetry#22056
sigilioso pushed a commit to carlossscastro/opentelemetry-collector-contrib that referenced this issue Oct 27, 2023
**Description:** Adding a Double converter to pkg/ottl

**Link to tracking Issue:** closes open-telemetry#22056
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this issue Nov 12, 2023
**Description:** Adding a Double converter to pkg/ottl

**Link to tracking Issue:** closes open-telemetry#22056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers pkg/ottl priority:p2 Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants