Documentation
¶
Overview ¶
Package metrics provides an enhanced metrics system for SRouter. It includes a fluent API, first-class tags support, and separation of collection and exposition.
Package metrics provides an enhanced metrics system for SRouter. This file contains the Prometheus implementation of the metrics system.
Index ¶
- type Counter
- type CounterBuilder
- type Gauge
- type GaugeBuilder
- type Histogram
- type HistogramBuilder
- type Metric
- type MetricType
- type MetricsExporter
- type MetricsFilter
- type MetricsMiddleware
- type MetricsMiddlewareConfig
- type MetricsRegistry
- type MetricsSampler
- type MetricsSnapshot
- type PrometheusCounter
- func (c *PrometheusCounter) Add(value float64)
- func (c *PrometheusCounter) Description() string
- func (c *PrometheusCounter) Inc()
- func (c *PrometheusCounter) Name() string
- func (c *PrometheusCounter) Tags() Tags
- func (c *PrometheusCounter) Type() MetricType
- func (c *PrometheusCounter) Value() float64
- func (c *PrometheusCounter) WithTags(tags Tags) Metric
- type PrometheusCounterBuilder
- type PrometheusExporter
- type PrometheusGauge
- func (g *PrometheusGauge) Add(value float64)
- func (g *PrometheusGauge) Dec()
- func (g *PrometheusGauge) Description() string
- func (g *PrometheusGauge) Inc()
- func (g *PrometheusGauge) Name() string
- func (g *PrometheusGauge) Set(value float64)
- func (g *PrometheusGauge) Sub(value float64)
- func (g *PrometheusGauge) Tags() Tags
- func (g *PrometheusGauge) Type() MetricType
- func (g *PrometheusGauge) Value() float64
- func (g *PrometheusGauge) WithTags(tags Tags) Metric
- type PrometheusGaugeBuilder
- type PrometheusHistogram
- func (h *PrometheusHistogram) Buckets() []float64
- func (h *PrometheusHistogram) Description() string
- func (h *PrometheusHistogram) Name() string
- func (h *PrometheusHistogram) Observe(value float64)
- func (h *PrometheusHistogram) Tags() Tags
- func (h *PrometheusHistogram) Type() MetricType
- func (h *PrometheusHistogram) WithTags(tags Tags) Metric
- type PrometheusHistogramBuilder
- func (b *PrometheusHistogramBuilder) Buckets(buckets []float64) HistogramBuilder
- func (b *PrometheusHistogramBuilder) Build() Histogram
- func (b *PrometheusHistogramBuilder) Description(desc string) HistogramBuilder
- func (b *PrometheusHistogramBuilder) Name(name string) HistogramBuilder
- func (b *PrometheusHistogramBuilder) Tag(key, value string) HistogramBuilder
- type PrometheusMiddleware
- func (m *PrometheusMiddleware) Configure(config MetricsMiddlewareConfig) *PrometheusMiddleware
- func (m *PrometheusMiddleware) Handler(name string, handler http.Handler) http.Handler
- func (m *PrometheusMiddleware) WithFilter(filter MetricsFilter) *PrometheusMiddleware
- func (m *PrometheusMiddleware) WithSampler(sampler MetricsSampler) *PrometheusMiddleware
- type PrometheusRegistry
- func (r *PrometheusRegistry) Clear()
- func (r *PrometheusRegistry) Get(name string) (Metric, bool)
- func (r *PrometheusRegistry) NewCounter() CounterBuilder
- func (r *PrometheusRegistry) NewGauge() GaugeBuilder
- func (r *PrometheusRegistry) NewHistogram() HistogramBuilder
- func (r *PrometheusRegistry) NewSummary() SummaryBuilder
- func (r *PrometheusRegistry) Register(metric Metric) error
- func (r *PrometheusRegistry) Snapshot() MetricsSnapshot
- func (r *PrometheusRegistry) Unregister(name string) bool
- func (r *PrometheusRegistry) WithTags(tags Tags) MetricsRegistry
- type PrometheusSnapshot
- type PrometheusSummary
- func (s *PrometheusSummary) Description() string
- func (s *PrometheusSummary) Name() string
- func (s *PrometheusSummary) Objectives() map[float64]float64
- func (s *PrometheusSummary) Observe(value float64)
- func (s *PrometheusSummary) Tags() Tags
- func (s *PrometheusSummary) Type() MetricType
- func (s *PrometheusSummary) WithTags(tags Tags) Metric
- type PrometheusSummaryBuilder
- func (b *PrometheusSummaryBuilder) AgeBuckets(ageBuckets int) SummaryBuilder
- func (b *PrometheusSummaryBuilder) Build() Summary
- func (b *PrometheusSummaryBuilder) Description(desc string) SummaryBuilder
- func (b *PrometheusSummaryBuilder) MaxAge(maxAge time.Duration) SummaryBuilder
- func (b *PrometheusSummaryBuilder) Name(name string) SummaryBuilder
- func (b *PrometheusSummaryBuilder) Objectives(objectives map[float64]float64) SummaryBuilder
- func (b *PrometheusSummaryBuilder) Tag(key, value string) SummaryBuilder
- type RandomSampler
- type Summary
- type SummaryBuilder
- type Tags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter interface {
Metric
// Inc increments the counter by 1.
Inc()
// Add adds the given value to the counter.
Add(value float64)
// Value returns the current value of the counter.
Value() float64
}
Counter is a metric that represents a monotonically increasing value.
type CounterBuilder ¶
type CounterBuilder interface {
// Name sets the counter name.
Name(name string) CounterBuilder
// Description sets the counter description.
Description(desc string) CounterBuilder
// Tag adds a tag to the counter.
Tag(key, value string) CounterBuilder
// Build creates the counter.
Build() Counter
}
CounterBuilder is a builder for creating counters.
type Gauge ¶
type Gauge interface {
Metric
// Set sets the gauge to the given value.
Set(value float64)
// Inc increments the gauge by 1.
Inc()
// Dec decrements the gauge by 1.
Dec()
// Add adds the given value to the gauge.
Add(value float64)
// Sub subtracts the given value from the gauge.
Sub(value float64)
// Value returns the current value of the gauge.
Value() float64
}
Gauge is a metric that represents a value that can go up and down.
type GaugeBuilder ¶
type GaugeBuilder interface {
// Name sets the gauge name.
Name(name string) GaugeBuilder
// Description sets the gauge description.
Description(desc string) GaugeBuilder
// Tag adds a tag to the gauge.
Tag(key, value string) GaugeBuilder
// Build creates the gauge.
Build() Gauge
}
GaugeBuilder is a builder for creating gauges.
type Histogram ¶
type Histogram interface {
Metric
// Observe adds a single observation to the histogram.
Observe(value float64)
// Buckets returns the bucket boundaries.
Buckets() []float64
}
Histogram is a metric that samples observations and counts them in configurable buckets.
type HistogramBuilder ¶
type HistogramBuilder interface {
// Name sets the histogram name.
Name(name string) HistogramBuilder
// Description sets the histogram description.
Description(desc string) HistogramBuilder
// Tag adds a tag to the histogram.
Tag(key, value string) HistogramBuilder
// Buckets sets the bucket boundaries.
Buckets(buckets []float64) HistogramBuilder
// Build creates the histogram.
Build() Histogram
}
HistogramBuilder is a builder for creating histograms.
type Metric ¶
type Metric interface {
// Name returns the metric name.
Name() string
// Description returns the metric description.
Description() string
// Type returns the metric type.
Type() MetricType
// Tags returns the metric tags.
Tags() Tags
// WithTags returns a new metric with the given tags.
WithTags(tags Tags) Metric
}
Metric is the base interface for all metrics.
type MetricType ¶
type MetricType string
MetricType represents the type of a metric.
const ( // CounterType represents a counter metric. CounterType MetricType = "counter" // GaugeType represents a gauge metric. GaugeType MetricType = "gauge" // HistogramType represents a histogram metric. HistogramType MetricType = "histogram" // SummaryType represents a summary metric. SummaryType MetricType = "summary" )
type MetricsExporter ¶
type MetricsExporter interface {
// Export metrics to the backend.
Export(snapshot MetricsSnapshot) error
// Start the exporter.
Start() error
// Stop the exporter.
Stop() error
// Return an HTTP handler for exposing metrics.
Handler() http.Handler
}
MetricsExporter is an exporter for metrics.
type MetricsFilter ¶
type MetricsFilter interface {
// Filter returns true if metrics should be collected for the request.
Filter(r *http.Request) bool
}
MetricsFilter is a filter for metrics collection.
type MetricsMiddleware ¶
type MetricsMiddleware interface {
// Wrap an HTTP handler with metrics collection.
Handler(name string, handler http.Handler) http.Handler
// Configure the middleware.
Configure(config MetricsMiddlewareConfig) MetricsMiddleware
// Add a filter to the middleware.
WithFilter(filter MetricsFilter) MetricsMiddleware
// Add a sampler to the middleware.
WithSampler(sampler MetricsSampler) MetricsMiddleware
}
MetricsMiddleware is a middleware for collecting metrics.
type MetricsMiddlewareConfig ¶
type MetricsMiddlewareConfig struct {
// EnableLatency enables latency metrics.
EnableLatency bool
// EnableThroughput enables throughput metrics.
EnableThroughput bool
// EnableQPS enables queries per second metrics.
EnableQPS bool
// EnableErrors enables error metrics.
EnableErrors bool
// SamplingRate is the rate at which to sample requests.
SamplingRate float64
// DefaultTags are tags to add to all metrics.
DefaultTags Tags
}
MetricsMiddlewareConfig is the configuration for metrics middleware.
type MetricsRegistry ¶
type MetricsRegistry interface {
// Register a metric with the registry.
Register(metric Metric) error
// Get a metric by name.
Get(name string) (Metric, bool)
// Unregister a metric from the registry.
Unregister(name string) bool
// Clear all metrics from the registry.
Clear()
// Get a snapshot of all metrics.
Snapshot() MetricsSnapshot
// Create a new registry with the given tags.
WithTags(tags Tags) MetricsRegistry
// Create a new counter builder.
NewCounter() CounterBuilder
// Create a new gauge builder.
NewGauge() GaugeBuilder
// Create a new histogram builder.
NewHistogram() HistogramBuilder
// Create a new summary builder.
NewSummary() SummaryBuilder
}
MetricsRegistry is a registry for metrics.
type MetricsSampler ¶
type MetricsSampler interface {
// Sample returns true if the request should be sampled.
Sample() bool
}
MetricsSampler is a sampler for metrics collection.
type MetricsSnapshot ¶
type MetricsSnapshot interface {
// Counters returns all counters in the snapshot.
Counters() []Counter
// Gauges returns all gauges in the snapshot.
Gauges() []Gauge
// Histograms returns all histograms in the snapshot.
Histograms() []Histogram
// Summaries returns all summaries in the snapshot.
Summaries() []Summary
}
MetricsSnapshot is a snapshot of all metrics in a registry.
type PrometheusCounter ¶
type PrometheusCounter struct {
// contains filtered or unexported fields
}
PrometheusCounter implements Counter using Prometheus.
func (*PrometheusCounter) Add ¶
func (c *PrometheusCounter) Add(value float64)
Add adds the given value to the counter.
func (*PrometheusCounter) Description ¶
func (c *PrometheusCounter) Description() string
Description returns the metric description.
func (*PrometheusCounter) Name ¶
func (c *PrometheusCounter) Name() string
Name returns the metric name.
func (*PrometheusCounter) Tags ¶
func (c *PrometheusCounter) Tags() Tags
Tags returns the metric tags.
func (*PrometheusCounter) Type ¶
func (c *PrometheusCounter) Type() MetricType
Type returns the metric type.
func (*PrometheusCounter) Value ¶
func (c *PrometheusCounter) Value() float64
Value returns the current value of the counter.
func (*PrometheusCounter) WithTags ¶
func (c *PrometheusCounter) WithTags(tags Tags) Metric
WithTags returns a new metric with the given tags.
type PrometheusCounterBuilder ¶
type PrometheusCounterBuilder struct {
// contains filtered or unexported fields
}
PrometheusCounterBuilder implements CounterBuilder using Prometheus.
func (*PrometheusCounterBuilder) Build ¶
func (b *PrometheusCounterBuilder) Build() Counter
Build creates the counter.
func (*PrometheusCounterBuilder) Description ¶
func (b *PrometheusCounterBuilder) Description(desc string) CounterBuilder
Description sets the counter description.
func (*PrometheusCounterBuilder) Name ¶
func (b *PrometheusCounterBuilder) Name(name string) CounterBuilder
Name sets the counter name.
func (*PrometheusCounterBuilder) Tag ¶
func (b *PrometheusCounterBuilder) Tag(key, value string) CounterBuilder
Tag adds a tag to the counter.
type PrometheusExporter ¶
type PrometheusExporter struct {
// contains filtered or unexported fields
}
PrometheusExporter implements MetricsExporter using Prometheus.
func NewPrometheusExporter ¶
func NewPrometheusExporter(registry *PrometheusRegistry) *PrometheusExporter
NewPrometheusExporter creates a new PrometheusExporter.
func (*PrometheusExporter) Export ¶
func (e *PrometheusExporter) Export(snapshot MetricsSnapshot) error
Export metrics to the backend.
func (*PrometheusExporter) Handler ¶
func (e *PrometheusExporter) Handler() http.Handler
Handler returns an HTTP handler for exposing metrics.
type PrometheusGauge ¶
type PrometheusGauge struct {
// contains filtered or unexported fields
}
PrometheusGauge implements Gauge using Prometheus.
func (*PrometheusGauge) Add ¶
func (g *PrometheusGauge) Add(value float64)
Add adds the given value to the gauge.
func (*PrometheusGauge) Description ¶
func (g *PrometheusGauge) Description() string
Description returns the metric description.
func (*PrometheusGauge) Name ¶
func (g *PrometheusGauge) Name() string
Name returns the metric name.
func (*PrometheusGauge) Set ¶
func (g *PrometheusGauge) Set(value float64)
Set sets the gauge to the given value.
func (*PrometheusGauge) Sub ¶
func (g *PrometheusGauge) Sub(value float64)
Sub subtracts the given value from the gauge.
func (*PrometheusGauge) Type ¶
func (g *PrometheusGauge) Type() MetricType
Type returns the metric type.
func (*PrometheusGauge) Value ¶
func (g *PrometheusGauge) Value() float64
Value returns the current value of the gauge.
func (*PrometheusGauge) WithTags ¶
func (g *PrometheusGauge) WithTags(tags Tags) Metric
WithTags returns a new metric with the given tags.
type PrometheusGaugeBuilder ¶
type PrometheusGaugeBuilder struct {
// contains filtered or unexported fields
}
PrometheusGaugeBuilder implements GaugeBuilder using Prometheus.
func (*PrometheusGaugeBuilder) Build ¶
func (b *PrometheusGaugeBuilder) Build() Gauge
Build creates the gauge.
func (*PrometheusGaugeBuilder) Description ¶
func (b *PrometheusGaugeBuilder) Description(desc string) GaugeBuilder
Description sets the gauge description.
func (*PrometheusGaugeBuilder) Name ¶
func (b *PrometheusGaugeBuilder) Name(name string) GaugeBuilder
Name sets the gauge name.
func (*PrometheusGaugeBuilder) Tag ¶
func (b *PrometheusGaugeBuilder) Tag(key, value string) GaugeBuilder
Tag adds a tag to the gauge.
type PrometheusHistogram ¶
type PrometheusHistogram struct {
// contains filtered or unexported fields
}
PrometheusHistogram implements Histogram using Prometheus.
func (*PrometheusHistogram) Buckets ¶
func (h *PrometheusHistogram) Buckets() []float64
Buckets returns the bucket boundaries.
func (*PrometheusHistogram) Description ¶
func (h *PrometheusHistogram) Description() string
Description returns the metric description.
func (*PrometheusHistogram) Name ¶
func (h *PrometheusHistogram) Name() string
Name returns the metric name.
func (*PrometheusHistogram) Observe ¶
func (h *PrometheusHistogram) Observe(value float64)
Observe adds a single observation to the histogram.
func (*PrometheusHistogram) Tags ¶
func (h *PrometheusHistogram) Tags() Tags
Tags returns the metric tags.
func (*PrometheusHistogram) Type ¶
func (h *PrometheusHistogram) Type() MetricType
Type returns the metric type.
func (*PrometheusHistogram) WithTags ¶
func (h *PrometheusHistogram) WithTags(tags Tags) Metric
WithTags returns a new metric with the given tags.
type PrometheusHistogramBuilder ¶
type PrometheusHistogramBuilder struct {
// contains filtered or unexported fields
}
PrometheusHistogramBuilder implements HistogramBuilder using Prometheus.
func (*PrometheusHistogramBuilder) Buckets ¶
func (b *PrometheusHistogramBuilder) Buckets(buckets []float64) HistogramBuilder
Buckets sets the bucket boundaries.
func (*PrometheusHistogramBuilder) Build ¶
func (b *PrometheusHistogramBuilder) Build() Histogram
Build creates the histogram.
func (*PrometheusHistogramBuilder) Description ¶
func (b *PrometheusHistogramBuilder) Description(desc string) HistogramBuilder
Description sets the histogram description.
func (*PrometheusHistogramBuilder) Name ¶
func (b *PrometheusHistogramBuilder) Name(name string) HistogramBuilder
Name sets the histogram name.
func (*PrometheusHistogramBuilder) Tag ¶
func (b *PrometheusHistogramBuilder) Tag(key, value string) HistogramBuilder
Tag adds a tag to the histogram.
type PrometheusMiddleware ¶
type PrometheusMiddleware struct {
// contains filtered or unexported fields
}
PrometheusMiddleware implements MetricsMiddleware using Prometheus.
func NewPrometheusMiddleware ¶
func NewPrometheusMiddleware(registry *PrometheusRegistry, config MetricsMiddlewareConfig) *PrometheusMiddleware
NewPrometheusMiddleware creates a new PrometheusMiddleware.
func (*PrometheusMiddleware) Configure ¶
func (m *PrometheusMiddleware) Configure(config MetricsMiddlewareConfig) *PrometheusMiddleware
Configure updates the middleware configuration.
func (*PrometheusMiddleware) WithFilter ¶
func (m *PrometheusMiddleware) WithFilter(filter MetricsFilter) *PrometheusMiddleware
WithFilter sets the filter for the middleware.
func (*PrometheusMiddleware) WithSampler ¶
func (m *PrometheusMiddleware) WithSampler(sampler MetricsSampler) *PrometheusMiddleware
WithSampler sets the sampler for the middleware.
type PrometheusRegistry ¶
type PrometheusRegistry struct {
// contains filtered or unexported fields
}
PrometheusRegistry implements MetricsRegistry using Prometheus.
func NewPrometheusRegistry ¶
func NewPrometheusRegistry() *PrometheusRegistry
NewPrometheusRegistry creates a new PrometheusRegistry.
func (*PrometheusRegistry) Clear ¶
func (r *PrometheusRegistry) Clear()
Clear all metrics from the registry.
func (*PrometheusRegistry) Get ¶
func (r *PrometheusRegistry) Get(name string) (Metric, bool)
Get a metric by name.
func (*PrometheusRegistry) NewCounter ¶
func (r *PrometheusRegistry) NewCounter() CounterBuilder
NewCounter creates a new counter builder.
func (*PrometheusRegistry) NewGauge ¶
func (r *PrometheusRegistry) NewGauge() GaugeBuilder
NewGauge creates a new gauge builder.
func (*PrometheusRegistry) NewHistogram ¶
func (r *PrometheusRegistry) NewHistogram() HistogramBuilder
NewHistogram creates a new histogram builder.
func (*PrometheusRegistry) NewSummary ¶
func (r *PrometheusRegistry) NewSummary() SummaryBuilder
NewSummary creates a new summary builder.
func (*PrometheusRegistry) Register ¶
func (r *PrometheusRegistry) Register(metric Metric) error
Register a metric with the registry.
func (*PrometheusRegistry) Snapshot ¶
func (r *PrometheusRegistry) Snapshot() MetricsSnapshot
Snapshot returns a point-in-time snapshot of all metrics.
func (*PrometheusRegistry) Unregister ¶
func (r *PrometheusRegistry) Unregister(name string) bool
Unregister a metric from the registry.
func (*PrometheusRegistry) WithTags ¶
func (r *PrometheusRegistry) WithTags(tags Tags) MetricsRegistry
WithTags returns a tagged registry that adds the given tags to all metrics.
type PrometheusSnapshot ¶
type PrometheusSnapshot struct {
// contains filtered or unexported fields
}
PrometheusSnapshot implements MetricsSnapshot.
func (*PrometheusSnapshot) Counters ¶
func (s *PrometheusSnapshot) Counters() []Counter
Counters returns all counters in the snapshot.
func (*PrometheusSnapshot) Gauges ¶
func (s *PrometheusSnapshot) Gauges() []Gauge
Gauges returns all gauges in the snapshot.
func (*PrometheusSnapshot) Histograms ¶
func (s *PrometheusSnapshot) Histograms() []Histogram
Histograms returns all histograms in the snapshot.
func (*PrometheusSnapshot) Summaries ¶
func (s *PrometheusSnapshot) Summaries() []Summary
Summaries returns all summaries in the snapshot.
type PrometheusSummary ¶
type PrometheusSummary struct {
// contains filtered or unexported fields
}
PrometheusSummary implements Summary using Prometheus.
func (*PrometheusSummary) Description ¶
func (s *PrometheusSummary) Description() string
Description returns the metric description.
func (*PrometheusSummary) Name ¶
func (s *PrometheusSummary) Name() string
Name returns the metric name.
func (*PrometheusSummary) Objectives ¶
func (s *PrometheusSummary) Objectives() map[float64]float64
Objectives returns the quantile objectives.
func (*PrometheusSummary) Observe ¶
func (s *PrometheusSummary) Observe(value float64)
Observe adds a single observation to the summary.
func (*PrometheusSummary) Tags ¶
func (s *PrometheusSummary) Tags() Tags
Tags returns the metric tags.
func (*PrometheusSummary) Type ¶
func (s *PrometheusSummary) Type() MetricType
Type returns the metric type.
func (*PrometheusSummary) WithTags ¶
func (s *PrometheusSummary) WithTags(tags Tags) Metric
WithTags returns a new metric with the given tags.
type PrometheusSummaryBuilder ¶
type PrometheusSummaryBuilder struct {
// contains filtered or unexported fields
}
PrometheusSummaryBuilder implements SummaryBuilder using Prometheus.
func (*PrometheusSummaryBuilder) AgeBuckets ¶
func (b *PrometheusSummaryBuilder) AgeBuckets(ageBuckets int) SummaryBuilder
AgeBuckets sets the number of age buckets.
func (*PrometheusSummaryBuilder) Build ¶
func (b *PrometheusSummaryBuilder) Build() Summary
Build creates the summary.
func (*PrometheusSummaryBuilder) Description ¶
func (b *PrometheusSummaryBuilder) Description(desc string) SummaryBuilder
Description sets the summary description.
func (*PrometheusSummaryBuilder) MaxAge ¶
func (b *PrometheusSummaryBuilder) MaxAge(maxAge time.Duration) SummaryBuilder
MaxAge sets the maximum age of observations.
func (*PrometheusSummaryBuilder) Name ¶
func (b *PrometheusSummaryBuilder) Name(name string) SummaryBuilder
Name sets the summary name.
func (*PrometheusSummaryBuilder) Objectives ¶
func (b *PrometheusSummaryBuilder) Objectives(objectives map[float64]float64) SummaryBuilder
Objectives sets the quantile objectives.
func (*PrometheusSummaryBuilder) Tag ¶
func (b *PrometheusSummaryBuilder) Tag(key, value string) SummaryBuilder
Tag adds a tag to the summary.
type RandomSampler ¶
type RandomSampler struct {
// contains filtered or unexported fields
}
RandomSampler is a sampler that randomly samples requests.
func NewRandomSampler ¶
func NewRandomSampler(rate float64) *RandomSampler
NewRandomSampler creates a new random sampler.
func (*RandomSampler) Sample ¶
func (s *RandomSampler) Sample() bool
Sample returns true if the request should be sampled.
type Summary ¶
type Summary interface {
Metric
// Observe adds a single observation to the summary.
Observe(value float64)
// Objectives returns the quantile objectives.
Objectives() map[float64]float64
}
Summary is a metric that samples observations and calculates quantiles over a sliding time window.
type SummaryBuilder ¶
type SummaryBuilder interface {
// Name sets the summary name.
Name(name string) SummaryBuilder
// Description sets the summary description.
Description(desc string) SummaryBuilder
// Tag adds a tag to the summary.
Tag(key, value string) SummaryBuilder
// Objectives sets the quantile objectives.
Objectives(objectives map[float64]float64) SummaryBuilder
// MaxAge sets the maximum age of observations.
MaxAge(maxAge time.Duration) SummaryBuilder
// AgeBuckets sets the number of age buckets.
AgeBuckets(ageBuckets int) SummaryBuilder
// Build creates the summary.
Build() Summary
}
SummaryBuilder is a builder for creating summaries.