public interface PcpWriter
| Modifier and Type | Method and Description |
|---|---|
void |
addMetric(MetricName name,
Semantics semantics,
javax.measure.Unit<?> unit,
java.lang.Object initialValue)
Adds a new metric to the writer, with an initial default value.
|
<T> void |
addMetric(MetricName name,
Semantics semantics,
javax.measure.Unit<?> unit,
T initialValue,
TypeHandler<T> pcpType)
Adds a new metric to the writer, with an initial default value.
|
<T> void |
registerType(java.lang.Class<T> runtimeClass,
TypeHandler<T> handler)
Registers a new
TypeHandler to be used to convert all subsequent values of type
runtimeClass |
void |
reset()
Prepares this object such that it can be restarted by invoking the
start() method
again. |
void |
setInstanceDomainHelpText(java.lang.String instanceDomain,
java.lang.String shortHelpText,
java.lang.String longHelpText)
Sets the help text associated with an instance domain.
|
void |
setMetricHelpText(java.lang.String metricName,
java.lang.String shortHelpText,
java.lang.String longHelpText)
Sets the help text associated with a particular metric
|
void |
start()
Starts the Writer, freezing the file format and writing out the metadata and initial values.
|
void |
updateMetric(MetricName name,
java.lang.Object value)
Updates the metric value of the given metric, once the writer has been started
|
void addMetric(MetricName name, Semantics semantics, javax.measure.Unit<?> unit, java.lang.Object initialValue)
TypeHandler based on the runtime type of the initialValue parameter.name - the name of the metric to export. Must not exceed any byte-length limits specified
by the implementationsemantics - the PCP semantics of the metricunit - the unit used to measure the metric.initialValue - the 'default' value to write into the file at initialisation timejava.lang.IllegalArgumentException - if the name is too long, the metric name has already been added, or this is no
type handler registered for the runtime class of the initial valuejava.lang.IllegalStateException - if this writer has already been started, finalising the file layout<T> void addMetric(MetricName name, Semantics semantics, javax.measure.Unit<?> unit, T initialValue, TypeHandler<T> pcpType)
TypeHandler based on the runtime type of the initialValue parameter.name - the name of the metric to export. Must not exceed any byte-length limits specified
by the implementationsemantics - the PCP semantics of the metricunit - the unit used to measure the metric.initialValue - the 'default' value to write into the file at initialisation timepcpType - the type converter to use to render the initial value (and all subsequent values)
to the PCP streamjava.lang.IllegalArgumentException - if the name is too long or the metric name has already been addedjava.lang.IllegalStateException - if this writer has already been started, finalising the file layoutvoid updateMetric(MetricName name, java.lang.Object value)
name - the metric to updatevalue - the new value (must be convertible by the TypeHandler used when adding the
metric)<T> void registerType(java.lang.Class<T> runtimeClass,
TypeHandler<T> handler)
TypeHandler to be used to convert all subsequent values of type
runtimeClassruntimeClass - the class to be converted by the new handlerhandler - the handler to usevoid start()
throws java.io.IOException
java.io.IOException - if the file cannot be created or written.void setInstanceDomainHelpText(java.lang.String instanceDomain,
java.lang.String shortHelpText,
java.lang.String longHelpText)
instanceDomain - Java pseudo-instance domain identifier (i.e. metric prefix; for
animals.dog[xxx].size this is the 'animals.dog' part)shortHelpText - the short help text; must not exceed any length limits specified by the
implementationlongHelpText - the long explanatory text; must not exceed any length limits specified by the
implementationvoid setMetricHelpText(java.lang.String metricName,
java.lang.String shortHelpText,
java.lang.String longHelpText)
metricName - String version of the metric name, ignoring any possible instance domains. (e.g. for
animals.dog[xxx].size this is 'animals.dog.size')shortHelpText - the short help text; must not exceed any length limits specified by the
implementationlongHelpText - the long explanatory text; must not exceed any length limits specified by the
implementationvoid reset()
start() method
again.