Class MetricUtils<T extends org.eclipse.microprofile.metrics.Metric>
- java.lang.Object
-
- fish.payara.microprofile.metrics.cdi.MetricUtils<T>
-
public final class MetricUtils<T extends org.eclipse.microprofile.metrics.Metric> extends Object
Unfortunately theMetricRegistry
has no generic versions of the get or register methods for the different types ofMetric
s. Therefore this utility provides a generic API by mapping the generic methods to the type specific ones.- Since:
- 5.202
- Author:
- Jan Bernitt
-
-
Field Summary
Fields Modifier and Type Field Description static String
TAG_METRIC_MP_APP_NAME
static String
TAG_METRIC_MP_SCOPE_NAME
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends org.eclipse.microprofile.metrics.Metric>
TgetOrRegisterByMetadataAndTags(org.eclipse.microprofile.metrics.MetricRegistry registry, Class<T> metric, org.eclipse.microprofile.metrics.Metadata metadata, org.eclipse.microprofile.metrics.Tag... tags)
static <T extends org.eclipse.microprofile.metrics.Metric>
TgetOrRegisterByName(org.eclipse.microprofile.metrics.MetricRegistry registry, Class<T> metric, String name)
static <T extends org.eclipse.microprofile.metrics.Metric>
TgetOrRegisterByNameAndTags(org.eclipse.microprofile.metrics.MetricRegistry registry, Class<T> metric, String name, org.eclipse.microprofile.metrics.Tag... tags)
static org.eclipse.microprofile.metrics.Tag[]
setScopeTagForMetric(String scope, org.eclipse.microprofile.metrics.Tag... tags)
This method will add the mp_scope to indicate scope of the metric if not available
-
-
-
Field Detail
-
TAG_METRIC_MP_SCOPE_NAME
public static final String TAG_METRIC_MP_SCOPE_NAME
- See Also:
- Constant Field Values
-
TAG_METRIC_MP_APP_NAME
public static final String TAG_METRIC_MP_APP_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOrRegisterByName
public static <T extends org.eclipse.microprofile.metrics.Metric> T getOrRegisterByName(org.eclipse.microprofile.metrics.MetricRegistry registry, Class<T> metric, String name)
-
getOrRegisterByNameAndTags
public static <T extends org.eclipse.microprofile.metrics.Metric> T getOrRegisterByNameAndTags(org.eclipse.microprofile.metrics.MetricRegistry registry, Class<T> metric, String name, org.eclipse.microprofile.metrics.Tag... tags)
-
getOrRegisterByMetadataAndTags
public static <T extends org.eclipse.microprofile.metrics.Metric> T getOrRegisterByMetadataAndTags(org.eclipse.microprofile.metrics.MetricRegistry registry, Class<T> metric, org.eclipse.microprofile.metrics.Metadata metadata, org.eclipse.microprofile.metrics.Tag... tags)
-
setScopeTagForMetric
public static org.eclipse.microprofile.metrics.Tag[] setScopeTagForMetric(String scope, org.eclipse.microprofile.metrics.Tag... tags)
This method will add the mp_scope to indicate scope of the metric if not available- Parameters:
scope
- the scope associated with the metrictags
- current tags available for the metric- Returns:
- array of tags including the mp_scope tag
-
-