tsdb

package
v0.1.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package tsdb implements TSDB client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request

func Request(url string, client *http.Client) (interface{}, error)

Types

type Metric

type Metric map[string]float64

Metric defines TSDB 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
	DeleteEndpoint     *url.URL
	QueryEndpoint      *url.URL
	QueryRangeEndpoint *url.URL
	ConfigEndpoint     *url.URL
	Logger             log.Logger
	// contains filtered or unexported fields
}

TSDB struct

func NewTSDB

func NewTSDB(webURL string, webSkipTLSVerify bool, logger log.Logger) (*TSDB, error)

NewTSDB returns a new instance of TSDB

func (*TSDB) Available

func (t *TSDB) Available() bool

Available returns true if TSDB is alive

func (*TSDB) Config

func (t *TSDB) Config() (map[interface{}]interface{}, error)

Config returns TSDB config

func (*TSDB) Delete

func (t *TSDB) Delete(startTime time.Time, endTime time.Time, matchers []string) error

Delete time series with given labels

func (*TSDB) GlobalConfig

func (t *TSDB) GlobalConfig() (map[interface{}]interface{}, error)

GlobalConfig returns global config section of TSDB

func (*TSDB) Intervals

func (t *TSDB) Intervals() map[string]time.Duration

Intervals returns scrape and evaluation intervals of TSDB

func (*TSDB) Ping

func (t *TSDB) Ping() error

Ping attempts to ping TSDB

func (*TSDB) Query

func (t *TSDB) Query(query string, queryTime time.Time) (Metric, error)

Query makes a TSDB query

func (*TSDB) RateInterval

func (t *TSDB) RateInterval() time.Duration

RateInterval returns rate interval of TSDB

func (*TSDB) String

func (t *TSDB) String() string

String implements stringer method for TSDB

Jump to

Keyboard shortcuts

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