pusher

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelValueMetrics        = "metrics"
	LabelValueLogs           = "logs"
	LabelValueClient         = "client"
	LabelValueRetryExhausted = "retry_exhausted"
	LabelValueTenant         = "tenant"
)

Variables

This section is empty.

Functions

func ClientFromRemoteInfo added in v0.17.0

func ClientFromRemoteInfo(remote *sm.RemoteInfo) (*prom.ClientConfig, error)

func GetLocalAndRegionIDs added in v0.17.0

func GetLocalAndRegionIDs(id int64) (localID int64, regionID int)

func NewRegistry added in v0.17.0

func NewRegistry[T any]() *registry[T]

Types

type AlreadyRegisteredError added in v0.17.0

type AlreadyRegisteredError string

func (AlreadyRegisteredError) Error added in v0.17.0

func (e AlreadyRegisteredError) Error() string

type Factory added in v0.17.0

type Factory func(ctx context.Context, tm TenantProvider, logger zerolog.Logger, promRegisterer prometheus.Registerer) Publisher

type Metrics added in v0.17.0

type Metrics struct {
	PushCounter    *prometheus.CounterVec
	ErrorCounter   *prometheus.CounterVec
	BytesOut       *prometheus.CounterVec
	FailedCounter  *prometheus.CounterVec
	RetriesCounter *prometheus.CounterVec

	// For experimental publisher only
	DroppedCounter  *prometheus.CounterVec
	ResponseCounter *prometheus.CounterVec
}

Metrics contains the prometheus Metrics for a publisher.

func NewMetrics added in v0.17.0

func NewMetrics(promRegisterer prometheus.Registerer) (m Metrics)

NewMetrics returns a new set of publisher metrics registered in the given registerer.

func (Metrics) WithTenant added in v0.17.0

func (m Metrics) WithTenant(localID int64, regionID int) Metrics

WithTenant returns a new set of Metrics with the local and region ID labels already included.

func (Metrics) WithType added in v0.17.0

func (m Metrics) WithType(t string) Metrics

WithType returns a new set of Metrics with the given type label.

type NotFoundError added in v0.17.0

type NotFoundError struct {
	Requested string
	Accepted  []string
}

func (NotFoundError) Error added in v0.17.0

func (e NotFoundError) Error() string

type Payload

type Payload interface {
	Tenant() int64
	Metrics() []prompb.TimeSeries
	Streams() []logproto.Stream
}

type Publisher

type Publisher interface {
	Publish(Payload)
}

type TenantManager added in v0.0.18

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

func NewTenantManager added in v0.0.18

func NewTenantManager(ctx context.Context, tenantsClient sm.TenantsClient, tenantCh <-chan sm.Tenant, timeout time.Duration) *TenantManager

NewTenantManager creates a new tenant manager that is able to retrieve tenants from the remote API using the specified tenantsClient or receive them over the provided tenantCh channel. It will keep them for a duration no longer than `timeout`.

A new goroutine is started which stops when the provided context is cancelled.

func (*TenantManager) GetTenant added in v0.0.18

func (tm *TenantManager) GetTenant(ctx context.Context, req *sm.TenantInfo) (*sm.Tenant, error)

GetTenant retrieves the tenant specified by `req`, either from a local cache or by making a request to the API.

type TenantProvider added in v0.17.0

type TenantProvider interface {
	GetTenant(context.Context, *sm.TenantInfo) (*sm.Tenant, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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