public class MetricObjectNameFactory
extends java.lang.Object
implements com.codahale.metrics.ObjectNameFactory
ObjectName
instances.
The implementation relies on unique metric names generated by
OpletContext.uniquify(String)
to
successfully parse the job and oplet id.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_JOBID
The
jobId property key. |
static java.lang.String |
KEY_NAME
The
name property key. |
static java.lang.String |
KEY_OPID
The
opId (oplet id) property key. |
static java.lang.String |
KEY_TYPE
The
type property key. |
static java.lang.String |
PREFIX_JOBID
The prefix of the job id as serialized in the metric name.
|
static java.lang.String |
PREFIX_OPID
The prefix of the oplet id as serialized in the metric name.
|
static java.lang.String |
TYPE_PREFIX
Prefix of all metric types.
|
Constructor and Description |
---|
MetricObjectNameFactory() |
Modifier and Type | Method and Description |
---|---|
protected void |
addKeyProperties(java.lang.String buf,
java.util.Map<java.lang.String,java.lang.String> properties)
|
javax.management.ObjectName |
createName(java.lang.String type,
java.lang.String domain,
java.lang.String name)
Creates a JMX
ObjectName from the given domain, metric type,
and metric name. |
public static final java.lang.String TYPE_PREFIX
public static final java.lang.String KEY_NAME
name
property key.public static final java.lang.String KEY_TYPE
type
property key.public static final java.lang.String KEY_JOBID
jobId
property key.public static final java.lang.String KEY_OPID
opId
(oplet id) property key.public static final java.lang.String PREFIX_JOBID
public static final java.lang.String PREFIX_OPID
public javax.management.ObjectName createName(java.lang.String type, java.lang.String domain, java.lang.String name)
ObjectName
from the given domain, metric type,
and metric name.
If the metric name is an ObjectName pattern, or has a format which does not correspond to a valid ObjectName, this implementation attempts to create an ObjectName using the quoted metric name instead.
createName
in interface com.codahale.metrics.ObjectNameFactory
type
- the value of the "type" key property in the object name,
which represents the type of metric.domain
- the domain part of the object name.name
- the value of the "name" key property in the object name,
which represents the metric name.java.lang.RuntimeException
- wrapping a MalformedObjectNameException if
the implementation cannot create a valid object name.protected void addKeyProperties(java.lang.String buf, java.util.Map<java.lang.String,java.lang.String> properties)
KEY_JOBID
and KEY_OPID
key properties to the
specified properties map.
Assumes that the job and oplet identifiers are concatenated (possibly with other strings as well) using '.' as a separator.
buf
- contains serialized job and oplet identifiers separatedproperties
- key property mapCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641