Description
I was just shown the scenario
set(resource.attributes["my.environment.2"], Split(resource.attributes["host.name"],"-")[1])
that produces an error:
{"kind": "processor", "name": "transform", "pipeline": "logs", "error": "type, []string, does not support int indexing", "statement": "set(resource.attributes[\"my.environment.2\"], Split(resource.attributes[\"host.name\"],\"-\")[1])"}
Although the language does support indexing the return value of the Converter, it only supports indexing pcommon.Slice
and []any
, but Split
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)