summaryrefslogtreecommitdiff
path: root/vendor/go.opencensus.io/trace/spanstore.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.opencensus.io/trace/spanstore.go')
-rw-r--r--vendor/go.opencensus.io/trace/spanstore.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/vendor/go.opencensus.io/trace/spanstore.go b/vendor/go.opencensus.io/trace/spanstore.go
index c442d9902..e601f76f2 100644
--- a/vendor/go.opencensus.io/trace/spanstore.go
+++ b/vendor/go.opencensus.io/trace/spanstore.go
@@ -48,8 +48,10 @@ func (i internalOnly) ReportActiveSpans(name string) []*SpanData {
var out []*SpanData
s.mu.Lock()
defer s.mu.Unlock()
- for span := range s.active {
- out = append(out, span.makeSpanData())
+ for activeSpan := range s.active {
+ if s, ok := activeSpan.(*span); ok {
+ out = append(out, s.makeSpanData())
+ }
}
return out
}
@@ -185,7 +187,7 @@ func (i internalOnly) ReportSpansByLatency(name string, minLatency, maxLatency t
// bucketed by latency.
type spanStore struct {
mu sync.Mutex // protects everything below.
- active map[*Span]struct{}
+ active map[SpanInterface]struct{}
errors map[int32]*bucket
latency []bucket
maxSpansPerErrorBucket int
@@ -194,7 +196,7 @@ type spanStore struct {
// newSpanStore creates a span store.
func newSpanStore(name string, latencyBucketSize int, errorBucketSize int) *spanStore {
s := &spanStore{
- active: make(map[*Span]struct{}),
+ active: make(map[SpanInterface]struct{}),
latency: make([]bucket, len(defaultLatencies)+1),
maxSpansPerErrorBucket: errorBucketSize,
}
@@ -271,7 +273,7 @@ func (s *spanStore) resize(latencyBucketSize int, errorBucketSize int) {
}
// add adds a span to the active bucket of the spanStore.
-func (s *spanStore) add(span *Span) {
+func (s *spanStore) add(span SpanInterface) {
s.mu.Lock()
s.active[span] = struct{}{}
s.mu.Unlock()
@@ -279,7 +281,7 @@ func (s *spanStore) add(span *Span) {
// finished removes a span from the active set, and adds a corresponding
// SpanData to a latency or error bucket.
-func (s *spanStore) finished(span *Span, sd *SpanData) {
+func (s *spanStore) finished(span SpanInterface, sd *SpanData) {
latency := sd.EndTime.Sub(sd.StartTime)
if latency < 0 {
latency = 0