Skip to content

Commit d75b91b

Browse files
committed
[cmd/mdatagen] only import "slices" when a required reagg attribute exists
The config.go.tmpl unconditionally imports "slices" whenever reaggregation is enabled and there are aggregatable (recommended/opt_in) attributes. However, slices.Contains is only emitted for *required* attributes. When a receiver has reaggregation enabled but carries no required attributes, the generated file fails to compile with "slices imported and not used". Add a second template variable $hasRequiredReagAttr and gate the "slices" import on it. Signed-off-by: Ali <alliasgher123@gmail.com>
1 parent 2854c98 commit d75b91b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

cmd/mdatagen/internal/templates/config.go.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
{{- if $hasReagMetricsWithRequired }}
1717
"slices"
1818
{{- end }}
19+
{{- end }}
1920

2021
"go.opentelemetry.io/collector/confmap"
2122
{{- if and .Metrics .ResourceAttributes }}

0 commit comments

Comments
 (0)