Skip to content

Commit

Permalink
feat(span): remove SetAttribute method (#1216)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
stanleynguyen and MrAlias committed Oct 2, 2020
1 parent 6e184cd commit de50711
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 33 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions api/trace/api.go
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions api/trace/context_test.go
Expand Up @@ -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) {
}
Expand Down
4 changes: 0 additions & 4 deletions api/trace/noop_span.go
Expand Up @@ -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) {
}
Expand Down
4 changes: 0 additions & 4 deletions api/trace/tracetest/mock_span.go
Expand Up @@ -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) {
}
Expand Down
4 changes: 0 additions & 4 deletions api/trace/tracetest/span.go
Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions bridge/opentracing/internal/mock.go
Expand Up @@ -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)
}
Expand Down
7 changes: 0 additions & 7 deletions sdk/trace/span.go
Expand Up @@ -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
Expand Down

0 comments on commit de50711

Please sign in to comment.