File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
cmd/mdatagen/internal/templates Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1+ change_type : bug_fix
2+ component : cmd/mdatagen
3+ note : Fix invalid generated tests for conditionally_required enum attributes in metrics.
4+ issues : [14196, 14230]
Original file line number Diff line number Diff line change @@ -100,9 +100,13 @@ func (maof metricAttributeOptionFunc) apply(dp pmetric.NumberDataPoint) {
100100}
101101
102102{{ range getMetricConditionalAttributes .Attributes }}
103- func With{{ .Render }}MetricAttribute({{ .RenderUnexported }}AttributeValue {{ (attributeInfo . ).Type.Primitive }}) MetricAttributeOption {
103+ func With{{ .Render }}MetricAttribute({{ .RenderUnexported }}AttributeValue {{ if (attributeInfo . ).Enum }}Attribute{{ .Render }}{{ else }}{{ (attributeInfo . ) . Type.Primitive }}{{ end }}) MetricAttributeOption {
104104 return metricAttributeOptionFunc(func(dp pmetric.NumberDataPoint ) {
105+ {{- if (attributeInfo . ).Enum }}
106+ dp.Attributes ().PutStr (" {{ (attributeInfo .).Name }}" , {{ .RenderUnexported }}AttributeValue.String ())
107+ {{- else }}
105108 {{- template " putAttribute" . }}
109+ {{- end }}
106110 })
107111}
108112{{ end }}
You can’t perform that action at this time.
0 commit comments