Documentation ¶
Index ¶
Constants ¶
const ( // DefaultTenantHeader is the default header used to designate the tenant making a write request. DefaultTenantHeader = "THANOS-TENANT" // DefaultReplicaHeader is the default header used to designate the replica count of a write request. DefaultReplicaHeader = "THANOS-REPLICA" )
Variables ¶
This section is empty.
Functions ¶
func HashringFromConfig ¶
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. The updates chan is closed before exiting.
Types ¶
type Appendable ¶
Appendable returns an Appender.
type ConfigWatcher ¶
type ConfigWatcher struct {
// contains filtered or unexported fields
}
ConfigWatcher is able to watch a file containing a hashring configuration for updates.
func NewConfigWatcher ¶
func NewConfigWatcher(logger log.Logger, r prometheus.Registerer, path string, interval model.Duration) (*ConfigWatcher, error)
NewConfigWatcher creates a new ConfigWatcher.
func (*ConfigWatcher) C ¶
func (cw *ConfigWatcher) C() <-chan []HashringConfig
C returns a chan that gets hashring configuration updates.
func (*ConfigWatcher) Run ¶
func (cw *ConfigWatcher) Run(ctx context.Context)
Run starts the ConfigWatcher until the given context is cancelled.
type FlushableStorage ¶ added in v0.8.0
func NewFlushableStorage ¶ added in v0.8.0
func NewFlushableStorage(path string, l log.Logger, r prometheus.Registerer, opts *tsdb.Options) *FlushableStorage
NewFlushableStorage returns a new storage backed by a TSDB database that is configured for Prometheus.
func (*FlushableStorage) Close ¶ added in v0.8.0
func (f *FlushableStorage) Close() error
Close stops the storage.
func (*FlushableStorage) Flush ¶ added in v0.8.0
func (f *FlushableStorage) Flush() error
Flush temporarily stops the storage and flushes the WAL to blocks. Note: this operation leaves the storage closed.
func (*FlushableStorage) Get ¶ added in v0.8.0
func (f *FlushableStorage) Get() *promtsdb.DB
Get returns a reference to the underlying storage.
func (*FlushableStorage) Open ¶ added in v0.8.0
func (f *FlushableStorage) Open() error
Open starts the TSDB.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves a Prometheus remote write receiving HTTP endpoint.
type Hashring ¶
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 ¶
type HashringConfig struct { Hashring string `json:"hashring,omitempty"` Tenants []string `json:"tenants,omitempty"` Endpoints []string `json:"endpoints"` }
HashringConfig represents the configuration for a hashring a receive node knows about.
type Options ¶
type Options struct { Writer *Writer ListenAddress string Registry prometheus.Registerer Endpoint string TenantHeader string ReplicaHeader string ReplicationFactor uint64 Tracer opentracing.Tracer TLSConfig *tls.Config TLSClientConfig *tls.Config }
Options for the web Handler.
type SingleNodeHashring ¶
type SingleNodeHashring string
SingleNodeHashring always returns the same node.
func (SingleNodeHashring) Get ¶
func (s SingleNodeHashring) Get(tenant string, ts *prompb.TimeSeries) (string, error)
Get implements the Hashring interface.
func (SingleNodeHashring) GetN ¶
func (s SingleNodeHashring) GetN(_ string, _ *prompb.TimeSeries, n uint64) (string, error)
GetN implements the Hashring interface.
type UnRegisterer ¶ added in v0.8.0
type UnRegisterer struct {
prometheus.Registerer
}
UnRegisterer is a Prometheus registerer that ensures that collectors can be registered by unregistering already-registered collectors. FlushableStorage uses this registerer in order to not lose metric values between DB flushes.
func (*UnRegisterer) MustRegister ¶ added in v0.8.0
func (u *UnRegisterer) MustRegister(cs ...prometheus.Collector)