public interface MetricService
| Modifier and Type | Field and Description |
|---|---|
static String |
WILDCARD
Constant the represents a wildcard parameter during communication between
metering REST and business logic layers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
configureAgingDays(int days)
Method that can be called to change the metering configuration for how
long persisted data is retained.
|
TimeStampedCounter |
createCounter(CounterDescriptor descriptor)
Returns a new
TimeStampedCounter object based upon the provided
CounterDescriptor. |
TimeStampedGauge |
createGauge(GaugeDescriptor descriptor)
Returns a new
TimeStampedGauge object based upon the provided
GaugeDescriptor. |
TimeStampedHistogram |
createHistogram(HistogramDescriptor descriptor)
Returns a new
TimeStampedHistogram object based upon the
provided HistogramDescriptor. |
TimeStampedMeter |
createMeter(MeterDescriptor descriptor)
Returns a new
TimeStampedMeter object based upon the provided
MeterDescriptor. |
TimeStampedRatioGauge |
createRatioGauge(RatioGaugeDescriptor descriptor)
Returns a new
TimeStampedRatioGauge object based upon the
provided RatioGaugeDescriptor. |
TimeStampedRollingCounter |
createRollingCounter(RollingCounterDescriptor descriptor)
Returns a new
TimeStampedRollingCounter object based upon the
provided RollingCounterDescriptor. |
TimeStampedTimer |
createTimer(TimerDescriptor descriptor)
Returns a new
TimeStampedTimer object based upon the provided
TimerDescriptor. |
Map<String,String> |
getApplications()
Returns application IDs and names for applications that have metrics
persisted for them.
|
MetricDescriptor |
getMetric(String uid)
Returns the descriptor details of an existing metric if found
|
Set<String> |
getMetricNames(String appId,
String primaryTag,
String secondaryTag)
Returns metric names associated with the application ID, primary tag, and
secondary tag.
|
Map<MetricDescriptor,String> |
getPersistedMetrics(String appId,
String primaryTag,
String secondaryTag,
String name)
Returns all persisted metrics registered and available from the specified
application, primaryTag, secondaryTag and metric name.
|
Set<String> |
getPrimaryTags(String appId,
String name)
Returns primary tags associated with the application ID and metric name.
|
Set<String> |
getSecondaryTags(String appId,
String name,
String primaryTag)
Returns secondary tags associated with the application ID, primary tag,
and metric name.
|
String |
getUid(String appId,
String name,
String primaryTag,
String secondaryTag)
Returns the
UID of the specific metric identified by an
application ID, metric name, primary tag, and secondary tag. |
Set<String> |
getUids(String appId)
Returns metric
UIDs associated with an application ID. |
Set<String> |
getUids(String appId,
String name)
Returns metric
UIDs associated with the application ID and metric
name. |
Set<String> |
getUids(String appId,
String name,
String primaryTag)
Returns metric
UIDs associated with the application ID, primary
tag, and metric name. |
MetricValue |
getValue(String uid)
Returns the latest
MetricValue based on the specified metric
UID. |
List<MetricValue> |
getValues(String uid,
Date beginDate,
Date endDate,
long interval)
Returns
MetricValues based on the specified metric UID,
the time range, and the summary interval. |
TimeStampedMetric |
recreateMetric(String uid)
Recreates a previously existing
TimeStampedMetric with the
specified UID. |
void |
registerMetric(TimeStampedMetric toRegister)
Registers an existing
TimeStampedMetric with the metering
framework. |
void |
removeMetric(TimeStampedMetric toRemove)
Removes an existing
TimeStampedMetric object from the metering
framework, essentially unregistering it so that the framework no longer
processes its values. |
static final String WILDCARD
void configureAgingDays(int days)
days - the number of days to age the dataTimeStampedCounter createCounter(CounterDescriptor descriptor)
TimeStampedCounter object based upon the provided
CounterDescriptor.descriptor - CounterDescriptor initialized to embody the
desired properties of the TimeStampedCounter
to be createdTimeStampedCounter objectTimeStampedGauge createGauge(GaugeDescriptor descriptor)
TimeStampedGauge object based upon the provided
GaugeDescriptor.descriptor - GaugeDescriptor initialized to embody the
desired properties of the TimeStampedGauge to
be createdTimeStampedGauge objectTimeStampedHistogram createHistogram(HistogramDescriptor descriptor)
TimeStampedHistogram object based upon the
provided HistogramDescriptor.descriptor - HistogramDescriptor initialized to embody the
desired properties of the TimeStampedHistogram
to be createdTimeStampedHistogram objectTimeStampedMeter createMeter(MeterDescriptor descriptor)
TimeStampedMeter object based upon the provided
MeterDescriptor.descriptor - MeterDescriptor initialized to embody the
desired properties of the TimeStampedMeter to
be createdTimeStampedMeter objectTimeStampedRatioGauge createRatioGauge(RatioGaugeDescriptor descriptor)
TimeStampedRatioGauge object based upon the
provided RatioGaugeDescriptor.descriptor - RatioGaugeDescriptor initialized to embody the
desired properties of the TimeStampedRatioGauge
to be createdTimeStampedRatioGauge objectTimeStampedRollingCounter createRollingCounter(RollingCounterDescriptor descriptor)
TimeStampedRollingCounter object based upon the
provided RollingCounterDescriptor.descriptor - RollingCounterDescriptor initialized to embody
the desired properties of the TimeStampedRollingCounter to be createdTimeStampedRollingCounter objectTimeStampedTimer createTimer(TimerDescriptor descriptor)
TimeStampedTimer object based upon the provided
TimerDescriptor.descriptor - TimerDescriptor initialized to embody the
desired properties of the TimeStampedTimer to
be createdTimeStampedTimer objectMap<MetricDescriptor,String> getPersistedMetrics(String appId, String primaryTag, String secondaryTag, String name)
appId - application ID to filter the results with; if no value is
specified the ID corresponding to the base controller will
be usedprimaryTag - primary tag to filter the results with; if no value is
specified a default value will be usedsecondaryTag - secondary tag to filter the results with; if no value
is specified a default value will be usedname - metric name to filter the results with; if no value is
specified this field will be ignoredMap of MetricDescriptorsMetricDescriptor getMetric(String uid)
uid - The unique metric identifierMetricDescriptorMap<String,String> getApplications()
Map of application IDs to application namesSet<String> getMetricNames(String appId, String primaryTag, String secondaryTag)
appId - application IDprimaryTag - primary tag associated with the metric; may be the
reserved WILDCARD value or may be nullsecondaryTag - secondary tag associated with the metric; may be the
reserved WILDCARD value or may be nullSet of metric names associated with the application ID,
primary tag, and secondary tagSet<String> getPrimaryTags(String appId, String name)
appId - application IDname - metric name; may be the reserved WILDCARD valueSet of primary tags associated with the specific
application and nameSet<String> getSecondaryTags(String appId, String name, String primaryTag)
appId - application IDname - metric name; may be the reserved WILDCARD valueprimaryTag - primary tag associated with the metric; may be the
reserved WILDCARD value or may be nullSet of secondary tags associated with the application ID,
metric name, and primary tagString getUid(String appId, String name, String primaryTag, String secondaryTag)
UID of the specific metric identified by an
application ID, metric name, primary tag, and secondary tag.appId - application IDname - metric nameprimaryTag - primary tagsecondaryTag - secondary tagUIDSet<String> getUids(String appId)
UIDs associated with an application ID.appId - application IDSet of metric UIDsSet<String> getUids(String appId, String name)
UIDs associated with the application ID and metric
name.appId - application IDname - metric nameSet of metric UIDsSet<String> getUids(String appId, String name, String primaryTag)
UIDs associated with the application ID, primary
tag, and metric name.appId - application IDname - metric nameprimaryTag - primary tagSet of metric UIDsMetricValue getValue(String uid) throws DataFormatException, IOException
MetricValue based on the specified metric
UID.uid - metric UIDMetricValue for the specified metricInvalidParameterException - if the corresponding metric identifier
does not existDataFormatException - if the expected file content cannot be readIOException - if the expected file cannot be accessedList<MetricValue> getValues(String uid, Date beginDate, Date endDate, long interval) throws DataFormatException, IOException
MetricValues based on the specified metric UID,
the time range, and the summary interval.uid - metric UIDbeginDate - first date to include values fromendDate - last date to include values frominterval - summary interval in minute(s)List of MetricValuesInvalidParameterException - if the corresponding metric identifier
does not existDataFormatException - if the expected file content cannot be readIOException - if the expected file cannot be accessedTimeStampedMetric recreateMetric(String uid)
TimeStampedMetric with the
specified UID. Should the metering framework bounce while other
controller components stay up, those components will still have
references to UIDs of TimeStampedMetric objects allocated
before the framework went down. To ensure that the metering framework
processes such TimeStampedMetrics properly for persistence, JMX
exposure, etc. after the framework comes back up they should be
re-created within the metering framework after it comes back up.uid - UID of a previously existing TimeStampedMetricTimeStampedMetric created with the specified
UIDvoid registerMetric(TimeStampedMetric toRegister)
TimeStampedMetric with the metering
framework. Should the metering framework bounce while other controller
components stay up, those components will still have references to TimeStampedMetric objects allocated before the framework went down. To
ensure that the metering framework processes such TimeStampedMetrics properly for persistence, JMX exposure, etc. after
the framework comes back up they should be re-registered with the
metering framework after it comes back up.toRegister - TimeStampedMetric to re-registervoid removeMetric(TimeStampedMetric toRemove)
TimeStampedMetric object from the metering
framework, essentially unregistering it so that the framework no longer
processes its values. If the TimeStampedMetric was exposed via
JMX it will be removed from the JMX server. Values already persisted for
the TimeStampedMetric will not be altered, but will be allowed to
eventually age out if the TimeStampedMetric is not eventually
re-registered to provide new values.toRemove - TimeStampedMetric to remove from the metering
frameworkCopyright © 2014. All Rights Reserved.