Documentation
¶
Overview ¶
Package factory constructs a metrics.Sink from a URL, so the sink can be selected by configuration instead of by import.
sink, err := factory.NewMetricSinkFromURL("inmem://localhost?interval=10s&retain=1m")
if err != nil {
return err
}
if _, err := metrics.NewGlobal(metrics.DefaultConfig("billing"), sink); err != nil {
return err
}
Only the "inmem" scheme is registered; the Prometheus and CloudWatch sinks need options that do not map onto a URL and must be constructed directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMetricSinkFromURL ¶
NewMetricSinkFromURL allows a generic URL input to configure any of the supported sinks. The scheme of the URL identifies the type of the sink, and the query parameters are used to set options.
Supported schemes:
"inmem://" - Initializes an InmemSink. The host and port are ignored. The "interval" and "retain" query parameters must be specified with valid durations, see metrics.NewInmemSink for details.
The Prometheus and CloudWatch sinks are not available here: they need options, such as a registerer or an AWS namespace, that do not map onto a URL.
Types ¶
This section is empty.