cortex

package
v0.12.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 70 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CortexAggregationSelector added in v0.11.0

func CortexAggregationSelector(ik sdkmetric.InstrumentKind) aggregation.Aggregation

func PartitionById added in v0.9.1

func PartitionById[T any](arr []*T, idForElement func(int) string, callback func(id string, start, end int))

PartitionById arranges the elements of a slice into any number of partitions, where each partition contains elements grouped by a common ID. This function returns a list of partitions, where each has a start and end index and corresponding ID. The partition slice returned from this function should be reused by calling ReusePartitionSlice.

The order of partitions (by ID) are as follows:
1. The first partition ID is the ID at index 0.
2. Subsequent partition IDs are in the inverse order of appearance when
   iterating backwards through the array.

For example:
  IDs:   A | D B A C A D A D E D D E B D E F C G D H A A H J D C C C I A
Index:   0 |                         9   8 7   6         5 4 3     2 1
           | -> partition order                   order of appearance <-
Partition Order: A B E F G H J D C I

func RegisterMeterProvider added in v0.11.0

func RegisterMeterProvider(mp *sdkmetric.MeterProvider)

Types

type ClientSet

type ClientSet interface {
	Distributor() DistributorClient
	Ingester() IngesterClient
	Ruler() RulerClient
	Purger() PurgerClient
	Compactor() CompactorClient
	StoreGateway() StoreGatewayClient
	QueryFrontend() QueryFrontendClient
	Querier() QuerierClient
	HTTP(options ...HTTPClientOption) *http.Client
}

func NewClientSet

func NewClientSet(ctx context.Context, cortexSpec *v1beta1.CortexSpec, tlsConfig *tls.Config) (ClientSet, error)

type CompactorClient

type CompactorClient interface {
	Status(ctx context.Context) (*cortexadmin.CompactorStatus, error)
}

type ConfigClient

type ConfigClient interface {
	Config(ctx context.Context, mode ...ConfigMode) (string, error)
}

type ConfigMode

type ConfigMode string
const (
	Diff     ConfigMode = "diff"
	Defaults ConfigMode = "defaults"
)

type CortexAdminServer

func (*CortexAdminServer) AllUserStats

func (*CortexAdminServer) DeleteRule

func (*CortexAdminServer) ExtractRawSeries

func (*CortexAdminServer) FlushBlocks

func (p *CortexAdminServer) FlushBlocks(
	ctx context.Context,
	_ *emptypb.Empty,
) (*emptypb.Empty, error)

func (*CortexAdminServer) GetCortexConfig

func (*CortexAdminServer) GetCortexStatus

func (p *CortexAdminServer) GetCortexStatus(ctx context.Context, _ *emptypb.Empty) (*cortexadmin.CortexStatus, error)

func (*CortexAdminServer) GetMetricLabelSets

func (p *CortexAdminServer) GetMetricLabelSets(ctx context.Context, request *cortexadmin.LabelRequest) (*cortexadmin.MetricLabels, error)

func (*CortexAdminServer) GetMetricMetadata added in v0.9.1

func (*CortexAdminServer) GetRule

func (*CortexAdminServer) GetSeriesMetrics

func (*CortexAdminServer) Initialize

func (p *CortexAdminServer) Initialize(conf CortexAdminServerConfig)

func (*CortexAdminServer) ListRules

func (*CortexAdminServer) LoadRules

LoadRules This method is responsible for Creating and Updating Rules

func (*CortexAdminServer) Query

func (*CortexAdminServer) QueryRange

func (*CortexAdminServer) WriteMetrics

type CortexAdminServerConfig

type CortexAdminServerConfig struct {
	CortexClientSet ClientSet                  `validate:"required"`
	Config          *v1beta1.GatewayConfigSpec `validate:"required"`
	Logger          *slog.Logger               `validate:"required"`
}

type DataFormat

type DataFormat string
const (
	// Rule data formatted as a single YAML document containing yaml-encoded
	// []rulefmt.RuleGroup keyed by tenant ID:
	// <tenantID>:
	//   - name: ...
	//     rules: [...]
	NamespaceKeyedYAML DataFormat = "namespace-keyed-yaml"
	// Rule data formatted as JSON containing the prometheus response metadata
	// and a list of rule groups, each of which has a field "file" containing
	// the tenant ID:
	// {"status":"success","data":{"groups":["file":"<tenantID>", ...]}}
	PrometheusRuleGroupsJSON DataFormat = "prometheus-rule-groups-json"
)

type HTTPClientOption

type HTTPClientOption func(*HTTPClientOptions)

func WithServerNameOverride

func WithServerNameOverride(serverNameOverride string) HTTPClientOption

type HTTPClientOptions

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

type HttpApiServer

type HttpApiServer struct {
	HttpApiServerConfig
	util.Initializer
}

func (*HttpApiServer) ConfigureRoutes

func (p *HttpApiServer) ConfigureRoutes(router *gin.Engine)

func (*HttpApiServer) Initialize

func (p *HttpApiServer) Initialize(config HttpApiServerConfig)

