MCPcopy
hub / github.com/grafana/tempo / New

Function New

pkg/ring/ring.go:22–33  ·  view source on GitHub ↗

New creates a new distributed consistent hash ring. It shadows the cortex ring.New method so we can use our own replication strategy for repl factor = 2

(cfg ring.Config, name, key string, reg prometheus.Registerer)

Source from the content-addressed store, hash-verified

20// New creates a new distributed consistent hash ring. It shadows the cortex
21// ring.New method so we can use our own replication strategy for repl factor = 2
22func New(cfg ring.Config, name, key string, reg prometheus.Registerer) (*ring.Ring, error) {
23 reg = prometheus.WrapRegistererWithPrefix("tempo_", reg)
24
25 statReplicationFactor.Set(int64(cfg.ReplicationFactor))
26 statKvStore.Set(cfg.KVStore.Store)
27
28 if cfg.ReplicationFactor == 2 {
29 return newEventuallyConsistentRing(cfg, name, key, reg)
30 }
31
32 return ring.New(cfg, name, key, log.Logger, reg)
33}
34
35func newEventuallyConsistentRing(cfg ring.Config, name, key string, reg prometheus.Registerer) (*ring.Ring, error) {
36 codec := ring.GetCodec()

Callers

nothing calls this directly

Calls 2

SetMethod · 0.65

Tested by

no test coverage detected