api

package
v0.0.0-...-2a93a25 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrometheus

func NewPrometheus(
	queryable storage.SampleAndChunkQueryable,
	appendable storage.Appendable,
	maxConcurrent int,
	metricRegistry prometheus.Registerer,
	useThanosPromQLEngine bool,
	apiLogger zerolog.Logger,
) *v1.API

NewPrometheus returns a new initialized Prometheus web API. Only remote read/write and PromQL endpoints are implemented. appendable can be empty if remote write is not used.

Types

type API

type API struct {
	ListenAddress               string
	ReadOnly                    bool
	Index                       types.Index
	Reader                      types.MetricReader
	Writer                      types.MetricWriter
	MutableLabelWriter          MutableLabelInterface
	FlushCallback               func() error
	PreAggregateCallback        func(ctx context.Context, thread int, from, to time.Time, matchers []*labels.Matcher) error
	MaxConcurrentRemoteRequests int
	// MaxRequestBodySizeBytes defines the maximum size of incoming requests body.
	MaxRequestBodySizeBytes  int64
	PromQLMaxEvaluatedPoints uint64
	MetricRegistry           prometheus.Registerer
	PromQLMaxEvaluatedSeries uint32
	TenantLabelName          string
	MutableLabelDetector     remotestorage.MutableLabelDetector
	// When enabled, return an response to queries and write
	// requests that don't provide the tenant header.
	RequireTenantHeader   bool
	UseThanosPromQLEngine bool
	Logger                zerolog.Logger

	FuturePointsBackdateOffset time.Duration
	// contains filtered or unexported fields
}

API it the SquirrelDB HTTP API server.

func (*API) ListenPort

func (a *API) ListenPort() int

ListenPort return the port listenning on. Should not be used before Run() signalled its readiness. This is useful for tests that use port "0" to known the actual listenning port.

func (*API) Ready

func (a *API) Ready()

Ready mark the system as ready to access requests.

func (*API) Run

func (a *API) Run(ctx context.Context, readiness chan error)

Run start the HTTP api server.

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, req *http.Request)

type MutableLabelInterface

type MutableLabelInterface interface {
	WriteLabelValues(ctx context.Context, lbls []mutable.LabelWithValues) error
	DeleteLabelValues(ctx context.Context, lbls []mutable.Label) error
	WriteLabelNames(ctx context.Context, lbls []mutable.LabelWithName) error
	DeleteLabelNames(ctx context.Context, names []mutable.LabelKey) error
	Dump(ctx context.Context, w io.Writer) error
	Import(ctx context.Context, r io.Reader, w io.Writer, dryRun bool) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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