Documentation ¶
Index ¶
- Constants
- type ActiveSeries
- type Config
- type Ingester
- func (i *Ingester) AllUserStats(_ context.Context, _ *client.UserStatsRequest) (*client.UsersStatsResponse, error)
- func (i *Ingester) CheckReady(ctx context.Context) error
- func (i *Ingester) Flush()
- func (i *Ingester) FlushHandler(w http.ResponseWriter, r *http.Request)
- func (i *Ingester) LabelNames(ctx context.Context, req *client.LabelNamesRequest) (*client.LabelNamesResponse, error)
- func (i *Ingester) LabelNamesStream(req *client.LabelNamesRequest, stream client.Ingester_LabelNamesStreamServer) error
- func (i *Ingester) LabelValues(ctx context.Context, req *client.LabelValuesRequest) (*client.LabelValuesResponse, error)
- func (i *Ingester) LabelValuesStream(req *client.LabelValuesRequest, stream client.Ingester_LabelValuesStreamServer) error
- func (i *Ingester) MetricsForLabelMatchers(ctx context.Context, req *client.MetricsForLabelMatchersRequest) (*client.MetricsForLabelMatchersResponse, error)
- func (i *Ingester) MetricsForLabelMatchersStream(req *client.MetricsForLabelMatchersRequest, ...) error
- func (i *Ingester) MetricsMetadata(ctx context.Context, _ *client.MetricsMetadataRequest) (*client.MetricsMetadataResponse, error)
- func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*cortexpb.WriteResponse, error)
- func (i *Ingester) QueryExemplars(ctx context.Context, req *client.ExemplarQueryRequest) (*client.ExemplarQueryResponse, error)
- func (i *Ingester) QueryStream(req *client.QueryRequest, stream client.Ingester_QueryStreamServer) error
- func (i *Ingester) RenewTokenHandler(w http.ResponseWriter, r *http.Request)
- func (i *Ingester) ShutdownHandler(w http.ResponseWriter, _ *http.Request)
- func (i *Ingester) UserStats(ctx context.Context, req *client.UserStatsRequest) (*client.UserStatsResponse, error)
- type InstanceLimits
- type Limiter
- func (l *Limiter) AssertMaxMetadataPerMetric(userID string, metadata int) error
- func (l *Limiter) AssertMaxMetricsWithMetadataPerUser(userID string, metrics int) error
- func (l *Limiter) AssertMaxSeriesPerLabelSet(userID string, metric labels.Labels, ...) error
- func (l *Limiter) AssertMaxSeriesPerMetric(userID string, series int) error
- func (l *Limiter) AssertMaxSeriesPerUser(userID string, series int) error
- func (l *Limiter) FormatError(userID string, err error) error
- type RingCount
- type Shipper
- type TSDBState
Constants ¶
const (
// RingKey is the key under which we store the ingesters ring in the KVStore.
RingKey = "ring"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveSeries ¶ added in v1.5.0
type ActiveSeries struct {
// contains filtered or unexported fields
}
ActiveSeries is keeping track of recently active series for a single tenant.
func NewActiveSeries ¶ added in v1.5.0
func NewActiveSeries() *ActiveSeries
func (*ActiveSeries) Active ¶ added in v1.5.0
func (c *ActiveSeries) Active() int
func (*ActiveSeries) Purge ¶ added in v1.5.0
func (c *ActiveSeries) Purge(keepUntil time.Time)
Purge removes expired entries from the cache. This function should be called periodically to avoid memory leaks.
type Config ¶
type Config struct { LifecyclerConfig ring.LifecyclerConfig `yaml:"lifecycler"` // Config for metadata purging. MetadataRetainPeriod time.Duration `yaml:"metadata_retain_period"` RateUpdatePeriod time.Duration `yaml:"rate_update_period"` UserTSDBConfigsUpdatePeriod time.Duration `yaml:"user_tsdb_configs_update_period"` ActiveSeriesMetricsEnabled bool `yaml:"active_series_metrics_enabled"` ActiveSeriesMetricsUpdatePeriod time.Duration `yaml:"active_series_metrics_update_period"` ActiveSeriesMetricsIdleTimeout time.Duration `yaml:"active_series_metrics_idle_timeout"` // Use blocks storage. BlocksStorageConfig cortex_tsdb.BlocksStorageConfig `yaml:"-"` // UploadCompactedBlocksEnabled enables uploading compacted blocks. UploadCompactedBlocksEnabled bool `yaml:"upload_compacted_blocks_enabled"` // Injected at runtime and read from the distributor config, required // to accurately apply global limits. DistributorShardingStrategy string `yaml:"-"` DistributorShardByAllLabels bool `yaml:"-"` // Injected at runtime and read from querier config. QueryIngestersWithin time.Duration `yaml:"-"` DefaultLimits InstanceLimits `yaml:"instance_limits"` InstanceLimitsFn func() *InstanceLimits `yaml:"-"` IgnoreSeriesLimitForMetricNames string `yaml:"ignore_series_limit_for_metric_names"` // For admin contact details AdminLimitMessage string `yaml:"admin_limit_message"` LabelsStringInterningEnabled bool `yaml:"labels_string_interning_enabled"` // contains filtered or unexported fields }
Config for an Ingester.
func (*Config) RegisterFlags ¶
RegisterFlags adds the flags required to config this to the given FlagSet
type Ingester ¶
type Ingester struct { *services.BasicService // Prometheus block storage TSDBState TSDBState // contains filtered or unexported fields }
Ingester deals with "in flight" chunks. Based on Prometheus 1.x MemorySeriesStorage.
func New ¶
func New(cfg Config, limits *validation.Overrides, registerer prometheus.Registerer, logger log.Logger) (*Ingester, error)
New returns a new Ingester that uses Cortex block storage instead of chunks storage.
func NewForFlusher ¶ added in v1.0.0
func NewForFlusher(cfg Config, limits *validation.Overrides, registerer prometheus.Registerer, logger log.Logger) (*Ingester, error)
NewForFlusher constructs a new Ingester to be used by flusher target. Compared to the 'New' method:
- Always replays the WAL.
- Does not start the lifecycler.
this is a special version of ingester used by Flusher. This ingester is not ingesting anything, its only purpose is to react on Flush method and flush all opened TSDBs when called.
func (*Ingester) AllUserStats ¶
func (i *Ingester) AllUserStats(_ context.Context, _ *client.UserStatsRequest) (*client.UsersStatsResponse, error)
AllUserStats returns ingestion statistics for all users known to this ingester.
func (*Ingester) CheckReady ¶ added in v0.7.0
CheckReady is the readiness handler used to indicate to k8s when the ingesters are ready for the addition or removal of another ingester.
func (*Ingester) Flush ¶
func (i *Ingester) Flush()
Flush triggers a flush of all the chunks and closes the flush queues. Called from the Lifecycler as part of the ingester shutdown.
func (*Ingester) FlushHandler ¶
func (i *Ingester) FlushHandler(w http.ResponseWriter, r *http.Request)
FlushHandler triggers a flush of all in memory chunks. Mainly used for local testing.
func (*Ingester) LabelNames ¶
func (i *Ingester) LabelNames(ctx context.Context, req *client.LabelNamesRequest) (*client.LabelNamesResponse, error)
LabelNames return all the label names.
func (*Ingester) LabelNamesStream ¶ added in v1.13.0
func (i *Ingester) LabelNamesStream(req *client.LabelNamesRequest, stream client.Ingester_LabelNamesStreamServer) error
LabelNamesStream return all the label names.
func (*Ingester) LabelValues ¶
func (i *Ingester) LabelValues(ctx context.Context, req *client.LabelValuesRequest) (*client.LabelValuesResponse, error)
LabelValues returns all label values that are associated with a given label name.
func (*Ingester) LabelValuesStream ¶ added in v1.13.0
func (i *Ingester) LabelValuesStream(req *client.LabelValuesRequest, stream client.Ingester_LabelValuesStreamServer) error
LabelValuesStream returns all label values that are associated with a given label name.
func (*Ingester) MetricsForLabelMatchers ¶
func (i *Ingester) MetricsForLabelMatchers(ctx context.Context, req *client.MetricsForLabelMatchersRequest) (*client.MetricsForLabelMatchersResponse, error)
MetricsForLabelMatchers returns all the metrics which match a set of matchers.
func (*Ingester) MetricsForLabelMatchersStream ¶ added in v1.13.0
func (i *Ingester) MetricsForLabelMatchersStream(req *client.MetricsForLabelMatchersRequest, stream client.Ingester_MetricsForLabelMatchersStreamServer) error
func (*Ingester) MetricsMetadata ¶ added in v1.1.0
func (i *Ingester) MetricsMetadata(ctx context.Context, _ *client.MetricsMetadataRequest) (*client.MetricsMetadataResponse, error)
MetricsMetadata returns all the metric metadata of a user.
func (*Ingester) Push ¶
func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*cortexpb.WriteResponse, error)
Push adds metrics to a block
func (*Ingester) QueryExemplars ¶ added in v1.10.0
func (i *Ingester) QueryExemplars(ctx context.Context, req *client.ExemplarQueryRequest) (*client.ExemplarQueryResponse, error)
QueryExemplars implements service.IngesterServer
func (*Ingester) QueryStream ¶
func (i *Ingester) QueryStream(req *client.QueryRequest, stream client.Ingester_QueryStreamServer) error
QueryStream implements service.IngesterServer Streams metrics from a TSDB. This implements the client.IngesterServer interface
func (*Ingester) RenewTokenHandler ¶ added in v1.18.0
func (i *Ingester) RenewTokenHandler(w http.ResponseWriter, r *http.Request)
func (*Ingester) ShutdownHandler ¶ added in v0.4.0
func (i *Ingester) ShutdownHandler(w http.ResponseWriter, _ *http.Request)
ShutdownHandler triggers the following set of operations in order:
- Change the state of ring to stop accepting writes.
- Flush all the chunks.
func (*Ingester) UserStats ¶
func (i *Ingester) UserStats(ctx context.Context, req *client.UserStatsRequest) (*client.UserStatsResponse, error)
UserStats returns ingestion statistics for the current user.
type InstanceLimits ¶ added in v1.9.0
type InstanceLimits struct { MaxIngestionRate float64 `yaml:"max_ingestion_rate"` MaxInMemoryTenants int64 `yaml:"max_tenants"` MaxInMemorySeries int64 `yaml:"max_series"` MaxInflightPushRequests int64 `yaml:"max_inflight_push_requests"` MaxInflightQueryRequests int64 `yaml:"max_inflight_query_requests"` }
InstanceLimits describes limits used by ingester. Reaching any of these will result in Push method to return (internal) error.
func (*InstanceLimits) UnmarshalYAML ¶ added in v1.9.0
func (l *InstanceLimits) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface. If give
type Limiter ¶ added in v1.1.0
type Limiter struct { AdminLimitMessage string // contains filtered or unexported fields }
Limiter implements primitives to get the maximum number of series an ingester can handle for a specific tenant
func NewLimiter ¶ added in v1.1.0
func NewLimiter( limits *validation.Overrides, ring RingCount, shardingStrategy string, shardByAllLabels bool, replicationFactor int, zoneAwarenessEnabled bool, AdminLimitMessage string, ) *Limiter
NewLimiter makes a new in-memory series limiter
func (*Limiter) AssertMaxMetadataPerMetric ¶ added in v1.1.0
AssertMaxMetadataPerMetric limit has not been reached compared to the current number of metadata per metric in input and returns an error if so.
func (*Limiter) AssertMaxMetricsWithMetadataPerUser ¶ added in v1.1.0
AssertMaxMetricsWithMetadataPerUser limit has not been reached compared to the current number of metrics with metadata in input and returns an error if so.
func (*Limiter) AssertMaxSeriesPerLabelSet ¶ added in v1.18.0
func (l *Limiter) AssertMaxSeriesPerLabelSet(userID string, metric labels.Labels, f func(validation.LimitsPerLabelSet) (int, error)) error
AssertMaxSeriesPerLabelSet limit has not been reached compared to the current number of metrics with metadata in input and returns an error if so.
func (*Limiter) AssertMaxSeriesPerMetric ¶ added in v1.1.0
AssertMaxSeriesPerMetric limit has not been reached compared to the current number of series in input and returns an error if so.
func (*Limiter) AssertMaxSeriesPerUser ¶ added in v1.1.0
AssertMaxSeriesPerUser limit has not been reached compared to the current number of series in input and returns an error if so.
type RingCount ¶ added in v0.4.0
RingCount is the interface exposed by a ring implementation which allows to count members