options

package
v0.0.0-...-e1e1857 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package options handles the command line flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointType

type EndpointType string
const (
	LogsEndpointType    EndpointType = "logs"
	MetricsEndpointType EndpointType = "metrics"
)

type LabelSpec

type LabelSpec struct {
	Name     string         `yaml:"name"`
	Label    string         `yaml:"label"`
	Duration model.Duration `yaml:"duration"`
	Cache    bool           `yaml:"cache"`
}

func (LabelSpec) GetName

func (q LabelSpec) GetName() string

func (LabelSpec) GetQuery

func (q LabelSpec) GetQuery() string

func (LabelSpec) GetType

func (q LabelSpec) GetType() string

func (LabelSpec) Run

func (q LabelSpec) Run(ctx context.Context, c promapi.Client, logger log.Logger, traceID string,
	_ time.Duration) (int, promapiv1.Warnings, error)

type LogsSpec

type LogsSpec struct {
	Logs logs `yaml:"logs"`
}

type Options

type Options struct {
	LogLevel          level.Option
	EndpointType      EndpointType
	WriteEndpoint     *url.URL
	ReadEndpoint      *url.URL
	Labels            labelArg
	Logs              logs
	Listen            string
	Name              string
	Token             auth.TokenProvider
	Queries           []Query
	Period            time.Duration
	Duration          time.Duration
	Latency           time.Duration
	InitialQueryDelay time.Duration
	SuccessThreshold  float64
	TLS               TLS
	DefaultStep       time.Duration
	Tenant            string
	TenantHeader      string
}

type Query

type Query interface {
	// GetName gets the name of the query.
	GetName() string
	// GetType gets the query type.
	GetType() string
	// GetQuery gets the query statement (promql) or label/matchers of the query.
	GetQuery() string
	// Run executes the query.
	Run(ctx context.Context, c promapi.Client, logger log.Logger, traceID string,
		defaultStep time.Duration) (int, promapiv1.Warnings, error)
}

Query represents different types of queries.

type QuerySpec

type QuerySpec struct {
	Name     string         `yaml:"name"`
	Query    string         `yaml:"query"`
	Duration model.Duration `yaml:"duration,omitempty"`
	Step     time.Duration  `yaml:"step,omitempty"`
	Cache    bool           `yaml:"cache,omitempty"`
}

func (QuerySpec) GetName

func (q QuerySpec) GetName() string

func (QuerySpec) GetQuery

func (q QuerySpec) GetQuery() string

func (QuerySpec) GetType

func (q QuerySpec) GetType() string

func (QuerySpec) Run

func (q QuerySpec) Run(ctx context.Context, c promapi.Client, logger log.Logger, traceID string,
	defaultStep time.Duration) (int, promapiv1.Warnings, error)

type SeriesSpec

type SeriesSpec struct {
	Name     string         `yaml:"name"`
	Matchers []string       `yaml:"matchers"`
	Duration model.Duration `yaml:"duration"`
	Cache    bool           `yaml:"cache"`
}

func (SeriesSpec) GetName

func (q SeriesSpec) GetName() string

func (SeriesSpec) GetQuery

func (q SeriesSpec) GetQuery() string

func (SeriesSpec) GetType

func (q SeriesSpec) GetType() string

func (SeriesSpec) Run

func (q SeriesSpec) Run(ctx context.Context, c promapi.Client, logger log.Logger, traceID string,
	_ time.Duration) (int, promapiv1.Warnings, error)

type TLS

type TLS struct {
	Cert   string
	Key    string
	CACert string
}

Jump to

Keyboard shortcuts

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