Documentation
¶
Index ¶
- Constants
- type Collector
- type CollectorType
- type Config
- type Configurer
- type Logger
- type Metric
- type NamedCollector
- type Plugin
- func (p *Plugin) Collects() []*dep.In
- func (p *Plugin) Init(cfg Configurer, log Logger) error
- func (p *Plugin) Name() string
- func (p *Plugin) RPC() any
- func (p *Plugin) Register(c prometheus.Collector) error
- func (p *Plugin) Serve() chan error
- func (p *Plugin) Stop(context.Context) error
- func (p *Plugin) Weight() uint
- type StatProvider
Constants ¶
View Source
const (
// PluginName declares plugin name.
PluginName = "metrics"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// Namespace of the metric.
Namespace string `json:"namespace,omitempty"`
// Subsystem of the metric.
Subsystem string `json:"subsystem,omitempty"`
// Collector type (histogram, gauge, counter, summary).
Type CollectorType `json:"type"`
// Help of collector.
Help string `json:"help"`
// Labels for vectorized metrics.
Labels []string `json:"labels"`
// Buckets for histogram metric.
Buckets []float64 `json:"buckets"`
// Objectives for the summary opts
Objectives map[float64]float64 `json:"objectives,omitempty"`
}
Collector describes a single application specific metric.
type CollectorType ¶
type CollectorType string
CollectorType represents prometheus collector types
const ( // Histogram type Histogram CollectorType = "histogram" // Gauge type Gauge CollectorType = "gauge" // Counter type Counter CollectorType = "counter" // Summary type Summary CollectorType = "summary" )
type Config ¶
type Config struct {
// Address to listen
Address string `mapstructure:"address"`
// Collect defines application-specific metrics.
Collect map[string]Collector `mapstructure:"collect"`
}
Config configures metrics service.
func (*Config) InitDefaults ¶
func (c *Config) InitDefaults()
type Configurer ¶
type Metric ¶
type Metric struct {
// Collector name.
Name string `msgpack:"alias:name"`
// Collector value.
Value float64 `msgpack:"alias:value"`
// Labels associated with metric. Only for vector metrics. Must be provided in a form of label values.
Labels []string `msgpack:"alias:labels"`
}
Metric represents a single metric produced by the application.
type NamedCollector ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin to manage application metrics using Prometheus.
func (*Plugin) Collects ¶
Collects used to collect all plugins that implement metrics.StatProvider interface (and Named)
type StatProvider ¶
type StatProvider interface {
MetricsCollector() []prometheus.Collector
}
StatProvider used to collect all plugins which might report to the prometheus
Click to show internal directories.
Click to hide internal directories.