pattern

package
v4.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: AGPL-3.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string        `yaml:"username"           json:"username"`
	Password config.Secret `yaml:"password,omitempty" json:"password,omitempty"`
}

BasicAuth contains basic HTTP authentication credentials.

func (*BasicAuth) RegisterFlagsWithPrefix

func (cfg *BasicAuth) RegisterFlagsWithPrefix(prefix string, fs *flag.FlagSet)

type Config

type Config struct {
	Enabled               bool                  `yaml:"enabled,omitempty" doc:"description=Whether the pattern ingester is enabled."`
	LifecyclerConfig      ring.LifecyclerConfig `` /* 153-byte string literal not displayed */
	ClientConfig          clientpool.Config     `yaml:"client_config,omitempty" doc:"description=Configures how the pattern ingester will connect to the ingesters."`
	ConcurrentFlushes     int                   `yaml:"concurrent_flushes"`
	FlushCheckPeriod      time.Duration         `yaml:"flush_check_period"`
	MaxClusters           int                   `` /* 127-byte string literal not displayed */
	MaxEvictionRatio      float64               `` /* 177-byte string literal not displayed */
	MetricAggregation     aggregation.Config    `` /* 133-byte string literal not displayed */
	PatternPersistence    PersistenceConfig     `` /* 128-byte string literal not displayed */
	TeeConfig             TeeConfig             `yaml:"tee_config,omitempty" doc:"description=Configures the pattern tee which forwards requests to the pattern ingester."`
	ConnectionTimeout     time.Duration         `yaml:"connection_timeout"`
	MaxAllowedLineLength  int                   `` /* 130-byte string literal not displayed */
	RetainFor             time.Duration         `yaml:"retain_for,omitempty" doc:"description=How long to retain patterns in the pattern ingester after they are pushed."`
	MaxChunkAge           time.Duration         `yaml:"max_chunk_age,omitempty" doc:"description=The maximum time span for a single pattern chunk."`
	PatternSampleInterval time.Duration         `yaml:"pattern_sample_interval,omitempty" doc:"description=The time resolution for pattern samples within chunks."`
	VolumeThreshold       float64               `` /* 176-byte string literal not displayed */
	KafkaIngestion        KafkaIngestionConfig  `yaml:"kafka_ingestion,omitempty" category:"experimental" doc:"description=Configures consumption of log entries from Kafka."`
	// contains filtered or unexported fields
}

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(fs *flag.FlagSet)

RegisterFlags registers pattern ingester related flags.

func (*Config) Validate

func (cfg *Config) Validate() error

type Ingester

type Ingester struct {
	services.Service
	// contains filtered or unexported fields
}

func New

func New(
	cfg Config,
	limits Limits,
	ringClient RingClient,
	metricsNamespace string,
	registerer prometheus.Registerer,
	logger log.Logger,
) (*Ingester, error)

func (*Ingester) CheckReady

func (i *Ingester) CheckReady(ctx context.Context) error

ReadinessHandler is used to indicate to k8s when the ingesters are ready for the addition removal of another ingester. Returns 204 when the ingester is ready, 500 otherwise.

func (*Ingester) Flush

func (i *Ingester) Flush()

func (*Ingester) GetOrCreateInstance

func (i *Ingester) GetOrCreateInstance(instanceID string) (*instance, error)

func (*Ingester) Push

func (*Ingester) PushInternal

PushInternal accepts streams in the internal data model, with resource and scope attributes shared by their entries. It expands them on arrival and handles them like Push.

func (*Ingester) Query

func (*Ingester) ServeHTTP

func (i *Ingester) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the pattern ring status page.

func (*Ingester) TransferOut

func (i *Ingester) TransferOut(_ context.Context) error

func (*Ingester) Watch

Watch implements grpc_health_v1.HealthCheck.

type IngesterQuerier

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

func NewIngesterQuerier

func NewIngesterQuerier(
	cfg Config,
	ringClient RingClient,
	metricsNamespace string,
	registerer prometheus.Registerer,
	logger log.Logger,
) (*IngesterQuerier, error)

func (*IngesterQuerier) Patterns

type KafkaIngestionConfig

