Package org.infinispan.metrics.impl
Interface MetricsRegistry
- All Superinterfaces:
Constants
- All Known Implementing Classes:
MetricsRegistryImpl,NoMetricRegistry
A registry for metrics.
This component should not have any dependency on any other component. Also, the tag Constants.CACHE_MANAGER_TAG_NAME
should be set and match the one defined in GlobalConfiguration.cacheManagerName().
This registry should only be used if it needs to register metrics before the
Transport is started. Otherwise, MetricsCollector should be used as
it adds tags related to the node.
-
Field Summary
Fields inherited from interface org.infinispan.metrics.Constants
CACHE_MANAGER_TAG_NAME, CACHE_TAG_NAME, JGROUPS_CLUSTER_TAG_NAME, JGROUPS_PREFIX, NODE_TAG_NAME, SITE_TAG_NAME, TARGET_NODE -
Method Summary
Modifier and TypeMethodDescriptionbooleanregisterMetrics(Object instance, Collection<org.infinispan.commons.stat.MetricInfo> attributes, String namePrefix, Map<String, String> tags) Register theMBeanMetadata.AttributeMetadataas metrics.Prometheus like scrapping of the registered metrics.booleanIf this instance supports scrapping.voidunregisterMetric(Object metricId) Unregisters a single metric.default voidunregisterMetrics(Collection<Object> metricsId) Unregisters multiple metrics.
-
Method Details
-
registerMetrics
Set<Object> registerMetrics(Object instance, Collection<org.infinispan.commons.stat.MetricInfo> attributes, String namePrefix, Map<String, String> tags) Register theMBeanMetadata.AttributeMetadataas metrics.- Parameters:
instance- The instance from where metrics are collected.attributes- The attribute (metrics) to be registered, if valid.namePrefix- The prefix or the component name.tags- Extra tags to be attached to the metrics.- Returns:
- A set of ids that can be used by
unregisterMetric(Object)orunregisterMetrics(Collection).
-
unregisterMetric
Unregisters a single metric.If the
metricIdis not a valid id, this method does nothing.- Parameters:
metricId- The metric id as returned byregisterMetrics(Object, Collection, String, Map).
-
unregisterMetrics
Unregisters multiple metrics.Check
unregisterMetric(Object)for more details.- Parameters:
metricsId- The metric id as returned byregisterMetrics(Object, Collection, String, Map).
-
namesAsTags
boolean namesAsTags()- Returns:
trueif it should use tags to identify the cluster, site or cache manager name.
-
supportScrape
boolean supportScrape()If this instance supports scrapping.- Returns:
trueif it supports Prometheus scrapping.- See Also:
-
scrape
Prometheus like scrapping of the registered metrics.It returns
nullifsupportScrape()returnsfalse.- Parameters:
contentType- A valid content-type.- Returns:
- A
Stringwith the metrics values.
-