You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
b2b3250897
This PR addresses issue #7987 (issue (1)): generated semconv metric helpers should not risk mutating caller-provided `attrs` backing arrays when required attributes are appended. Update the generator logic to merge required-attribute using capacity clamping before append: ``` append(attrs[:len(attrs):len(attrs)], requiredAttrs...) ``` This guarantees append allocates a new backing array for the merged slice instead of writing into caller memory when there are attributes appended. It makes not allocations in the case attributes are not appended.