type HttpApiServerConfig

type HttpApiServerConfig struct {
	PluginContext    context.Context               `validate:"required"`
	ManagementClient managementv1.ManagementClient `validate:"required"`
	CortexClientSet  ClientSet                     `validate:"required"`
	Config           *v1beta1.GatewayConfigSpec    `validate:"required"`
	CortexTLSConfig  *tls.Config                   `validate:"required"`
	Logger           *slog.Logger                  `validate:"required"`
	StorageBackend   storage.Backend               `validate:"required"`
	AuthMiddlewares  map[string]auth.Middleware    `validate:"required"`
}

type IngesterClient

type IngesterClient interface {
	Status(ctx context.Context) (*cortexadmin.IngesterStatus, error)
}

type InterceptorConfig added in v0.9.1

type InterceptorConfig struct {
	// The label to use as the tenant ID
	IdLabelName string
}

type MemberlistStatusClient

type MemberlistStatusClient interface {
	MemberlistStatus(ctx context.Context) (*cortexadmin.MemberlistStatus, error)
}

type MultiTenantRuleAggregator

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

func NewMultiTenantRuleAggregator

func NewMultiTenantRuleAggregator(
	client managementv1.ManagementClient,
	cortexClient *http.Client,
	headerCodec rbac.HeaderCodec,
	format DataFormat,
) *MultiTenantRuleAggregator

func (*MultiTenantRuleAggregator) Handle

func (a *MultiTenantRuleAggregator) Handle(c *gin.Context)

type Partition added in v0.9.1

type Partition struct {
	Id         string
	Start, End int
}

type PurgerClient

type PurgerClient interface {
	Status(ctx context.Context) (*cortexadmin.PurgerStatus, error)
}

type QuerierClient

type QuerierClient interface {
	Status(ctx context.Context) (*cortexadmin.QuerierStatus, error)
}

type QueryFrontendClient

type QueryFrontendClient interface {
	Status(ctx context.Context) (*cortexadmin.QueryFrontendStatus, error)
}

type RemoteWriteForwarder

type RemoteWriteForwarder struct {
	remotewrite.UnsafeRemoteWriteServer
	RemoteWriteForwarderConfig

	util.Initializer
	// contains filtered or unexported fields
}

func (*RemoteWriteForwarder) Initialize

func (*RemoteWriteForwarder) Push

func (f *RemoteWriteForwarder) Push(ctx context.Context, writeReq *cortexpb.WriteRequest) (_ *cortexpb.WriteResponse, pushErr error)

func (*RemoteWriteForwarder) SyncRules

func (f *RemoteWriteForwarder) SyncRules(ctx context.Context, payload *remotewrite.Payload) (_ *emptypb.Empty, syncErr error)

type RemoteWriteForwarderConfig

type RemoteWriteForwarderConfig struct {
	CortexClientSet ClientSet                  `validate:"required"`
	Config          *v1beta1.GatewayConfigSpec `validate:"required"`
	Logger          *slog.Logger               `validate:"required"`
}

type RequestInterceptor added in v0.9.1

type RequestInterceptor interface {
	Intercept(ctx context.Context, req *cortexpb.WriteRequest, handler WriteHandlerFunc) (*cortexpb.WriteResponse, error)
}

func NewFederatingInterceptor added in v0.9.1

func NewFederatingInterceptor(conf InterceptorConfig) RequestInterceptor

type RingStatusClient

type RingStatusClient interface {
	RingStatus(ctx context.Context) (*cortexadmin.RingStatus, error)
}

type RulerClient

type RulerClient interface {
	ruler.RulerClient
	Status(ctx context.Context) (*cortexadmin.RulerStatus, error)
}

type ServicesStatusClient

type ServicesStatusClient interface {
	ServicesStatus(ctx context.Context) (*cortexadmin.ServiceStatusList, error)
}

type StoreGatewayClient

type StoreGatewayClient interface {
	Status(ctx context.Context) (*cortexadmin.StoreGatewayStatus, error)
}

type UninstallTaskRunner

func (*UninstallTaskRunner) Initialize

func (a *UninstallTaskRunner) Initialize(conf UninstallTaskRunnerConfig)

func (*UninstallTaskRunner) OnTaskCompleted

func (a *UninstallTaskRunner) OnTaskCompleted(ctx context.Context, ti task.ActiveTask, state task.State, args ...any)

func (*UninstallTaskRunner) OnTaskRunning

func (a *UninstallTaskRunner) OnTaskRunning(ctx context.Context, ti task.ActiveTask) error

type UninstallTaskRunnerConfig

type UninstallTaskRunnerConfig struct {
	CortexClientSet ClientSet                  `validate:"required"`
	Config          *v1beta1.GatewayConfigSpec `validate:"required"`
	StorageBackend  storage.Backend            `validate:"required"`
}

type WriteHandlerFunc added in v0.9.1

type WriteHandlerFunc = func(context.Context, *cortexpb.WriteRequest, ...grpc.CallOption) (*cortexpb.WriteResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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