Comments (2)
I'd like to pick up that task.
The question I have is what was the reason for having tag.Map
as an interface? Was it to make it possible to have a different implementation of the interface from a different vendor of OT SDK?
From what I have understood from the comment is that the current implementation of the map is not thread-safe and it is not feasible to require thread-safety from the vendor implementations. Is this right?
If being able to provide an different tag.Map implementation by some vendor is still important then maybe it would be possible to achieve the thread safety by something like this:
type Map interface {
Apply(update MapUpdate) Map
…
}
type lockedMap struct {
impl Map
implLock sync.Mutex
}
var _ Map = &lockedMap{}
func (t &lockedMap) Apply(update MapUpdate) Map {
t.implLock.Lock()
defer t.implLock.Unlock()
return t.impl.Apply(update)
}
// same for the rest of the Map interface methods
…
func NewEmptyMap() Map {
return &lockedMap{
impl: tagMap{}
}
}
So in the end, vendor would need to provide an implementation of the tagMap
type.
from opentelemetry-go.
I'm not sure there was any reason to have a tag.Map interface in the first place. As I think we've discovered in #52 (see also open-telemetry/oteps#11), there will be uses of the tag.Map interface that are expected before the SDK loads. So, I think we should eliminate the interface and use a concrete type. Then, having an immutable map is sufficient to avoid the problems with map concurrency.
I believe the point about deep-copying bytes is also true, but I want to point out some related work. I have an as-yet-unwritten proposal about supporting structured values and lazy values, for various reasons covered in open-telemetry/opentelemetry-specification#76. The code (in Go) is a proof-of-concept: jmacd#3
see the Key.Struct()
and Key.Encode()
APIs. There, I included an Evaluate
API to ensure that lazy and structure-valued values are copied into bytes before they can be modified. I think you're saying that this should be the case for []byte
in the present code base, and I agree.
from opentelemetry-go.
Related Issues (20)
- Document the `log` package HOT 2
- Add the `log/embedded` package
- Add the `log/noop` package HOT 1
- Implement the `Logger` configuration
- Add tests for the `Severity` type
- Implement the `Record` type
- Implement the `Value` and `KeyValue` types HOT 5
- Add benchmarks to `log` package HOT 1
- Add allocation unit tests to `log` package HOT 1
- Replace `List` log value kind with `Slice` HOT 3
- Go semver seems not be consistant with otel semver spec HOT 7
- baggage: Accept non-ASCII keys HOT 8
- Create Logs Bridge SDK Design Proposal HOT 3
- internal/global: Export getLogger and refactor tests
- log: Implement Stringer for Value and KeyValue HOT 3
- log: Empty Value
- Conflicting schema with stdouttrace HOT 2
- Release v1.24.0/v0.46.0 Checklist
- Remove the AsAny method from `Value`
- Create an assertZeroAllocs test helper HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-go.