1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-28 03:57:09 +02:00

feat(span): remove SetAttribute method (#1216)

* feat(span): remove SetAttribute method

* Update CHANGELOG.md

Revert markdown lint changes and unify the `Removed` section.

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
Stanley Nguyen 2020-10-03 05:41:15 +08:00 committed by GitHub
parent 6e184cd16f
commit de50711fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1 additions and 33 deletions

View File

@ -23,9 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The `ExtractHTTP` and `InjectHTTP` fuctions from the `go.opentelemetry.io/otel/api/propagation` package were removed. (#1212)
- The `Propagators` interface from the `go.opentelemetry.io/otel/api/propagation` package was removed to conform to the OpenTelemetry specification.
The explicit `TextMapPropagator` type can be used in its place as this is the `Propagator` type the specification defines. (#1212)
### Removed
- The `SetAttribute` method of the `Span` from the `go.opentelemetry.io/otel/api/trace` package was removed given its redundancy with the `SetAttributes` method. (#1216)
- Remove duplicate hostname key `HostHostNameKey` in Resource semantic conventions. (#1219)
## [0.12.0] - 2020-09-24

View File

@ -138,9 +138,6 @@ type Span interface {
// Set span attributes
SetAttributes(kv ...label.KeyValue)
// Set singular span attribute, with type inference.
SetAttribute(k string, v interface{})
}
// SpanConfig is a group of options for a Span.

View File

@ -96,10 +96,6 @@ func (mockSpan) SetError(v bool) {
func (mockSpan) SetAttributes(attributes ...label.KeyValue) {
}
// SetAttribute does nothing.
func (mockSpan) SetAttribute(k string, v interface{}) {
}
// End does nothing.
func (mockSpan) End(options ...trace.SpanOption) {
}

View File

@ -49,10 +49,6 @@ func (noopSpan) SetError(v bool) {
func (noopSpan) SetAttributes(attributes ...label.KeyValue) {
}
// SetAttribute does nothing.
func (noopSpan) SetAttribute(k string, v interface{}) {
}
// End does nothing.
func (noopSpan) End(options ...SpanOption) {
}

View File

@ -62,10 +62,6 @@ func (ms *MockSpan) SetError(v bool) {
func (ms *MockSpan) SetAttributes(attributes ...label.KeyValue) {
}
// SetAttribute does nothing.
func (ms *MockSpan) SetAttribute(k string, v interface{}) {
}
// End does nothing.
func (ms *MockSpan) End(options ...apitrace.SpanOption) {
}

View File

@ -174,10 +174,6 @@ func (s *Span) SetAttributes(attrs ...label.KeyValue) {
}
}
func (s *Span) SetAttribute(k string, v interface{}) {
s.SetAttributes(label.Any(k, v))
}
// Name returns the name most recently set on the Span, either at or after creation time.
// It cannot be change after End has been called on the Span.
func (s *Span) Name() string {

View File

@ -228,10 +228,6 @@ func (s *MockSpan) SetAttributes(attributes ...label.KeyValue) {
})
}
func (s *MockSpan) SetAttribute(k string, v interface{}) {
s.SetAttributes(label.Any(k, v))
}
func (s *MockSpan) applyUpdate(update otelbaggage.MapUpdate) {
s.Attributes = s.Attributes.Apply(update)
}

View File

@ -101,13 +101,6 @@ func (s *span) SetAttributes(attributes ...label.KeyValue) {
s.copyToCappedAttributes(attributes...)
}
func (s *span) SetAttribute(k string, v interface{}) {
attr := label.Any(k, v)
if attr.Value.Type() != label.INVALID {
s.SetAttributes(attr)
}
}
// End ends the span.
//
// The only SpanOption currently supported is WithTimestamp which will set the