Documentation
¶
Overview ¶
Package tsdb implements Client client
Index ¶
- Variables
- type Client
- func (t *Client) Available() bool
- func (t *Client) Delete(ctx context.Context, startTime time.Time, endTime time.Time, matchers []string) error
- func (t *Client) Labels(ctx context.Context, matchers []string, start time.Time, end time.Time) ([]string, error)
- func (t *Client) Ping() error
- func (t *Client) Query(ctx context.Context, query string, queryTime time.Time) (Metric, error)
- func (t *Client) RangeQuery(ctx context.Context, query string, startTime time.Time, endTime time.Time, ...) (RangeMetric, error)
- func (t *Client) Series(ctx context.Context, matchers []string, start time.Time, end time.Time) ([]model.LabelSet, error)
- func (t *Client) Settings(ctx context.Context) *Settings
- func (t *Client) String() string
- type Config
- type Data
- type Metric
- type RangeMetric
- type Response
- type Result
- type Settings
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingData = errors.New("missing data in Client response") ErrMissingConfig = errors.New("global config not found in Client config") ErrFailedTypeAssertion = errors.New("failed type assertion") )
Custom errors.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.6.0
type Client struct { URL *url.URL API v1.API Logger *slog.Logger // contains filtered or unexported fields }
Client struct.
func New ¶ added in v0.2.0
func New(webURL string, config config_util.HTTPClientConfig, logger *slog.Logger) (*Client, error)
New returns a new instance of Client.
func (*Client) Delete ¶ added in v0.6.0
func (t *Client) Delete(ctx context.Context, startTime time.Time, endTime time.Time, matchers []string) error
Delete time series with given labels.
func (*Client) Labels ¶ added in v0.6.0
func (t *Client) Labels(ctx context.Context, matchers []string, start time.Time, end time.Time) ([]string, error)
Labels makes a Client query to get list of labels.
func (*Client) RangeQuery ¶ added in v0.6.0
func (t *Client) RangeQuery( ctx context.Context, query string, startTime time.Time, endTime time.Time, step time.Duration, ) (RangeMetric, error)
RangeQuery makes a Client range query.
func (*Client) Series ¶ added in v0.6.0
func (t *Client) Series(ctx context.Context, matchers []string, start time.Time, end time.Time) ([]model.LabelSet, error)
Series makes a Client query to get series.
type Config ¶ added in v0.6.0
type Config struct { Global struct { ScrapeInterval model.Duration `yaml:"scrape_interval"` EvaluationInterval model.Duration `yaml:"evaluation_interval"` } `yaml:"global"` }
Config is Prometheus config representation.
type RangeMetric ¶ added in v0.3.1
type RangeMetric map[string][]model.SamplePair
RangeMetric defines Client range metrics.
type Response ¶
type Response[T any] struct { Status string `json:"status"` Data T `json:"data,omitempty"` ErrorType string `json:"errorType,omitempty"` Error string `json:"error,omitempty"` Warnings []string `json:"warnings,omitempty"` }
Response is the Client response model.
Click to show internal directories.
Click to hide internal directories.