类 StatsdMetricWriter
- java.lang.Object
- org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter
- 所有已实现的接口:
Closeable
,AutoCloseable
,CounterWriter
,GaugeWriter
,MetricWriter
public class StatsdMetricWriter extends Object implements MetricWriter, Closeable
AMetricWriter
that pushes data to statsd. Statsd has the concept of counters and gauges, but only supports gauges with data type Long, so values will be truncated towards zero. Metrics whose name contains "timer." (but not "gauge." or "counter.") will be treated as execution times (in statsd terms). Anything incremented is treated as a counter, and anything with a snapshot value inset(Metric)
is treated as a gauge.- 从以下版本开始:
- 1.3.0
构造器概要
构造器 构造器 说明 StatsdMetricWriter(com.timgroup.statsd.StatsDClient client)
Create a new writer with the given client.StatsdMetricWriter(String host, int port)
Create a new writer instance with the given parameters.StatsdMetricWriter(String prefix, String host, int port)
Create a new writer with the given parameters.
构造器详细资料
StatsdMetricWriter
public StatsdMetricWriter(String host, int port)
Create a new writer instance with the given parameters.- 参数:
host
- the hostname for the statsd serverport
- the port for the statsd server
StatsdMetricWriter
public StatsdMetricWriter(String prefix, String host, int port)
Create a new writer with the given parameters.- 参数:
prefix
- the prefix to apply to all metric names (can be null)host
- the hostname for the statsd serverport
- the port for the statsd server
StatsdMetricWriter
public StatsdMetricWriter(com.timgroup.statsd.StatsDClient client)
Create a new writer with the given client.- 参数:
client
- StatsD client to write metrics with
方法详细资料
increment
public void increment(Delta<?> delta)
从接口复制的说明:CounterWriter
Increment the value of a metric (or decrement if the delta is negative). The name of the delta is the name of the metric to increment.- 指定者:
increment
在接口中CounterWriter
- 参数:
delta
- the amount to increment by
set
public void set(Metric<?> value)
从接口复制的说明:GaugeWriter
Set the value of a metric.- 指定者:
set
在接口中GaugeWriter
- 参数:
value
- the value
reset
public void reset(String name)
从接口复制的说明:CounterWriter
Reset the value of a metric, usually to zero value. Implementations can discard the old values if desired, but may choose not to. This operation is optional (some implementations may not be able to fulfill the contract, in which case they should simply do nothing).- 指定者:
reset
在接口中CounterWriter
- 参数:
name
- the name to reset
close
public void close()
- 指定者:
close
在接口中AutoCloseable
- 指定者:
close
在接口中Closeable