Documentation
¶
Index ¶
- Variables
- func Sanitize(value string) string
- func Sorted(metrics []telegraf.Metric) []telegraf.Metric
- type MetricFamily
- type PrometheusClient
- func (p *PrometheusClient) Close() error
- func (p *PrometheusClient) Collect(ch chan<- prometheus.Metric)
- func (p *PrometheusClient) Connect() error
- func (p *PrometheusClient) Describe(ch chan<- *prometheus.Desc)
- func (p *PrometheusClient) Description() string
- func (p *PrometheusClient) Expire()
- func (p *PrometheusClient) SampleConfig() string
- func (p *PrometheusClient) URL() string
- func (p *PrometheusClient) Write(metrics []telegraf.Metric) error
- type Sample
- type SampleID
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InvalidNameCharRE = regexp.MustCompile(`[^a-zA-Z0-9_:]`) ValidNameCharRE = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*`) )
Functions ¶
Types ¶
type MetricFamily ¶
type MetricFamily struct {
// Samples are the Sample belonging to this MetricFamily.
Samples map[SampleID]*Sample
// Need the telegraf ValueType because there isn't a Prometheus ValueType
// representing Histogram or Summary
TelegrafValueType telegraf.ValueType
// LabelSet is the label counts for all Samples.
LabelSet map[string]int
}
MetricFamily contains the data required to build valid prometheus Metrics.
type PrometheusClient ¶
type PrometheusClient struct {
Listen string
BasicUsername string `toml:"basic_username"`
BasicPassword string `toml:"basic_password"`
IPRange []string `toml:"ip_range"`
ExpirationInterval internal.Duration `toml:"expiration_interval"`
Path string `toml:"path"`
CollectorsExclude []string `toml:"collectors_exclude"`
StringAsLabel bool `toml:"string_as_label"`
ExportTimestamp bool `toml:"export_timestamp"`
tlsint.ServerConfig
sync.Mutex
// contains filtered or unexported fields
}
func (*PrometheusClient) Close ¶
func (p *PrometheusClient) Close() error
func (*PrometheusClient) Collect ¶
func (p *PrometheusClient) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector
func (*PrometheusClient) Connect ¶
func (p *PrometheusClient) Connect() error
func (*PrometheusClient) Describe ¶
func (p *PrometheusClient) Describe(ch chan<- *prometheus.Desc)
Implements prometheus.Collector
func (*PrometheusClient) Description ¶
func (p *PrometheusClient) Description() string
func (*PrometheusClient) Expire ¶
func (p *PrometheusClient) Expire()
Expire removes Samples that have expired.
func (*PrometheusClient) SampleConfig ¶
func (p *PrometheusClient) SampleConfig() string
func (*PrometheusClient) URL ¶
func (p *PrometheusClient) URL() string
Address returns the address the plugin is listening on. If not listening an empty string is returned.
type Sample ¶
type Sample struct {
// Labels are the Prometheus labels.
Labels map[string]string
// Value is the value in the Prometheus output. Only one of these will populated.
Value float64
HistogramValue map[float64]uint64
SummaryValue map[float64]float64
// Histograms and Summaries need a count and a sum
Count uint64
Sum float64
// Metric timestamp
Timestamp time.Time
// Expiration is the deadline that this Sample is valid until.
Expiration time.Time
}
Sample represents the current value of a series.
Click to show internal directories.
Click to hide internal directories.