Documentation
¶
Overview ¶
Package tsdb implements TSDB client
Index ¶
- Variables
- func Request(ctx context.Context, url string, client *http.Client) (interface{}, error)
- type Metric
- type RangeMetric
- type Response
- type TSDB
- func (t *TSDB) Available() bool
- func (t *TSDB) Config(ctx context.Context) (map[interface{}]interface{}, error)
- func (t *TSDB) Delete(ctx context.Context, startTime time.Time, endTime time.Time, matchers []string) error
- func (t *TSDB) Flags(ctx context.Context) (map[string]interface{}, error)
- func (t *TSDB) GlobalConfig(ctx context.Context) (map[string]interface{}, error)
- func (t *TSDB) Intervals(ctx context.Context) map[string]time.Duration
- func (t *TSDB) Ping() error
- func (t *TSDB) Query(ctx context.Context, query string, queryTime time.Time) (Metric, error)
- func (t *TSDB) RangeQuery(ctx context.Context, query string, startTime time.Time, endTime time.Time, ...) (RangeMetric, error)
- func (t *TSDB) RateInterval(ctx context.Context) time.Duration
- func (t *TSDB) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingData = errors.New("missing data in TSDB response") ErrMissingConfig = errors.New("global config not found in TSDB config") ErrFailedTypeAssertion = errors.New("failed type assertion") )
Custom errors.
Functions ¶
Types ¶
type RangeMetric ¶ added in v0.3.1
type RangeMetric map[string][]interface{}
RangeMetric defines TSDB range metrics.
type Response ¶
type Response struct { Status string `json:"status"` Data interface{} `json:"data,omitempty"` ErrorType string `json:"errorType,omitempty"` Error string `json:"error,omitempty"` Warnings []string `json:"warnings,omitempty"` }
Response is the TSDB response model.
type TSDB ¶
type TSDB struct { URL *url.URL Client *http.Client Logger *slog.Logger // contains filtered or unexported fields }
TSDB struct.
func New ¶ added in v0.2.0
func New(webURL string, config config_util.HTTPClientConfig, logger *slog.Logger) (*TSDB, error)
New returns a new instance of TSDB.
func (*TSDB) Delete ¶
func (t *TSDB) Delete(ctx context.Context, startTime time.Time, endTime time.Time, matchers []string) error
Delete time series with given labels.
func (*TSDB) GlobalConfig ¶
GlobalConfig returns global config section of TSDB.
func (*TSDB) RangeQuery ¶ added in v0.3.1
func (t *TSDB) RangeQuery( ctx context.Context, query string, startTime time.Time, endTime time.Time, step string, ) (RangeMetric, error)
RangeQuery makes a TSDB range query.
func (*TSDB) RateInterval ¶
RateInterval returns rate interval of TSDB.
Click to show internal directories.
Click to hide internal directories.