Reference Guide

Table Of Contents
TimeStampedRollingCounter
RollingCounterDescriptor
RollingCounterDescriptorBuilder
TimeStampedTimer
TimerDescriptor
TimerDescriptorBuilder
Using MetricDescriptorBuilders represents the application of a well-known design pattern that
allows most of the fields of each MetricDescriptor subtype instance that is produced to be
defaulted to commonly-used values. Thus, for a typical use case in which the defaults are
applicable, the component or application that is using a MetricDescriptorBuilder to produce a
MetricDescriptor subtype instance can specify values only for the fields of the
MetricDescriptorBuilder subtype that are to differ from the default values.
Call MetricService
Once a MetricDescriptor has been created, the component or application creating a
TimeStampedMetric can invoke the appropriate MetricService method for the metric type they wish
to create. The MetricService methods that pertain to TimeStampedMetric creation are listed below.
Note that the creation of one TimeStampedMetric type, TimeStampedRollingCounter, offers the
option to specify an extra parameter above and beyond the properties conveyed by
theMetricDescriptor object.
MetricService:
public interface MetricService {
public TimeStampedCounter createCounter(CounterDescriptor descriptor);
public TimeStampedGauge createGauge(GaugeDescriptor descriptor);
public TimeStampedHistogram createHistogram(
HistogramDescriptor descriptor);
public TimeStampedMeter createMeter(MeterDescriptor descriptor);
public TimeStampedRatioGauge createRatioGauge(
RatioGaugeDescriptor descriptor);
public TimeStampedRollingCounter createRollingCounter(
RollingCounterDescriptor descriptor);
public TimeStampedRollingCounter createRollingCounter(
RollingCounterDescriptor descriptor, long primingValue);
public TimeStampedTimer createTimer(TimerDescriptor descriptor);
}
The optional extra parameter for the TimeStampedRollingCounter is an initial priming value for the
rolling counter that will be used to take subsequent delta values. Otherwise the value of the
TimeStampedRollingCounter instance the first time it should be persisted will instead be used to
prime the rolling counter and no value will be observed until its second persistence occurs.
Upon acquiring a TimeStampedMetric instance from the MetricService, the component or
application that requested the creation has a reference to the resulting TimeStampedMetric. The
value of the TimeStampedMetric may be updated whenever the component or application wishes,
as frequently or infrequently as desired, on a schedule or completely asynchronously; the
framework's interaction with the TimeStampedMetric is unaffected by these factors. The method(s)
that may be used to update the value of a TimeStampedMetric will depend upon the type of
TimeStampedMetric. Each time the value of a TimeStampedMetric is updated, a time stamp in the
50