Interface ISOMsgMetrics
- All Known Implementing Classes:
ISOMsgCounter
public interface ISOMsgMetrics
Interface for ISO message metrics tracking.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceImplemented by components that expose anISOMsgMetricsinstance. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault channel fields for metrics.static final StringDefault channel metric name.static final StringDefault tags for channel metrics.static final StringEnvironment variable name for channel fields configuration.static final StringEnvironment variable name for channel tags configuration. -
Method Summary
Modifier and TypeMethodDescriptionio.micrometer.core.instrument.TagsaddTags(io.micrometer.core.instrument.Tags tags) Adds metric tags to the given Tags object.default io.micrometer.core.instrument.TagsAdds metric tags from an array of strings.Returns the metric description.Returns the metric name.default StringA unique meter signature, concatenating the meter name, vertical pipe, comma-separated sorted list of all tag keys that this object produces.
Default implementation uses the values fromgetMetricName()andgetTags().io.micrometer.core.instrument.MeterRegistryReturns the meter registry.default io.micrometer.core.instrument.TagsgetTags()Returns all metric tags.voidRecords anISOMsgin the meter registry.
The metric name and tags will be taken strictly from this object's configuration.voidrecordMessage(ISOMsg m, MeterInfo meterInfo) Records anISOMsgin the meter registry.
Similar torecordMessage(ISOMsg)but using the metric name, description and maybe some tags taken from theMeterInfoargument.booleanregister(io.micrometer.core.instrument.MeterRegistry registry) Register this object to work with a givenMeterRegistry.
This method may serve more than one purpose in the object's lifecycle: Assign aMeterRegistryto be used for the created meters.voidRemoves all registered meters.voidsetMetricDescription(String metricDescription) Sets the metric description.voidsetMetricName(String metricName) Sets the metric name.voidIt callsremoveMeters()and clears its internal reference to itsMeterRegistry.
It will also "unfreeze" the object, making it available for reconfiguration.
-
Field Details
-
DEFAULT_CHANNEL_METRIC_NAME
Default channel metric name. -
ENV_CHANNEL_TAGS
Environment variable name for channel tags configuration.- See Also:
-
DEFAULT_TAGS
-
ENV_CHANNEL_FIELDS
Environment variable name for channel fields configuration.- See Also:
-
DEFAULT_CHANNEL_FIELDS
-
-
Method Details
-
setMetricName
Sets the metric name.- Parameters:
metricName- the metric name
-
getMetricName
-
getMetricDescription
-
setMetricDescription
Sets the metric description.- Parameters:
metricDescription- the metric description
-
addTags
Adds metric tags to the given Tags object.- Parameters:
tags- the Tags to add to- Returns:
- the updated Tags
-
addTags
-
getTags
Returns all metric tags.- Returns:
- the metric tags
-
recordMessage
Records anISOMsgin the meter registry.
The metric name and tags will be taken strictly from this object's configuration.
If this object hasn't been successfully registered, it throws anIllegalStateException.- Parameters:
m- theISOMsgto record.- Throws:
IllegalStateException- when this object hasn't been registered
-
recordMessage
Records anISOMsgin the meter registry.
Similar torecordMessage(ISOMsg)but using the metric name, description and maybe some tags taken from theMeterInfoargument.If the metric for that combination of
MeterInfovalues and local values fails to register in the globalMeterRegistry(or any underlying one like the Prometheus registry), the method may throw anIllegalStateException. This also happens if this object hasn't been successfully registered by The metric name and tags will be taken from what has been configured. If this object hasn't been successfully registered, it throws anIllegalStateException.- Parameters:
m- the ISO messagemeterInfo- the meter info to record- Throws:
IllegalStateException- if recording fails
-
register
Register this object to work with a givenMeterRegistry.
This method may serve more than one purpose in the object's lifecycle:- Assign a
MeterRegistryto be used for the created meters. (The registry can be obtained by callinggetRegistry()) - Before this object has been registered, it can be configured by setting tags, etc.,
but attempting to record a message (e.g. through
recordMessage(ISOMsg)) will throw anIllegalStateException. - After it has been registered, it's ready to record messages.
However, it can't be configured any longer, or it will throw an
IllegalStateException. The object's configuration can be considered "frozen". - In some (future) implementation, it may make use of the
getMetricSignature()to do some caching to ensure that every metric name has only one set of tag keys, thus avoiding metrics name+keyset collision inPrometheusMeterRegistry.
unregister()method should be called when done using this object.- Parameters:
registry- the meter registry to register with- Returns:
- true if successful, false if there was an error
- Assign a
-
unregister
void unregister()It callsremoveMeters()and clears its internal reference to itsMeterRegistry.
It will also "unfreeze" the object, making it available for reconfiguration. -
getRegistry
io.micrometer.core.instrument.MeterRegistry getRegistry()Returns the meter registry.- Returns:
- the MeterRegistry
-
removeMeters
void removeMeters()Removes all registered meters. -
getMetricSignature
A unique meter signature, concatenating the meter name, vertical pipe, comma-separated sorted list of all tag keys that this object produces.
Default implementation uses the values fromgetMetricName()andgetTags(). A concrete implementation must make sure of gathering all the appropriate tag keys from internal config state which may include more than what's returned bygetTags().- Returns:
- The unique metric signature.
-