opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

[pkg/ottl] Add `IsInt` Converter

Open TylerHelmuth opened this issue 2 years ago • 4 comments
trafficstars

Component(s)

pkg/ottl

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

OTTL has no way to check if a value is an int type.

Describe the solution you'd like

Add a new Converter, IsInt that returns true if the given type is a int (or equivalent type). It will work similarly to the IsString function.

The implementing PR should

  • [ ] Implement the function
  • [ ] Add new unit tests for the function
  • [ ] Add the function to pkg/ottl/ottlfuncs/functions.go
  • [ ] Update the README at pkg/ottl/ottlfuncs/README.md

TylerHelmuth avatar Oct 20 '23 21:10 TylerHelmuth

Would this just match on any of the built-in int types and pcommon.ValueTypeInt? Or could it include values like 2.0 and "2"?

Also, maybe an IsNumber/IsNumeric function is helpful for when it's unclear if instrumentation emits integers or doubles

swar8080 avatar Oct 23 '23 12:10 swar8080

i'm interested in working on this issue :)

lazyplatypus avatar Nov 08 '23 20:11 lazyplatypus

Thanks @lazyplatypus, its all yours!

codeboten avatar Nov 08 '23 20:11 codeboten

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:

  • pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley

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

github-actions[bot] avatar Feb 12 '24 03:02 github-actions[bot]

It can be closed because the #31307 was merged.

lkwronski avatar Feb 26 '24 18:02 lkwronski