Documentation ¶
Index ¶
- Constants
- Variables
- type Counter
- type Gauge
- type GoRoutineFactory
- type Histogram
- type Measurement
- type Option
- func WithDefaultHistogramBuckets(buckets []float64) Option
- func WithHistogramBuckets(histogramName string, buckets []float64) Option
- func WithPrometheusRegistry(registerer prometheus.Registerer, gatherer prometheus.Gatherer) Option
- func WithServiceName(name string) Option
- func WithServiceVersion(version string) Option
- type Stats
- type Tags
- type Timer
Constants ¶
const ( CountType = "count" TimerType = "timer" GaugeType = "gauge" HistogramType = "histogram" )
Variables ¶
var DefaultGoRoutineFactory = defaultGoRoutineFactory{}
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter interface { Count(n int) Increment() }
Counter represents a counter metric
type GoRoutineFactory ¶
type GoRoutineFactory interface {
Go(function func())
}
type Histogram ¶
type Histogram interface {
Observe(value float64)
}
Histogram represents a histogram metric
type Measurement ¶
Measurement provides all stat measurement functions TODO: the API should not return a union of measurement methods, but rather a distinct type for each measurement type
type Option ¶
type Option func(*statsConfig)
Option is a function used to configure the stats service.
func WithDefaultHistogramBuckets ¶ added in v0.10.0
WithDefaultHistogramBuckets sets the histogram buckets for the stats service.
func WithHistogramBuckets ¶ added in v0.10.0
WithHistogramBuckets sets the histogram buckets for a measurement.
func WithPrometheusRegistry ¶ added in v0.11.0
func WithPrometheusRegistry(registerer prometheus.Registerer, gatherer prometheus.Gatherer) Option
WithPrometheusRegistry sets the prometheus registerer and gatherer for the stats service. If nil is passed the default ones will be used.
func WithServiceName ¶
WithServiceName sets the service name for the stats service.
func WithServiceVersion ¶
WithServiceVersion sets the service version for the stats service.
type Stats ¶
type Stats interface { // NewStat creates a new Measurement with provided Name and Type NewStat(name, statType string) (m Measurement) // NewTaggedStat creates a new Measurement with provided Name, Type and Tags NewTaggedStat(name, statType string, tags Tags) Measurement // NewSampledTaggedStat creates a new Measurement with provided Name, Type and Tags // Deprecated: use NewTaggedStat instead NewSampledTaggedStat(name, statType string, tags Tags) Measurement // Start starts the stats service and the collection of periodic stats. Start(ctx context.Context, goFactory GoRoutineFactory) error // Stop stops the service and the collection of periodic stats. Stop() }
Stats manages stat Measurements
var Default Stats
Default is the default (singleton) Stats instance
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
otel/prometheus
Package prometheus is imported from the official OpenTelemetry package: https://github.com/open-telemetry/opentelemetry-go/tree/v1.14.0/exporters/prometheus The version of the exporter would be v0.37.0 (not v1.14.0, see releases).
|
Package prometheus is imported from the official OpenTelemetry package: https://github.com/open-telemetry/opentelemetry-go/tree/v1.14.0/exporters/prometheus The version of the exporter would be v0.37.0 (not v1.14.0, see releases). |
Package metric implements an abstraction for safely managing metrics in concurrent environments.
|
Package metric implements an abstraction for safely managing metrics in concurrent environments. |
Package mock_stats is a generated GoMock package.
|
Package mock_stats is a generated GoMock package. |