Documentation ¶
Index ¶
- func ConfigFlags(cmd *cobra.Command, prefix, defaultNamespace, defaultHTTP, defaultPath string) error
- type Config
- type Logger
- type Metrics
- func (m *Metrics) Counter(name, help string) prometheus.Counter
- func (m *Metrics) CounterVec(name, help string, labels ...string) *prometheus.CounterVec
- func (m *Metrics) Gauge(name, help string) prometheus.Gauge
- func (m *Metrics) GaugeVec(name, help string, labels ...string) *prometheus.GaugeVec
- func (m *Metrics) Histogram(name, help string, buckets []float64) prometheus.Histogram
- func (m *Metrics) HistogramVec(name, help string, buckets []float64, labels ...string) *prometheus.HistogramVec
- func (m *Metrics) Log(l Logger, all bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Namespace string `mapstructure:"namespace"` Enable bool `mapstructure:"enable"` Addr string `mapstructure:"addr"` Path string `mapstructure:"path"` }
Config configures the metrics client.
type Logger ¶
type Logger func(format string, v ...interface{})
Logger is the expected logger for the manual print out of the metrics
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics enables app metrics
func (*Metrics) Counter ¶
func (m *Metrics) Counter(name, help string) prometheus.Counter
Counter gets or creates an expvar Float with the given name, and returns an object that implements the Counter interface.
func (*Metrics) CounterVec ¶
func (m *Metrics) CounterVec(name, help string, labels ...string) *prometheus.CounterVec
CounterVec creates a new CounterVec based on the provided CounterOpts and partitioned by the given label names.
func (*Metrics) Gauge ¶
func (m *Metrics) Gauge(name, help string) prometheus.Gauge
Gauge get or creates an expvar Float with the given name, and returns an object that implements the Gauge interface.
func (*Metrics) GaugeVec ¶
func (m *Metrics) GaugeVec(name, help string, labels ...string) *prometheus.GaugeVec
GaugeVec creates a new GaugeVec based on the provided GaugeOpts and partitioned by the given label names.
func (*Metrics) Histogram ¶
func (m *Metrics) Histogram(name, help string, buckets []float64) prometheus.Histogram
Histogram counts individual observations from an event or sample stream in configurable buckets. Similar to a summary, it also provides a sum of observations and an observation count.
On the Prometheus server, quantiles can be calculated from a Histogram using the histogram_quantile function in the query language.
Note that Histograms, in contrast to Summaries, can be aggregated with the Prometheus query language (see the documentation for detailed procedures). However, Histograms require the user to pre-define suitable buckets, and they are in general less accurate. The Observe method of a Histogram has a very low performance overhead in comparison with the Observe method of a Summary.
func (*Metrics) HistogramVec ¶
func (m *Metrics) HistogramVec(name, help string, buckets []float64, labels ...string) *prometheus.HistogramVec
HistogramVec is a Collector that bundles a set of Histograms that all share the same Desc, but have different values for their variable labels. This is used if you want to count the same thing partitioned by various dimensions (e.g. HTTP request latencies, partitioned by status code and method). Create instances with NewHistogramVec.