receive

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashringFromConfig added in v0.6.0

func HashringFromConfig(ctx context.Context, updates chan<- Hashring, cw *ConfigWatcher)

HashringFromConfig creates multi-tenant hashrings from a hashring configuration file watcher. The configuration file is watched for updates. Hashrings are returned on the updates channel. Which hashring to use for a tenant is determined by the tenants field of the hashring configuration.

Types

type Appendable

type Appendable interface {
	Appender() (storage.Appender, error)
}

Appendable returns an Appender.

type ConfigWatcher added in v0.6.0

type ConfigWatcher struct {
	// contains filtered or unexported fields
}

ConfigWatcher is able to watch a file containing a hashring configuration for updates.

func NewConfigWatcher added in v0.6.0

func NewConfigWatcher(logger log.Logger, r prometheus.Registerer, path string, interval model.Duration) (*ConfigWatcher, error)

NewConfigWatcher creates a new ConfigWatcher.

func (*ConfigWatcher) C added in v0.6.0

func (cw *ConfigWatcher) C() <-chan []HashringConfig

C returns a chan that gets hashring configuration updates.

func (*ConfigWatcher) Run added in v0.6.0

func (cw *ConfigWatcher) Run(ctx context.Context)

Run starts the ConfigWatcher until the given context is cancelled.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves a Prometheus remote write receiving HTTP endpoint.

func NewHandler

func NewHandler(logger log.Logger, o *Options) *Handler

func (*Handler) Close added in v0.6.0

func (h *Handler) Close()

Close stops the Handler.

func (*Handler) Hashring added in v0.6.0

func (h *Handler) Hashring(hashring Hashring)

Hashring sets the hashring for the handler and marks the hashring as ready. If the hashring is nil, then the hashring is marked as not ready.

func (*Handler) Run

func (h *Handler) Run() error

Run serves the HTTP endpoints.

func (*Handler) StorageReady added in v0.6.0

func (h *Handler) StorageReady()

StorageReady marks the storage as ready.

type Hashring added in v0.6.0

type Hashring interface {
	// Get returns the first node that should handle the given tenant and time series.
	Get(tenant string, timeSeries *prompb.TimeSeries) (string, error)
	// GetN returns the nth node that should handle the given tenant and time series.
	GetN(tenant string, timeSeries *prompb.TimeSeries, n uint64) (string, error)
}

Hashring finds the correct node to handle a given time series for a specified tenant. It returns the node and any error encountered.

type HashringConfig added in v0.6.0

type HashringConfig struct {
	Hashring  string   `json:"hashring"`
	Tenants   []string `json:"tenants"`
	Endpoints []string `json:"endpoints"`
}

HashringConfig represents the configuration for a hashring a receive node knows about.

type Options

type Options struct {
	Receiver          *Writer
	ListenAddress     string
	Registry          prometheus.Registerer
	ReadyStorage      *promtsdb.ReadyStorage
	Endpoint          string
	TenantHeader      string
	ReplicaHeader     string
	ReplicationFactor uint64
}

Options for the web Handler.

type SingleNodeHashring added in v0.6.0

type SingleNodeHashring string

SingleNodeHashring always returns the same node.

func (SingleNodeHashring) Get added in v0.6.0

func (s SingleNodeHashring) Get(tenant string, ts *prompb.TimeSeries) (string, error)

Get implements the Hashring interface.

func (SingleNodeHashring) GetN added in v0.6.0

GetN implements the Hashring interface.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(logger log.Logger, app Appendable) *Writer

func (*Writer) Receive

func (r *Writer) Receive(wreq *prompb.WriteRequest) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL