opencensus-go icon indicating copy to clipboard operation
opencensus-go copied to clipboard

Tag has concurrent access problem

Open diwufeiwen opened this issue 2 years ago • 0 comments

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

go.opencensus.io v0.23.0

What version of Go are you using?

go version go1.18.2

What did you do?

If possible, provide a recipe for reproducing the error.

What did you see instead?

[email protected]/tag/map.go#L36

// Map is a map of tags. Use New to create a context containing // a new Map. type Map struct { m map[Key]tagContent }

No locking, not thread safe.

go func() { ctx, _ = tag.New(ctx, tag.Upsert(***) stats.Record(ctx, ...) }

It will panic when there is a lot of concurrency

diwufeiwen avatar Sep 19 '22 07:09 diwufeiwen