Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Enabled bool `mapstructure:"enable"` ServerConfig *ServerConfig `mapstructure:"server"` MetricConfigs *[]MetricConfig `mapstructure:"metrics"` }
type CounterMetric ¶
type CounterMetric interface { prometheus.Counter }
type GaugeMetric ¶
type GaugeMetric interface { prometheus.Gauge }
type HistogramMetric ¶
type HistogramMetric interface { prometheus.Histogram }
type Metric ¶
type Metric interface { prometheus.Metric }
func Get ¶
Get gets the metric for the given metricId. Caller can use the returned metric by casting it to one of appropriate metric types; probe.GaugeMetric, probe.CounterMetric, probe.HistogramMetric - On success, returns (metric, true) - If probe is disabled or not started returns (nil, false)
func Set ¶
func Set(metricConfig MetricConfig) (Metric, bool)
Set creates a metric with given metricConfig if probe is enabled and started. If config file contains a metric with same id as metricConfig.Id, metricConfig values are overwritten by config file. Caller can use the returned metric by casting it to one of appropriate metric types; probe.GaugeMetric, probe.CounterMetric, probe.HistogramMetric
- On success, returns (metric, true)
- If probe is disabled or not started, returns (nil, false)
- If there is a metric created with same id previously, returns the previously created metric.
type MetricConfig ¶
type MetricConfig struct { Id string `mapstructure:"id"` Type string `mapstructure:"type"` Name string `mapstructure:"name"` Help string `mapstructure:"help"` Buckets []float64 `mapstructure:"buckets"` LabelNames []string `mapstructure:"labelNames"` LabelValues []string `mapstructure:"labelValues"` }
type ServerConfig ¶
Click to show internal directories.
Click to hide internal directories.