-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Component(s)
cmd/mdatagen
What happened?
Describe the bug
The generated metrics tests when an attribute is of type enum and conditionally_required cannot map to the corresponding enum value.
Steps to reproduce
- Add the requirement level if one of the test components:
--- i/cmd/mdatagen/internal/sampleconnector/metadata.yaml
+++ w/cmd/mdatagen/internal/sampleconnector/metadata.yaml
@@ -89,6 +89,7 @@ attributes:
description: Attribute with a known set of string values.
type: string
enum: [red, green, blue]
+ requirement_level: conditionally_required- Run
go generate
What did you expect to see?
Tests to PASS.
What did you see instead?
$ go test ./...
ok go.opentelemetry.io/collector/cmd/mdatagen (cached) [no tests to run]
# go.opentelemetry.io/collector/cmd/mdatagen/internal/sampleconnector/internal/metadata [go.opentelemetry.io/collector/cmd/mdatagen/internal/sampleconnector/internal/metadata.test]
internal/sampleconnector/internal/metadata/generated_metrics_test.go:101:207: cannot use AttributeEnumAttrRed (constant 1 of int type AttributeEnumAttr) as string value in argument to WithEnumAttrMetricAttribute
internal/sampleconnector/internal/metadata/generated_metrics_test.go:109:211: cannot use AttributeEnumAttrRed (constant 1 of int type AttributeEnumAttr) as string value in argument to WithEnumAttrMetricAttribute
ok go.opentelemetry.io/collector/cmd/mdatagen/internal (cached)
ok go.opentelemetry.io/collector/cmd/mdatagen/internal/sampleconnector (cached)
FAIL go.opentelemetry.io/collector/cmd/mdatagen/internal/sampleconnector/internal/metadata [build failed]
Collector version
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.