Documentation ¶
Overview ¶
Package metrics abstract various providers around OpenTelemetry metric.Reader
Index ¶
- func GetPullServices() []otel2.PullServiceDiscovery
- func HasProviders() bool
- func HasPullServices() bool
- func InitReaders(ctx context.Context, svc otel2.Service, cfg Config) error
- type Config
- type Counter
- type Gauge
- type MeterHelper
- type ReaderProvider
- type Stopwatch
- type StopwatchRecorder
- type Timer
- type URLMux
- type URLOpener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPullServices ¶
func GetPullServices() []otel2.PullServiceDiscovery
func HasProviders ¶
func HasProviders() bool
func HasPullServices ¶
func HasPullServices() bool
Types ¶
type Config ¶
type Config struct {
Readers []string `json:"readers" yaml:"readers"`
}
Config is a serializable representation of a list of Readers.
type Counter ¶
type Counter interface { // Inc increments the counter by a delta. Inc(delta int64) }
Counter is the interface for emitting counter type metrics.
type Gauge ¶
type Gauge interface { // Update sets the gauges absolute value. Update(value float64) }
Gauge is the interface for emitting gauge metrics.
type MeterHelper ¶
type MeterHelper interface { metric.Meter Counter(name string, descriptionAndUnit ...string) Counter Gauge(name string, descriptionAndUnit ...string) Gauge Timer(name string, description ...string) Timer }
MeterHelper interface expands OpenTelemetry interface with some easy-to user counters/gauges. They are compatible with legacy tally+prometheus library.
func Helper ¶
func Helper() MeterHelper
func ServiceHelper ¶
func ServiceHelper(serviceName string) MeterHelper
ServiceHelper is a shorthand for TaggedHelper with service key.
func TaggedHelper ¶
func TaggedHelper(tags map[string]string) MeterHelper
TaggedHelper stores tags internally and add them as Attributes at record time.
type ReaderProvider ¶
func OpenReader ¶
func OpenReader(ctx context.Context, urlstr string) (ReaderProvider, error)
OpenReader opens the Registry identified by the URL given. See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.
type Stopwatch ¶
type Stopwatch struct {
// contains filtered or unexported fields
}
Stopwatch is a helper for simpler tracking of elapsed time, use the Stop() method to report time elapsed since its created back to the timer or histogram.
func NewStopwatch ¶
func NewStopwatch(start time.Time, r StopwatchRecorder) Stopwatch
NewStopwatch creates a new immutable stopwatch for recording the start time to a stopwatch reporter.
type StopwatchRecorder ¶
StopwatchRecorder is a recorder that is called when a stopwatch is stopped with Stop().
type Timer ¶
type Timer interface { // Record a specific duration directly. Record(value time.Duration) // Start gives you back a specific point in time to report via Stop. Start() Stopwatch }
Timer is the interface for emitting timer metrics.
type URLMux ¶
type URLMux struct {
// contains filtered or unexported fields
}
URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.
The zero value is a multiplexer with no registered schemes.
func DefaultURLMux ¶
func DefaultURLMux() *URLMux
DefaultURLMux returns the URLMux used by OpenTopic and OpenSubscription.
Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.
func (*URLMux) OpenReader ¶
OpenReader calls OpenTopicURL with the URL parsed from urlstr. OpenTopic is safe to call from multiple goroutines.
Directories ¶
Path | Synopsis |
---|---|
Package otlp provides an OpenTelemetry protocol exporter for metrics
|
Package otlp provides an OpenTelemetry protocol exporter for metrics |
Package prometheus provides a Prometheus collector and the required cells HTTP services to expose metrics.
|
Package prometheus provides a Prometheus collector and the required cells HTTP services to expose metrics. |