Documentation
¶
Index ¶
- Variables
- func GetRegistry() *prometheus.Registry
- func StartPeriodicCollection(ctx context.Context, interval time.Duration, start time.Time)
- type ComponentRegistry
- func (r *ComponentRegistry) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func (r *ComponentRegistry) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func (r *ComponentRegistry) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func (r *ComponentRegistry) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func (r *ComponentRegistry) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func (r *ComponentRegistry) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
- type RuntimeCollector
Constants ¶
This section is empty.
Variables ¶
var ( // DurationBuckets for request/operation durations (1ms to 30s) DurationBuckets = []float64{ .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, } // SizeBuckets for message/payload sizes (1KB to 100MB) SizeBuckets = []float64{ 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, } // CountBuckets for batch sizes, participant counts, etc. CountBuckets = []float64{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, } // NetworkBuckets for network connection durations (1s to 1hr) NetworkBuckets = []float64{ 1, 5, 15, 30, 60, 300, 600, 1800, 3600, } // ConsensusBuckets for consensus operations (100ms to 3min) ConsensusBuckets = []float64{ 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60, 120, 180, } )
Common buckets for different types of measurements
var ( Uptime = func() prometheus.Gauge { gauge := prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: "publisher", Subsystem: "core", Name: "uptime_seconds", Help: "Uptime in seconds", }) GetRegistry().MustRegister(gauge) return gauge }() )
Uptime is a gauge registered in the shared publisher custom registry.
Functions ¶
func GetRegistry ¶
func GetRegistry() *prometheus.Registry
GetRegistry returns a process-wide custom registry for shared publisher metrics. It isolates this module's metrics from the global default registry to avoid duplicate registration panics when embedded in other binaries.
Types ¶
type ComponentRegistry ¶
type ComponentRegistry struct {
// contains filtered or unexported fields
}
ComponentRegistry manages metrics for a specific component.
func NewComponentRegistry ¶
func NewComponentRegistry(namespace, subsystem string) *ComponentRegistry
NewComponentRegistry creates a registry for a component. It sanitizes the subsystem name to ensure it's a valid Prometheus metric name by replacing hyphens with underscores. This is particularly useful for UUIDs etc.
func (*ComponentRegistry) NewCounter ¶
func (r *ComponentRegistry) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
NewCounter creates a new counter with proper naming.
func (*ComponentRegistry) NewCounterVec ¶
func (r *ComponentRegistry) NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
NewCounterVec creates a new counter with proper naming.
func (*ComponentRegistry) NewGauge ¶
func (r *ComponentRegistry) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge creates a new gauge with proper naming.
func (*ComponentRegistry) NewGaugeVec ¶
func (r *ComponentRegistry) NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
NewGaugeVec creates a new gauge vector with proper naming.
func (*ComponentRegistry) NewHistogram ¶
func (r *ComponentRegistry) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram creates a new histogram with proper naming.
func (*ComponentRegistry) NewHistogramVec ¶
func (r *ComponentRegistry) NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string, ) *prometheus.HistogramVec
NewHistogramVec creates a new histogram vector with proper naming.
type RuntimeCollector ¶
type RuntimeCollector struct {
// contains filtered or unexported fields
}
RuntimeCollector collects runtime metrics.
func NewRuntimeCollector ¶
func NewRuntimeCollector() *RuntimeCollector
NewRuntimeCollector creates a new runtime collector.
func (*RuntimeCollector) Collect ¶
func (c *RuntimeCollector) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*RuntimeCollector) Describe ¶
func (c *RuntimeCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.