[exporter/loadbalancing] The awsCloudMap
tag doesn't satisfy the config tag regular expression
#32296
Labels
awsCloudMap
tag doesn't satisfy the config tag regular expression
#32296
Component(s)
exporter/loadbalancing
What happened?
Description
The
loadbalancing
exporter feature to enable using the AWS service discovery system described in #27241 and implemented by #27588 introduced a config field with tagawsCloudMap
which is using camelCase as well as two more sub-fields in camelCase:serviceName
andhealthStatus
.However, config tags need to satisfy the following regex:
^[a-z0-9][a-z0-9_]*$
This is declared in https://github.com/open-telemetry/opentelemetry-collector/blob/de3ef01bff4f1e4db0eee94abce862c66582f208/component/componenttest/configtest.go#L15-L16.
The regular expression does not allow caps, so the tag should be
aws_cloud_map
instead.In my team, we build our custom OTEL collector, heavily based on the
otelcol-contrib
one, and as part of our CI we run the tests for all Go modules including the OTEL collector (auto-generated module withocb
).This bug breaks
components_test.go
and it breaks our CI.We temporarily dropped the
loadbalancing
exporter from our OTEL collector, but it would be great if we included it back soon.Steps to Reproduce
ocb
ocb
binary and install the correct oneotelcol-contrib
Expected Result
Successfull tests.
Actual Result
The
awsCloudMap
config tag doesn't satisfy the regular expression. Changing it toaws_cloud_map
fixes the issue.The
serviceName
andhealthStatus
fields don't need to change, the validation logic doesn't check the sub-structs and I guess it's due to the fact thatAWSCloudMap
is a pointer toAWSCloudMapResolver
(and the validation logic doesn't expand pointers)Collector version
v0.97.0
Environment information
Environment
OS: Ubuntu 22.04
Compiler: go 1.21.0
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
I tried changing the config tag regular expression to allow capitalized letters and it fixes the tests. However, I think that it's more intrusive to change the regular expression in the core repository than to fix the config tag in this exporter.
The regular expression explicitly allows only lowercase snake_case config tags. Changing it to also allow capitalized letters will break uniformity.
At the same time, I understand that changing the
awsCloudMap
tag toaws_cloud_map
is an API change which needs extra care.I started the issue to gather opinions on how you people prefer to proceed with this:
aws_cloud_map
service_name
andhealth_status
for uniformityMentioning @andretong who introduced (and probably uses) the feature.
Also mentioning @jpkrohling who is the component's owner.
The text was updated successfully, but these errors were encountered: