mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Rename remote.Storage to remote.Writer
This commit is contained in:
parent
02395a224d
commit
406b65d0dc
|
@ -93,10 +93,10 @@ func Main() int {
|
|||
return 1
|
||||
}
|
||||
|
||||
remoteStorage := &remote.Storage{}
|
||||
sampleAppender = append(sampleAppender, remoteStorage)
|
||||
remoteAppender := &remote.Writer{}
|
||||
sampleAppender = append(sampleAppender, remoteAppender)
|
||||
remoteReader := &remote.Reader{}
|
||||
reloadables = append(reloadables, remoteStorage, remoteReader)
|
||||
reloadables = append(reloadables, remoteAppender, remoteReader)
|
||||
|
||||
queryable := fanin.Queryable{
|
||||
Local: localStorage,
|
||||
|
@ -185,7 +185,7 @@ func Main() int {
|
|||
}
|
||||
}()
|
||||
|
||||
defer remoteStorage.Stop()
|
||||
defer remoteAppender.Stop()
|
||||
|
||||
// The storage has to be fully initialized before registering.
|
||||
if instrumentedStorage, ok := localStorage.(prometheus.Collector); ok {
|
||||
|
|
|
@ -21,16 +21,16 @@ import (
|
|||
"github.com/prometheus/prometheus/config"
|
||||
)
|
||||
|
||||
// Storage allows queueing samples for remote writes.
|
||||
type Storage struct {
|
||||
// Writer allows queueing samples for remote writes.
|
||||
type Writer struct {
|
||||
mtx sync.RWMutex
|
||||
queues []*QueueManager
|
||||
}
|
||||
|
||||
// ApplyConfig updates the state as the new config requires.
|
||||
func (s *Storage) ApplyConfig(conf *config.Config) error {
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
func (w *Writer) ApplyConfig(conf *config.Config) error {
|
||||
w.mtx.Lock()
|
||||
defer w.mtx.Unlock()
|
||||
|
||||
newQueues := []*QueueManager{}
|
||||
// TODO: we should only stop & recreate queues which have changes,
|
||||
|
@ -53,30 +53,30 @@ func (s *Storage) ApplyConfig(conf *config.Config) error {
|
|||
}))
|
||||
}
|
||||
|
||||
for _, q := range s.queues {
|
||||
for _, q := range w.queues {
|
||||
q.Stop()
|
||||
}
|
||||
|
||||
s.queues = newQueues
|
||||
for _, q := range s.queues {
|
||||
w.queues = newQueues
|
||||
for _, q := range w.queues {
|
||||
q.Start()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop the background processing of the storage queues.
|
||||
func (s *Storage) Stop() {
|
||||
for _, q := range s.queues {
|
||||
func (w *Writer) Stop() {
|
||||
for _, q := range w.queues {
|
||||
q.Stop()
|
||||
}
|
||||
}
|
||||
|
||||
// Append implements storage.SampleAppender. Always returns nil.
|
||||
func (s *Storage) Append(smpl *model.Sample) error {
|
||||
s.mtx.RLock()
|
||||
defer s.mtx.RUnlock()
|
||||
func (w *Writer) Append(smpl *model.Sample) error {
|
||||
w.mtx.RLock()
|
||||
defer w.mtx.RUnlock()
|
||||
|
||||
for _, q := range s.queues {
|
||||
for _, q := range w.queues {
|
||||
q.Append(smpl)
|
||||
}
|
||||
return nil
|
||||
|
@ -85,6 +85,6 @@ func (s *Storage) Append(smpl *model.Sample) error {
|
|||
// NeedsThrottling implements storage.SampleAppender. It will always return
|
||||
// false as a remote storage drops samples on the floor if backlogging instead
|
||||
// of asking for throttling.
|
||||
func (s *Storage) NeedsThrottling() bool {
|
||||
func (w *Writer) NeedsThrottling() bool {
|
||||
return false
|
||||
}
|
Loading…
Reference in a new issue