import "github.com/go-kit/kit/metrics/graphite"
Package graphite provides a Graphite backend for metrics. Metrics are batched and emitted in the plaintext protocol. For more information, see
Graphite does not have a native understanding of metric parameterization, so label values not supported. Use distinct metrics for each unique combination of label values.
Counter is a Graphite counter metric.
NewCounter returns a new usable counter metric.
Add implements counter.
With is a no-op.
Gauge is a Graphite gauge metric.
NewGauge returns a new usable Gauge metric.
Add implements metrics.Gauge.
Set implements gauge.
With is a no-op.
Graphite receives metrics observations and forwards them to a Graphite server. Create a Graphite object, use it to create metrics, and pass those metrics as dependencies to the components that will use them.
All metrics are buffered until WriteTo is called. Counters and gauges are aggregated into a single observation per timeseries per write. Histograms are exploded into per-quantile gauges and reported once per write.
To regularly report metrics to an io.Writer, use the WriteLoop helper method. To send to a Graphite server, use the SendLoop helper method.
New returns a Graphite object that may be used to create metrics. Prefix is applied to all created metrics. Callers must ensure that regular calls to WriteTo are performed, either manually or with one of the helper methods.
NewCounter returns a counter. Observations are aggregated and emitted once per write invocation.
NewGauge returns a gauge. Observations are aggregated and emitted once per write invocation.
NewHistogram returns a histogram. Observations are aggregated and emitted as per-quantile gauges, once per write invocation. 50 is a good default value for buckets.
SendLoop is a helper method that wraps WriteLoop, passing a managed connection to the network and address. Like WriteLoop, this method blocks until ctx is canceled, ctx is canceled, so clients probably want to run it in its own goroutine. For typical usage, create a time.Ticker and pass its C channel to this method.
WriteTo flushes the buffered content of the metrics to the writer, in Graphite plaintext format. WriteTo abides best-effort semantics, so observations are lost if there is a problem with the write. Clients should be sure to call WriteTo regularly, ideally through the WriteLoop or SendLoop helper methods.
Histogram is a Graphite histogram metric. Observations are bucketed into per-quantile gauges.
NewHistogram returns a new usable Histogram metric.
Observe implements histogram.
With is a no-op.
Package graphite imports 9 packages (graph) and is imported by 24 packages. Updated 2019-02-20. Refresh now. Tools for package owners.