Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseLabelPairsToTags ¶ added in v0.1.6
ParseLabelPairsToTags converts a list of label names and values to a list of tags, in format of "name:value".
func WrapHTTPHandler ¶ added in v0.1.2
WrapHTTPHandler wraps a HTTP server with the given Metrics instance. to collect telemetry for every request/response.
func WrapMicroServerHandler ¶ added in v0.1.2
func WrapMicroServerHandler(m Metrics, log log.Logger) server.HandlerWrapper
WrapMicroServerHandler wraps a Micro server with the given Metrics instance to collect telemetry for every request/response.
Types ¶
type Config ¶
type Config struct { HealthReportInterval time.Duration Datadog datadog.Config Prometheus prometheus.Config }
Config serves as a global telemetry configuration. Provide the required config for the desired telemetry backend(s).
type Metrics ¶
type Metrics interface { Gauge(name string, value float64, rate float64, tags ...string) Incr(name string, tags ...string) // should be used if the metric can go up or down Decr(name string, tags ...string) // should be used if the metric can go up or down Count(name string, value int64, tags ...string) IncMonotonic(name string, tags ...string) // should be used if the metric can go up only Error(errName string) Histogram(name string, value float64, rate float64, tags ...string) Time(name string, value time.Duration, tags ...string) Latency(jobName string, start time.Time, tags ...string) Close() error }
Metrics are used to record telemetry data. The primary types of telemetry data supported are Gauges, Counters, and Histograms; the rest are convenience wrappers around these.
func NewMetrics ¶
NewMetrics returns a new Metrics instance based on the given configuration. Enables only the telemetry backend(s) which is/are specified as enabled.
func NewNoopMetrics ¶ added in v0.1.4
func NewNoopMetrics() Metrics
NewNoopMetrics returns a new Metrics instance with no-op implementations.