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)
- Move from build-tools to weaver HOT 1
- Audit Compliance: Logs Bridge API Logger Provider
- Audit Compliance: Logs Bridge API Logger
- Audit Compliance: Logs Bridge API Concurrency Requirements
- Audit Compliance: Logs Bridge API Artifact Naming
- Audit Compliance: Logs Bridge SDK Logger Provider
- Audit Compliance: Logs Bridge SDK Logger
- Audit Compliance: Logs Bridge SDK ReadableLogRecord HOT 1
- Audit Compliance: Logs Bridge SDK ReadWriteLogRecord HOT 1
- Audit Compliance: Logs Bridge SDK LogRecord Limits
- Audit Compliance: Logs Bridge SDK LogRecordProcessor Interface
- Audit Compliance: Logs Bridge SDK Bult-in LogRecord Processors
- Audit Compliance: Logs Bridge SDK Log Record Exporter
- Audit Compliance: Logs Bridge No-Op Implementation
- SetAttributes/AddAttributes truncate strings down to 0-length HOT 5
- log: Add noCmp fields
- Update the no-op trace implementations to support auto-instrumentation
- How to Ignore `context.Canceled` Error HOT 1
- Otlp: `too many colons in address` when export env: `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` HOT 4
- [new feature] metrics: support prometheus remote write exporter. HOT 1
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.