1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-15 01:04:25 +02:00

change trace.WithAttributes to append values instead of replacing (#315)

* change trace.WithAttributes to append values instead of replacing

* improve doc
This commit is contained in:
Gustavo Silva Paiva
2019-11-14 14:03:23 -04:00
committed by Liz Fong-Jones
parent a228bafec5
commit 1fd93b293c
2 changed files with 8 additions and 2 deletions

View File

@ -204,9 +204,10 @@ func WithStartTime(t time.Time) SpanOption {
// WithAttributes sets attributes to span. These attributes provides additional
// data about the span.
// Multiple `WithAttributes` options appends the attributes preserving the order.
func WithAttributes(attrs ...core.KeyValue) SpanOption {
return func(o *SpanOptions) {
o.Attributes = attrs
o.Attributes = append(o.Attributes, attrs...)
}
}