Skip to content

Commit

Permalink
feat(span): remove SetAttribute method
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleynguyen committed Sep 30, 2020
1 parent 3a9f5fe commit ab0f576
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 30 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

- Remove `SetAttribute` method from Span

## [0.12.0] - 2020-09-24

### Added
Expand Down
3 changes: 0 additions & 3 deletions api/trace/api.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 ab0f576

Please sign in to comment.