-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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] Allow indexing any slice type #29441
Comments
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. |
Yes please, fix for this would be great. I've been trying to figure out this issue for a half a day, until I found this just now. 😓 |
The workaround for this issue is to use
|
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. |
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. |
At a minimum, we should achieve type coverage for all types that OTTL supports. If possible, a generic solution would be nice, assuming we can do this with either reflection or some creative type casting. |
**Description:** Allow indexing string slice type. I can also add support for other types such as []int if needed. Let me know if this approach is good enough. I haven't found a more generic solution, thank you for any feedback. **Link to tracking Issue:** Fixes #29441 **Testing:** Unit test **Documentation:**
#35581 only added support for string slices, we still need support for slices of types that OTTL supports. |
I'd like to work on this for contribfest (still cloning the repo though 😢) |
I believe that is:
|
should that be |
Also, no need to support int32? |
@znd4 no need to support |
**Description:** Allow indexing string slice type. I can also add support for other types such as []int if needed. Let me know if this approach is good enough. I haven't found a more generic solution, thank you for any feedback. **Link to tracking Issue:** Fixes open-telemetry#29441 **Testing:** Unit test **Documentation:**
I was just shown the scenario
set(resource.attributes["my.environment.2"], Split(resource.attributes["host.name"],"-")[1])
that produces an error:
Although the language does support indexing the return value of the Converter, it only supports indexing
pcommon.Slice
and[]any
, butSplit
returns a[]string
. We need to make indexing slices more generic. This might need to be its own issue. Related code:opentelemetry-collector-contrib/pkg/ottl/expression.go
Lines 98 to 112 in 60430e1
Originally posted by @TylerHelmuth in #26108 (comment)
The text was updated successfully, but these errors were encountered: