public final class Metric extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
TAG_SEPARATOR |
Constructor and Description |
---|
Metric(MetricsSystem.InstanceType instanceType,
String source,
MetricType metricType,
String name,
Double value)
Constructs a
Metric instance. |
Modifier and Type | Method and Description |
---|---|
void |
addTag(String name,
String value)
Adds a new tag.
|
void |
addValue(double delta)
Add metric value delta to the existing value.
|
boolean |
equals(Object other) |
static Metric |
from(String fullName,
double value,
MetricType metricType)
Creates the metric from the full name and the value.
|
static Metric |
fromProto(Metric metric)
Constructs the metric object from the proto format.
|
String |
getFullMetricName() |
MetricsSystem.InstanceType |
getInstanceType() |
static String |
getMetricNameWithTags(String name,
String... tags)
Gets the metric name with the appendix of tags.
|
static String |
getMetricNameWithUserTag(String metricName,
String userName)
Gets a metric name with a specific user tag.
|
MetricType |
getMetricType() |
String |
getName() |
String |
getSource() |
Map<String,String> |
getTags() |
static String |
getTagUfsValueFromFullName(String fullName)
Gets value of ufs tag from the full metric name.
|
double |
getValue() |
int |
hashCode() |
void |
setValue(double value)
Set the metric value.
|
Metric |
toProto() |
String |
toString() |
public static final String TAG_SEPARATOR
public Metric(MetricsSystem.InstanceType instanceType, String source, MetricType metricType, String name, Double value)
Metric
instance.instanceType
- the instance typesource
- the metric sourcemetricType
- the type of the metricname
- the metric namevalue
- the valuepublic void addValue(double delta)
MetricsStore
delta
- value to addpublic void setValue(double value)
MetricsStore
value
- value to setpublic double getValue()
public MetricsSystem.InstanceType getInstanceType()
public void addTag(String name, String value)
name
- the tag namevalue
- the tag valuepublic String getSource()
public MetricType getMetricType()
public String getName()
public String getFullMetricName()
public Metric toProto()
public static String getMetricNameWithTags(String name, String... tags)
name
- the metric nametags
- the tag name and tag value pairspublic static String getMetricNameWithUserTag(String metricName, String userName)
metricName
- the name of the metricuserName
- the userpublic static String getTagUfsValueFromFullName(String fullName)
fullName
- the full metric namepublic static Metric from(String fullName, double value, MetricType metricType)
fullName
- the full namevalue
- the valuemetricType
- the type of metric that is being createdpublic static Metric fromProto(Metric metric)
metric
- the metric in proto formatCopyright © 2023. All Rights Reserved.