Documentation ¶
Index ¶
- Constants
- Variables
- func FilterExclude(metric Metric, exprs []LabelExpr) bool
- func FilterInclude(metric Metric, exprs []LabelExpr) bool
- func FilterMatch(metric Metric, includes, excludes []LabelExpr) bool
- func IsValidMetricName(n string) bool
- func PrintExampleConfig()
- func SortSamples(samples []Sample)
- type APIConfig
- type Config
- type Filter
- type GeneralConfig
- type InputConfig
- type Label
- type LabelExpr
- type LabelOp
- type Metric
- type OutputConfig
- type Sample
Constants ¶
const ( InputTypePrometheus1RemoteWrite = "prometheusv1_remote_write" InputTypePrometheus2RemoteWrite = "prometheusv2_remote_write" InputTypeNatsStreaming = "nats_streaming" InputTypeInfluxDB = "influxdb" )
Valid types for input.
const ( OutputTypePrometheus2RemoteWrite = "prometheusv2_remote_write" OutputTypeInfluxDB = "influxdb" OutputTypeNatsStreaming = "nats_streaming" OutputTypeOpenTSDB = "opentsdb" )
Valid types for output.
const ( MatchEq = iota MatchNotEq MatchReg MatchNotReg )
These are the LabelOp operators.
const (
APITypePrometheusHTTP = "prometheus_http"
)
Valid types for API.
Variables ¶
var ( MatchOpString = [4]string{"=", "!=", "=~", "!~"} RxLabel = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]{0,254}`) // MetricNameLabel is the label name indicating the metric name of a // timeseries. MetricNameLabel = "__name__" )
Functions ¶
func FilterExclude ¶
func FilterInclude ¶
func FilterMatch ¶
func IsValidMetricName ¶
IsValidMetricName checks if the given string is a valid metric name or not.
func PrintExampleConfig ¶
func PrintExampleConfig()
func SortSamples ¶
func SortSamples(samples []Sample)
SortSamples sorts a slice of samples in the canonical way -- in the increasing order of timestamp.
Types ¶
type Config ¶
type Config struct { General GeneralConfig `toml:"general"` Input []InputConfig `toml:"input"` Output []OutputConfig `toml:"output"` API []APIConfig `toml:"api"` }
type GeneralConfig ¶
type InputConfig ¶
type InputConfig struct { Type string `toml:"type"` Listen string `toml:"listen"` FilterInclude []string `toml:"filter_include"` FilterExclude []string `toml:"filter_exclude"` NATSURL string `toml:"nats_url"` STANCluster string `toml:"stan_cluster"` STANClientID string `toml:"stan_clientid"` STANDurableName string `toml:"stan_durablename"` Subject string `toml:"subject"` }
type LabelExpr ¶
LabelExpr is an expression consisting of zero or more LabelOp terms. The expression is an implicit AND condition.
func (*LabelExpr) CompileFromLabels ¶
CompileFromLabels is similar to CompileFromTerms, expect that each label is treated as a LabelOp with the = operator.
func (*LabelExpr) CompileFromString ¶
func (*LabelExpr) CompileFromTerms ¶
CompileFromTerms compiles a LabelExpr from a set of LabelOp entries.
type LabelOp ¶
LabelOp represents a label name, an operator (one of =, !=, =~, !~) and a value. A LabelOp forms part of an expression to select time series.
type Metric ¶
type Metric []Label
Metric is a qualified time series name, like 'up{job="node", instance="server1:9000"}'.
type OutputConfig ¶
type OutputConfig struct { Type string `toml:"type"` Address string `toml:"address"` Username string `toml:"username"` Password string `toml:"password"` TimeoutSec uint `toml:"timeout_seconds"` NoCertCheck bool `toml:"no_cert_check"` Database string `toml:"database"` RetentionPolicy string `toml:"retention_policy"` Protocol string `toml:"protocol"` FilterInclude []string `toml:"filter_include"` FilterExclude []string `toml:"filter_exclude"` NATSURL string `toml:"nats_url"` STANCluster string `toml:"stan_cluster"` STANClientID string `toml:"stan_clientid"` Subject string `toml:"subject"` URL string `toml:"url"` }