Interface MetricsRegistry
- All Superinterfaces:
Constants
- All Known Implementing Classes:
NoMetricRegistry, PrometheusRegistry, PrometheusSimpleClientRegistry
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 Constants
CACHE_MANAGER_TAG_NAME, CACHE_TAG_NAME, INFINISPAN_PREFIX, JGROUPS_CLUSTER_TAG_NAME, JGROUPS_PREFIX, NODE_TAG_NAME, SITE_TAG_NAME, TARGET_NODE, VENDOR_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionbooleanlegacy()Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.registerMetrics(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 scraping.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).
-
legacy
Deprecated, for removal: This API element is subject to removal in a future version.Same asGlobalMetricsConfiguration.legacy().- Returns:
trueif legacy metrics should be exported.
-
namesAsTags
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
trueif it should use tags to identify the cluster, site or cache manager name.
-
supportScrape
boolean supportScrape()If this instance supports scraping.- 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.
-