opentsdb

package
v1.101.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Addr string
	// The meta query limit for series returned
	Limit      int
	Retentions []Retention
	Filters    []string
	Normalize  bool
	HardTS     int64
	MsecsTime  bool
	// contains filtered or unexported fields
}

Client object holds general config about how queries should be performed

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient creates and returns OpenTSDB client configured with passed Config

func (Client) FindMetrics

func (c Client) FindMetrics(q string) ([]string, error)

FindMetrics discovers all metrics that OpenTSDB knows about (given a filter) e.g. /api/suggest?type=metrics&q=system&max=100000

func (Client) FindSeries

func (c Client) FindSeries(metric string) ([]Meta, error)

FindSeries discovers all series associated with a metric e.g. /api/search/lookup?m=system.load5&limit=1000000

func (Client) GetData

func (c Client) GetData(series Meta, rt RetentionMeta, start int64, end int64, mSecs bool) (Metric, error)

GetData actually retrieves data for a series at a specified time range e.g. /api/query?start=1&end=200&m=sum:1m-avg-none:system.load5{host=host1}

type Config

type Config struct {
	Addr       string
	Limit      int
	Offset     int64
	HardTS     int64
	Retentions []string
	Filters    []string
	Normalize  bool
	MsecsTime  bool
	Transport  *http.Transport
}

Config contains fields required for Client configuration

type Meta

type Meta struct {
	Metric string            `json:"metric"`
	Tags   map[string]string `json:"tags"`
}

Meta A meta object about a metric only contain the tags/etc. and no data

type MetaResults

type MetaResults struct {
	Type    string `json:"type"`
	Results []Meta `json:"results"`
}

MetaResults contains return data from search series lookup queries

type Metric

type Metric struct {
	Metric     string
	Tags       map[string]string
	Timestamps []int64
	Values     []float64
}

Metric holds the time series data in VictoriaMetrics format

type OtsdbMetric added in v1.70.0

type OtsdbMetric struct {
	Metric        string
	Tags          map[string]string
	AggregateTags []string
	Dps           map[int64]float64
}

OtsdbMetric is a single series in OpenTSDB's returned format

type Retention

type Retention struct {
	/*
		OpenTSDB has two levels of aggregation,
		First, we aggregate any un-mentioned tags into the last result
		Second, we aggregate into buckets over time
		To simulate this with config, we have
		FirstOrder (e.g. sum/avg/max/etc.)
		SecondOrder (e.g. sum/avg/max/etc.)
		AggTime	(e.g. 1m/10m/1d/etc.)
		This will build into m=<FirstOrder>:<AggTime>-<SecondOrder>-none:
		Or an example: m=sum:1m-avg-none
	*/
	FirstOrder  string
	SecondOrder string
	AggTime     string
	// The actual ranges will will attempt to query (as offsets from now)
	QueryRanges []TimeRange
}

Retention objects contain meta data about what to query for our run

type RetentionMeta

type RetentionMeta struct {
	FirstOrder  string
	SecondOrder string
	AggTime     string
}

RetentionMeta objects exist to pass smaller subsets (only one retention range) of a full Retention object around

type TimeRange

type TimeRange struct {
	Start int64
	End   int64
}

TimeRange contains data about time ranges to query

Jump to

Keyboard shortcuts

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