v1

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 50 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DedupParam               = "dedup"
	PartialResponseParam     = "partial_response"
	MaxSourceResolutionParam = "max_source_resolution"
	ReplicaLabelsParam       = "replicaLabels[]"
	MatcherParam             = "match[]"
	StoreMatcherParam        = "storeMatch[]"
	Step                     = "step"
	Stats                    = "stats"
	ShardInfoParam           = "shard_info"
	LookbackDeltaParam       = "lookback_delta"
	EngineParam              = "engine"
	QueryAnalyzeParam        = "analyze"
)

Variables

This section is empty.

Functions

func NewAlertsHandler added in v0.28.0

func NewAlertsHandler(client rules.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *api.ApiError, func())

NewAlertsHandler created handler compatible with HTTP /api/v1/alerts https://prometheus.io/docs/prometheus/latest/querying/api/#alerts which uses gRPC Unary Rules API (Rules API works for both /alerts and /rules).

func NewExemplarsHandler added in v0.20.0

func NewExemplarsHandler(client exemplars.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *api.ApiError, func())

NewExemplarsHandler creates handler compatible with HTTP /api/v1/query_exemplars https://prometheus.io/docs/prometheus/latest/querying/api/#querying-exemplars which uses gRPC Unary Exemplars API.

func NewMetricMetadataHandler added in v0.19.0

func NewMetricMetadataHandler(client metadata.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *api.ApiError, func())

NewMetricMetadataHandler creates handler compatible with HTTP /api/v1/metadata https://prometheus.io/docs/prometheus/latest/querying/api/#querying-metric-metadata which uses gRPC Unary Metadata API.

func NewRulesHandler

func NewRulesHandler(client rules.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *api.ApiError, func())

NewRulesHandler created handler compatible with HTTP /api/v1/rules https://prometheus.io/docs/prometheus/latest/querying/api/#rules which uses gRPC Unary Rules API.

func NewTargetsHandler added in v0.20.0

func NewTargetsHandler(client targets.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *api.ApiError, func())

NewTargetsHandler created handler compatible with HTTP /api/v1/targets https://prometheus.io/docs/prometheus/latest/querying/api/#targets which uses gRPC Unary Targets API.

func RegisterQueryServer added in v0.26.0

func RegisterQueryServer(queryServer querypb.QueryServer) func(*grpc.Server)

Types

type GRPCAPI added in v0.26.0

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

func NewGRPCAPI added in v0.26.0

func NewGRPCAPI(
	now func() time.Time,
	replicaLabels []string,
	creator query.QueryableCreator,
	engineFactory *QueryEngineFactory,
	defaultEngine querypb.EngineType,
	lookbackDeltaCreate func(int64) time.Duration,
	defaultMaxResolutionSeconds time.Duration,
) *GRPCAPI

func (*GRPCAPI) Query added in v0.26.0

func (g *GRPCAPI) Query(request *querypb.QueryRequest, server querypb.Query_QueryServer) error

func (*GRPCAPI) QueryRange added in v0.26.0

type PromqlEngineType added in v0.32.0

type PromqlEngineType string
const (
	PromqlEnginePrometheus PromqlEngineType = "prometheus"
	PromqlEngineThanos     PromqlEngineType = "thanos"
)

type QueryAPI

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

QueryAPI is an API used by Thanos Querier.

func NewQueryAPI

func NewQueryAPI(
	logger log.Logger,
	endpointStatus func() []query.EndpointStatus,
	engineFactory *QueryEngineFactory,
	defaultEngine PromqlEngineType,
	lookbackDeltaCreate func(int64) time.Duration,
	c query.QueryableCreator,
	ruleGroups rules.UnaryClient,
	targets targets.UnaryClient,
	metadatas metadata.UnaryClient,
	exemplars exemplars.UnaryClient,
	enableAutodownsampling bool,
	enableQueryPartialResponse bool,
	enableRulePartialResponse bool,
	enableTargetPartialResponse bool,
	enableMetricMetadataPartialResponse bool,
	enableExemplarPartialResponse bool,
	replicaLabels []string,
	flagsMap map[string]string,
	defaultRangeQueryStep time.Duration,
	defaultInstantQueryMaxSourceResolution time.Duration,
	defaultMetadataTimeRange time.Duration,
	disableCORS bool,
	gate gate.Gate,
	statsAggregatorFactory store.SeriesQueryPerformanceMetricsAggregatorFactory,
	reg *prometheus.Registry,
	tenantHeader string,
	defaultTenant string,
	tenantCertField string,
	enforceTenancy bool,
	tenantLabel string,
) *QueryAPI

NewQueryAPI returns an initialized QueryAPI type.

func (*QueryAPI) Register

func (qapi *QueryAPI) Register(r *route.Router, tracer opentracing.Tracer, logger log.Logger, ins extpromhttp.InstrumentationMiddleware, logMiddleware *logging.HTTPServerMiddleware)

Register the API's endpoints in the given router.

type QueryEngineFactory added in v0.32.0

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

func NewQueryEngineFactory added in v0.32.0

func NewQueryEngineFactory(engineOpts promql.EngineOpts, remoteEngineEndpoints promqlapi.RemoteEndpoints, enableExtendedFunctions bool) *QueryEngineFactory

func (*QueryEngineFactory) GetPrometheusEngine added in v0.32.0

func (f *QueryEngineFactory) GetPrometheusEngine() promql.QueryEngine

func (*QueryEngineFactory) GetThanosEngine added in v0.32.0

func (f *QueryEngineFactory) GetThanosEngine() ThanosEngine

type ThanosEngine added in v0.35.0

type ThanosEngine interface {
	promql.QueryEngine
	NewInstantQueryFromPlan(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, plan logicalplan.Node, ts time.Time) (promql.Query, error)
	NewRangeQueryFromPlan(ctx context.Context, q storage.Queryable, opts promql.QueryOpts, root logicalplan.Node, start, end time.Time, step time.Duration) (promql.Query, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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