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

Method initPartitionRing

cmd/tempo/app/modules.go:172–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172func (t *App) initPartitionRing() (services.Service, error) {
173 var (
174 heartbeatTimeout time.Duration
175 readRing ring.InstanceRingReader
176 ringName string
177 ringKey string
178 kvConfig kv.Config
179 )
180
181 heartbeatTimeout = t.cfg.LiveStore.Ring.HeartbeatTimeout
182 readRing = t.readRings[ringLiveStore]
183 ringName = livestore.PartitionRingName
184 ringKey = livestore.PartitionRingKey
185 kvConfig = t.cfg.LiveStore.PartitionRing.KVStore
186
187 kvClient, err := kv.NewClient(kvConfig, ring.GetPartitionRingCodec(), kv.RegistererWithKVName(prometheus.DefaultRegisterer, ringName+"-watcher"), util_log.Logger)
188 if err != nil {
189 return nil, fmt.Errorf("creating KV store for %s partitions ring watcher: %w", ringName, err)
190 }
191
192 t.partitionRingWatcher = ring.NewPartitionRingWatcher(ringName, ringKey, kvClient, util_log.Logger, prometheus.WrapRegistererWithPrefix("tempo_", prometheus.DefaultRegisterer))
193 t.partitionRing = ring.NewPartitionInstanceRing(t.partitionRingWatcher, readRing, heartbeatTimeout)
194
195 // Expose a web page to view the partitions ring state.
196 t.Server.HTTPRouter().Path("/partition-ring").Methods("GET", "POST").Handler(ring.NewPartitionRingPageHandler(t.partitionRingWatcher, ring.NewPartitionRingEditor(ringKey, kvClient)))
197
198 return t.partitionRingWatcher, nil
199}
200
201func (t *App) initOverrides() (services.Service, error) {
202 o, err := overrides.NewOverrides(t.cfg.Overrides, newRuntimeConfigValidator(&t.cfg), prometheus.DefaultRegisterer)

Callers

nothing calls this directly

Calls 2

HandlerMethod · 0.80
HTTPRouterMethod · 0.65

Tested by

no test coverage detected