Class AbstractMetricsClient
- All Implemented Interfaces:
MetricsClient,AutoCloseable
- Direct Known Subclasses:
StatsdClientImpl
MetricsClient implementations.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDefinition for metric that is periodically sampled. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMetricsClient(long samplingInterval, Consumer<Throwable> errorCallback) Create a client with a single-threaded task executor.protectedAbstractMetricsClient(long samplingInterval, Consumer<Throwable> errorCallback, int threadPoolSize) Create a client. -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustGauge(String metric, double delta) Adjust the specified gauge's value.voidadjustGauge(String metric, double delta, Unit unit) Adjust the specified gauge's value.voidadjustGauge(String metric, double delta, Unit unit, Set<Dimension> dimensions) Adjust the specified gauge's value.voidadjustGauge(String metric, double delta, Set<Dimension> dimensions) Adjust the specified gauge's value.voidadjustGauge(String namespace, String metric, double delta) Adjust the specified gauge's value.voidadjustGauge(String namespace, String metric, double delta, Unit unit) Adjust the specified gauge's value.voidAdjust the specified gauge's value.voidadjustGauge(String namespace, String metric, double delta, Set<Dimension> dimensions) Adjust the specified gauge's value.voidSet the specified attribute's value.voidSet the specified attribute's value.voidSet the specified attribute's value.voidSet the specified attribute's value.voidClear all periodically sampled gauges.final voidclose()Overridden to remove checked exception constraint.voidAdjust the counter value.voidAdjust the counter value.voidAdjust the counter value.voidAdjust the counter value.voidAdjust the counter value.voidAdjust the counter value.voidAdjust the counter value.voidAdjust the counter value.voidDecrement the counter by 1.voidDecrement the counter by 1.voidDecrement the counter by 1.voidDecrement the counter by 1.voidDecrement the counter by 1.voidDecrement the counter by 1.voidDecrement the counter by 1.voidDecrement the counter by 1.protected voidprotected abstract voiddoAttribute(String metric, String value, Set<Dimension> dimensions) protected voiddoClose()Close hook for implementations.protected abstract voidprotected voidprotected abstract voidprotected voiddoEvent(String namespace, String name, String message, Severity severity, Set<Dimension> dimensions) protected abstract voidprotected voiddoGauge(String namespace, String metric, double value, boolean isDelta, Unit unit, Set<Dimension> dimensions) protected abstract voidprotected voiddoTimer(String namespace, String metric, long value, TimeUnit unit, double sampleRate, Set<Dimension> dimensions) protected voidprotected abstract voidvoidReport an event.voidReport an event.voidReport an event.voidReport an event.protected static doublefractionalMillis(long value, TimeUnit unit) Convert an integer timer value to milliseconds with possible fractional component.voidSet the specified gauge's value.voidSet the specified gauge's value.voidSet the specified gauge's value.voidSet the specified gauge's value.voidSet the specified gauge's value.voidSet the specified gauge's value.voidSet the specified gauge's value.voidSet the specified gauge's value.voidgauge(String namespace, String metric, DoubleSupplier supplier) Register periodic sampling of a gauge.voidgauge(String namespace, String metric, DoubleSupplier supplier, Unit unit) Register periodic sampling of a gauge.voidgauge(String namespace, String metric, DoubleSupplier supplier, Unit unit, Set<Dimension> dimensions) Register periodic sampling of a gauge.voidRegister periodic sampling of a gauge.voidgauge(String metric, DoubleSupplier supplier) Register periodic sampling of a gauge.voidgauge(String metric, DoubleSupplier supplier, Unit unit) Register periodic sampling of a gauge.voidRegister periodic sampling of a gauge.voidgauge(String metric, DoubleSupplier supplier, Set<Dimension> dimensions) Register periodic sampling of a gauge.final longvoidIncrement the counter by 1.voidIncrement the counter by 1.voidIncrement the counter by 1.voidIncrement the counter by 1.voidIncrement the counter by 1.voidIncrement the counter by 1.voidIncrement the counter by 1.voidIncrement the counter by 1.protected final booleanvoidremoveGaugeSampler(String metric) Remove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier)orMetricsClient.gauge(String, DoubleSupplier, Unit).voidremoveGaugeSampler(String namespace, String metric) Remove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier)orMetricsClient.gauge(String, DoubleSupplier, Unit).voidremoveGaugeSampler(String namespace, String metric, Set<Dimension> dimensions) Remove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier, Set)orMetricsClient.gauge(String, DoubleSupplier, Unit, Set).voidremoveGaugeSampler(String metric, Set<Dimension> dimensions) Remove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier, Set)orMetricsClient.gauge(String, DoubleSupplier, Unit, Set).protected static voidrequireNotEmpty(String param, String val) protected static voidrequireNotNull(String param, Object val) protected voidscheduleTask(Runnable task, long interval) Schedule a periodic task.protected booleanshouldSample(double sampleRate) Whether an instrumentation should be sampled based on the given sample rate.protected voidsubmitTask(Runnable task) Submit a task.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time of an operation.voidReport elapsed time of an operation.voidReport elapsed time of an operation.voidReport elapsed time of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport elapsed time of an operation.voidReport elapsed time of an operation.voidtimer(String namespace, String metric, long value, TimeUnit unit, double sampleRate, Set<Dimension> dimensions) Report elapsed time of an operation.voidReport elapsed time of an operation.voidReport elapsed time (in milliseconds) of an operation.voidReport a unique value in a bucket or "set".voidReport a unique value in a bucket or "set".voidReport a unique value in a bucket or "set".voidReport a unique value in a bucket or "set".
-
Field Details
-
NO_DIMENSIONS
-
-
Constructor Details
-
AbstractMetricsClient
Create a client with a single-threaded task executor.- Parameters:
samplingInterval- interval (in millis) for periodic metric samplingerrorCallback- callback via which post-construction exceptions are reported- Throws:
IllegalArgumentException- if samplingInterval or threadPoolSize is less than oneNullPointerException- if errorCallback is null
-
AbstractMetricsClient
protected AbstractMetricsClient(long samplingInterval, Consumer<Throwable> errorCallback, int threadPoolSize) Create a client.- Parameters:
samplingInterval- interval (in millis) for periodic metric samplingerrorCallback- callback via which post-construction exceptions are reportedthreadPoolSize- number of threads to create in the executor's thread pool- Throws:
IllegalArgumentException- if samplingInterval or threadPoolSize is less than oneNullPointerException- if errorCallback is null
-
-
Method Details
-
shouldSample
protected boolean shouldSample(double sampleRate) Whether an instrumentation should be sampled based on the given sample rate.- Parameters:
sampleRate- sample rate- Returns:
- whether to sample
-
attribute
Description copied from interface:MetricsClientSet the specified attribute's value.- Specified by:
attributein interfaceMetricsClient- Parameters:
metric- attribute namevalue- attribute value
-
attribute
Description copied from interface:MetricsClientSet the specified attribute's value.- Specified by:
attributein interfaceMetricsClient- Parameters:
namespace- attribute namespacemetric- attribute namevalue- attribute value
-
attribute
Description copied from interface:MetricsClientSet the specified attribute's value.- Specified by:
attributein interfaceMetricsClient- Parameters:
metric- attribute namevalue- attribute valuedimensions- dimensions identifying the entity
-
attribute
Description copied from interface:MetricsClientSet the specified attribute's value.- Specified by:
attributein interfaceMetricsClient- Parameters:
namespace- attribute namespacemetric- attribute namevalue- attribute valuedimensions- dimensions identifying the entity
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.- Specified by:
incrementin interfaceMetricsClient- Parameters:
metric- metric name
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.- Specified by:
incrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric name
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
incrementin interfaceMetricsClient- Parameters:
metric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
incrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.- Specified by:
incrementin interfaceMetricsClient- Parameters:
metric- metric namedimensions- dimensions identifying the entity
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.- Specified by:
incrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedimensions- dimensions identifying the entity
-
increment
Description copied from interface:MetricsClientIncrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
incrementin interfaceMetricsClient- Parameters:
metric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
increment
public void increment(String namespace, String metric, double sampleRate, Set<Dimension> dimensions) Description copied from interface:MetricsClientIncrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
incrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.- Specified by:
decrementin interfaceMetricsClient- Parameters:
metric- metric name
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.- Specified by:
decrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric name
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
decrementin interfaceMetricsClient- Parameters:
metric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
decrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.- Specified by:
decrementin interfaceMetricsClient- Parameters:
metric- metric namedimensions- dimensions identifying the entity
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.- Specified by:
decrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedimensions- dimensions identifying the entity
-
decrement
Description copied from interface:MetricsClientDecrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
decrementin interfaceMetricsClient- Parameters:
metric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
decrement
public void decrement(String namespace, String metric, double sampleRate, Set<Dimension> dimensions) Description copied from interface:MetricsClientDecrement the counter by 1.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
decrementin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
count
Description copied from interface:MetricsClientAdjust the counter value.- Specified by:
countin interfaceMetricsClient- Parameters:
metric- metric namedelta- adjustment value
-
count
Description copied from interface:MetricsClientAdjust the counter value.- Specified by:
countin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- adjustment value
-
count
Description copied from interface:MetricsClientAdjust the counter value.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
countin interfaceMetricsClient- Parameters:
metric- metric namedelta- adjustment valuesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
count
Description copied from interface:MetricsClientAdjust the counter value.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
countin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- adjustment valuesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
count
Description copied from interface:MetricsClientAdjust the counter value.- Specified by:
countin interfaceMetricsClient- Parameters:
metric- metric namedelta- adjustment valuedimensions- dimensions identifying the entity
-
count
Description copied from interface:MetricsClientAdjust the counter value.- Specified by:
countin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- adjustment valuedimensions- dimensions identifying the entity
-
count
Description copied from interface:MetricsClientAdjust the counter value.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
countin interfaceMetricsClient- Parameters:
metric- metric namedelta- adjustment valuesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
count
public void count(String namespace, String metric, long delta, double sampleRate, Set<Dimension> dimensions) Description copied from interface:MetricsClientAdjust the counter value.This uses sampling in order to approximate the actual number of increments. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
countin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- adjustment valuesampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
event
Description copied from interface:MetricsClientReport an event.The event will be immediately reported for.
- Specified by:
eventin interfaceMetricsClient- Parameters:
name- event namemessage- messageseverity- severity
-
event
Description copied from interface:MetricsClientReport an event.The event will be immediately reported for.
- Specified by:
eventin interfaceMetricsClient- Parameters:
namespace- event namespacename- event namemessage- messageseverity- severity
-
event
Description copied from interface:MetricsClientReport an event.The event will be immediately reported for.
- Specified by:
eventin interfaceMetricsClient- Parameters:
name- event namemessage- messageseverity- severitydimensions- dimensions identifying the entity
-
event
public void event(String namespace, String name, String message, Severity severity, Set<Dimension> dimensions) Description copied from interface:MetricsClientReport an event.The event will be immediately reported for.
- Specified by:
eventin interfaceMetricsClient- Parameters:
namespace- event namespacename- event namemessage- messageseverity- severitydimensions- dimensions identifying the entity
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric nameabsoluteValue- absolute value
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric nameabsoluteValue- absolute value
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric nameabsoluteValue- absolute valueunit- unit of measure
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric nameabsoluteValue- absolute valueunit- unit of measure
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric nameabsoluteValue- absolute valuedimensions- dimensions identifying the entity
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric nameabsoluteValue- absolute valuedimensions- dimensions identifying the entity
-
gauge
Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric nameabsoluteValue- absolute valueunit- unit of measuredimensions- dimensions identifying the entity
-
gauge
public void gauge(String namespace, String metric, double absoluteValue, Unit unit, Set<Dimension> dimensions) Description copied from interface:MetricsClientSet the specified gauge's value.- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric nameabsoluteValue- absolute valueunit- unit of measuredimensions- dimensions identifying the entity
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
metric- metric namedelta- amount to adjust by
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- amount to adjust by
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
metric- metric namedelta- amount to adjust byunit- unit of measure
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- amount to adjust byunit- unit of measure
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
metric- metric namedelta- amount to adjust bydimensions- dimensions identifying the entity
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- amount to adjust bydimensions- dimensions identifying the entity
-
adjustGauge
Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
metric- metric namedelta- amount to adjust byunit- unit of measuredimensions- dimensions identifying the entity
-
adjustGauge
public void adjustGauge(String namespace, String metric, double delta, Unit unit, Set<Dimension> dimensions) Description copied from interface:MetricsClientAdjust the specified gauge's value.- Specified by:
adjustGaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedelta- amount to adjust byunit- unit of measuredimensions- dimensions identifying the entity
-
gauge
Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric namesupplier- value supplier called once per sampling interval
-
gauge
Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesupplier- value supplier called once per sampling interval
-
gauge
Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric namesupplier- value supplier called once per sampling intervaldimensions- dimensions identifying the entity
-
gauge
public void gauge(String namespace, String metric, DoubleSupplier supplier, Set<Dimension> dimensions) Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesupplier- value supplier called once per sampling intervaldimensions- dimensions identifying the entity
-
gauge
Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric namesupplier- value supplier called once per sampling intervalunit- unit of measure
-
gauge
Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesupplier- value supplier called once per sampling intervalunit- unit of measure
-
gauge
Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
metric- metric namesupplier- value supplier called once per sampling intervalunit- unit of measuredimensions- dimensions identifying the entity
-
gauge
public void gauge(String namespace, String metric, DoubleSupplier supplier, Unit unit, Set<Dimension> dimensions) Description copied from interface:MetricsClientRegister periodic sampling of a gauge.The client will sample the value at its configured sampling interval.
This method should only be called once per unique combination of metric name and dimensions. Duplicate registrations are ignored and may be reported via an implementation-specific error handler.
- Specified by:
gaugein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namesupplier- value supplier called once per sampling intervalunit- unit of measuredimensions- dimensions identifying the entity
-
removeGaugeSampler
Description copied from interface:MetricsClientRemove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier)orMetricsClient.gauge(String, DoubleSupplier, Unit).The metric name must correspond exactly to the original registration. The unit is ignored.
- Specified by:
removeGaugeSamplerin interfaceMetricsClient- Parameters:
metric- metric name
-
removeGaugeSampler
Description copied from interface:MetricsClientRemove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier)orMetricsClient.gauge(String, DoubleSupplier, Unit).The metric name must correspond exactly to the original registration. The unit is ignored.
- Specified by:
removeGaugeSamplerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric name
-
removeGaugeSampler
Description copied from interface:MetricsClientRemove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier, Set)orMetricsClient.gauge(String, DoubleSupplier, Unit, Set).The metric name and dimensions must correspond exactly to the original registration. The unit is ignored.
- Specified by:
removeGaugeSamplerin interfaceMetricsClient- Parameters:
metric- metric namedimensions- dimensions
-
removeGaugeSampler
Description copied from interface:MetricsClientRemove a periodically sampled gauge that was registered viaMetricsClient.gauge(String, DoubleSupplier, Set)orMetricsClient.gauge(String, DoubleSupplier, Unit, Set).The metric name and dimensions must correspond exactly to the original registration. The unit is ignored.
- Specified by:
removeGaugeSamplerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- metric namedimensions- dimensions
-
clearGaugeSamplers
public void clearGaugeSamplers()Description copied from interface:MetricsClientClear all periodically sampled gauges.- Specified by:
clearGaugeSamplersin interfaceMetricsClient
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namemillis- elapsed milliseconds
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namemillis- elapsed milliseconds
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namemillis- elapsed millisecondssampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namemillis- elapsed millisecondssampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namemillis- elapsed millisecondsdimensions- dimensions identifying the entity
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namemillis- elapsed millisecondsdimensions- dimensions identifying the entity
-
timer
Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namemillis- elapsed millisecondssampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
timer
public void timer(String namespace, String metric, long millis, double sampleRate, Set<Dimension> dimensions) Description copied from interface:MetricsClientReport elapsed time (in milliseconds) of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namemillis- elapsed millisecondssampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
timer
Description copied from interface:MetricsClientReport elapsed time of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namevalue- elapsed timeunit- value unit
-
timer
Description copied from interface:MetricsClientReport elapsed time of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namevalue- elapsed timeunit- value unit
-
timer
Description copied from interface:MetricsClientReport elapsed time of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namevalue- elapsed timeunit- value unitsampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
timer
Description copied from interface:MetricsClientReport elapsed time of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namevalue- elapsed timeunit- value unitsampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.
-
timer
Description copied from interface:MetricsClientReport elapsed time of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namevalue- elapsed timeunit- value unitdimensions- dimensions identifying the entity
-
timer
public void timer(String namespace, String metric, long value, TimeUnit unit, Set<Dimension> dimensions) Description copied from interface:MetricsClientReport elapsed time of an operation.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namevalue- elapsed timeunit- value unitdimensions- dimensions identifying the entity
-
timer
public void timer(String metric, long value, TimeUnit unit, double sampleRate, Set<Dimension> dimensions) Description copied from interface:MetricsClientReport elapsed time of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
metric- timer namevalue- elapsed timeunit- value unitsampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
timer
public void timer(String namespace, String metric, long value, TimeUnit unit, double sampleRate, Set<Dimension> dimensions) Description copied from interface:MetricsClientReport elapsed time of an operation.This uses sampling in order to approximate the actual number of invocations. An update will be reported for only
sampleRate * 100percent of all invocations.- Specified by:
timerin interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- timer namevalue- elapsed timeunit- value unitsampleRate- Percentage of invocations to actually report. If the specified value is zero or negative, nothing will be reported. If the value is 1 or greater, it will always report.dimensions- dimensions identifying the entity
-
unique
Description copied from interface:MetricsClientReport a unique value in a bucket or "set".The server will track the number of unique identifiers in the named set and report as a counter.
- Specified by:
uniquein interfaceMetricsClient- Parameters:
metric- set nameidentifier- unique identifier
-
unique
Description copied from interface:MetricsClientReport a unique value in a bucket or "set".The server will track the number of unique identifiers in the named set and report as a counter.
- Specified by:
uniquein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- set nameidentifier- unique identifier
-
unique
Description copied from interface:MetricsClientReport a unique value in a bucket or "set".The server will track the number of unique identifiers in the named set and report as a counter.
- Specified by:
uniquein interfaceMetricsClient- Parameters:
metric- set nameidentifier- unique identifierdimensions- dimensions identifying the entity
-
unique
Description copied from interface:MetricsClientReport a unique value in a bucket or "set".The server will track the number of unique identifiers in the named set and report as a counter.
- Specified by:
uniquein interfaceMetricsClient- Parameters:
namespace- metric namespacemetric- set nameidentifier- unique identifierdimensions- dimensions identifying the entity
-
doAttribute
-
doAttribute
-
doCount
-
doCount
-
doEvent
-
doEvent
-
doGauge
-
doGauge
-
doTimer
-
doTimer
-
doUnique
-
doUnique
-
fractionalMillis
Convert an integer timer value to milliseconds with possible fractional component.- Parameters:
value- valueunit- value unit- Returns:
- the equivalent value in milliseconds
-
close
public final void close()Description copied from interface:MetricsClientOverridden to remove checked exception constraint.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMetricsClient
-
doClose
protected void doClose()Close hook for implementations. -
getSamplingInterval
public final long getSamplingInterval()- Returns:
- the configured sampling interval
-
isClosing
protected final boolean isClosing()- Returns:
- whether the client has been instructed to close
-
submitTask
Submit a task.Depending on the number of submitted tasks, it may be necessary to create a larger thread pool. See
AbstractMetricsClient(long, Consumer, int).- Parameters:
task- task to execute
-
scheduleTask
Schedule a periodic task.Depending on the number of scheduled tasks, it may be necessary to create a thread pool. See
AbstractMetricsClient(long, Consumer, int).- Parameters:
task- task to executeinterval- fixed interval millis
-
requireNotEmpty
-
requireNotNull
-