mirror of
https://github.com/status-im/status-go.git
synced 2025-01-11 07:07:24 +00:00
eeca435064
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package loggabletracer
|
|
|
|
// SpanContext holds the basic Span metadata.
|
|
type SpanContext struct {
|
|
// A probabilistically unique identifier for a [multi-span] trace.
|
|
TraceID uint64
|
|
|
|
// A probabilistically unique identifier for a span.
|
|
SpanID uint64
|
|
|
|
// Whether the trace is sampled.
|
|
Sampled bool
|
|
|
|
// The span's associated baggage.
|
|
Baggage map[string]string // initialized on first use
|
|
}
|
|
|
|
// ForeachBaggageItem belongs to the opentracing.SpanContext interface
|
|
func (c SpanContext) ForeachBaggageItem(handler func(k, v string) bool) {
|
|
for k, v := range c.Baggage {
|
|
if !handler(k, v) {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
// WithBaggageItem returns an entirely new loggabletracer SpanContext with the
|
|
// given key:value baggage pair set.
|
|
func (c SpanContext) WithBaggageItem(key, val string) SpanContext {
|
|
var newBaggage map[string]string
|
|
if c.Baggage == nil {
|
|
newBaggage = map[string]string{key: val}
|
|
} else {
|
|
newBaggage = make(map[string]string, len(c.Baggage)+1)
|
|
for k, v := range c.Baggage {
|
|
newBaggage[k] = v
|
|
}
|
|
newBaggage[key] = val
|
|
}
|
|
// Use positional parameters so the compiler will help catch new fields.
|
|
return SpanContext{c.TraceID, c.SpanID, c.Sampled, newBaggage}
|
|
}
|