type KafkaIngestionConfig struct {
	Enabled        bool          `` /* 301-byte string literal not displayed */
	ConsumerGroup  string        `yaml:"consumer_group" doc:"description=The consumer group of the pattern ingesters."`
	SessionTimeout time.Duration `` /* 277-byte string literal not displayed */
	KafkaConfig    kafka.Config  `yaml:"-"`
}

KafkaIngestionConfig configures the pattern ingester to consume log entries from the same Kafka topic as the ingesters.

func (*KafkaIngestionConfig) RegisterFlags

func (cfg *KafkaIngestionConfig) RegisterFlags(fs *flag.FlagSet)

RegisterFlags registers pattern ingester Kafka ingestion related flags.

type Limits

type Limits interface {
	drain.Limits
	MetricAggregationEnabled(userID string) bool
	PatternPersistenceEnabled(userID string) bool
	PersistenceGranularity(userID string) time.Duration
	PatternRateThreshold(userID string) float64
}

type PersistenceConfig

type PersistenceConfig struct {
	LokiAddr         string                  `yaml:"loki_address,omitempty" doc:"description=The address of the Loki instance to push patterns to."`
	WriteTimeout     time.Duration           `yaml:"timeout,omitempty" doc:"description=The timeout for writing patterns to Loki."`
	PushPeriod       time.Duration           `yaml:"push_period,omitempty" doc:"description=How long to wait between pattern pushes to Loki."`
	HTTPClientConfig config.HTTPClientConfig `yaml:"http_client_config,omitempty" doc:"description=The HTTP client configuration for pushing patterns to Loki."`
	UseTLS           bool                    `yaml:"use_tls,omitempty" doc:"description=Whether to use TLS for pushing patterns to Loki."`
	BasicAuth        BasicAuth               `yaml:"basic_auth,omitempty" doc:"description=The basic auth configuration for pushing patterns to Loki."`
	BackoffConfig    backoff.Config          `yaml:"backoff_config,omitempty" doc:"description=The backoff configuration for pushing patterns to Loki."`
	BatchSize        int                     `yaml:"batch_size,omitempty" doc:"description=The maximum number of patterns to accumulate before pushing."`
}

PersistenceConfig contains the configuration for pushing detected patterns back to Loki

func (*PersistenceConfig) RegisterFlags

func (cfg *PersistenceConfig) RegisterFlags(fs *flag.FlagSet)

RegisterFlags registers pattern push related flags.

func (*PersistenceConfig) RegisterFlagsWithPrefix

func (cfg *PersistenceConfig) RegisterFlagsWithPrefix(fs *flag.FlagSet, prefix string)

type ResponseFromIngesters

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

type RingClient

type RingClient interface {
	services.Service
	Ring() ring.ReadRing
	GetClientFor(addr string) (ring_client.PoolClient, error)
}

func NewRingClient

func NewRingClient(
	cfg Config,
	metricsNamespace string,
	registerer prometheus.Registerer,
	logger log.Logger,
) (RingClient, error)

type TeeConfig

type TeeConfig struct {
	BatchFlushInterval time.Duration `yaml:"batch_flush_interval"`
	FlushQueueSize     int           `yaml:"flush_queue_size"`
	FlushWorkerCount   int           `yaml:"flush_worker_count"`
	MaxBufferedBytes   int           `yaml:"max_buffered_bytes"`
	StopFlushTimeout   time.Duration `yaml:"stop_flush_timeout"`
}

func (*TeeConfig) RegisterFlags

func (cfg *TeeConfig) RegisterFlags(f *flag.FlagSet, prefix string)

type TeeService

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

func NewTeeService

func NewTeeService(
	cfg Config,
	limits Limits,
	ringClient RingClient,
	tenantCfgs *runtime.TenantConfigs,
	metricsNamespace string,
	reg prometheus.Registerer,
	logger log.Logger,
) (*TeeService, error)

func (*TeeService) Duplicate

func (ts *TeeService) Duplicate(_ context.Context, tenant string, streams []distributor.KeyedStream, _ *distributor.PushTracker)

Duplicate Implements distributor.Tee which is used to tee distributor requests to pattern ingesters.

func (*TeeService) Register

func (*TeeService) Start

func (ts *TeeService) Start(runCtx context.Context) error

func (*TeeService) WaitUntilDone

func (ts *TeeService) WaitUntilDone()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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