class MetricImpl extends Object implements Metric
Modifier and Type | Class and Description |
---|---|
private static class |
MetricImpl.LocalConsumer |
Metric.Context
Modifier and Type | Field and Description |
---|---|
private MetricImpl.LocalConsumer |
consumer |
Constructor and Description |
---|
MetricImpl(com.google.inject.Provider<MetricConsumer> provider) |
Modifier and Type | Method and Description |
---|---|
void |
add(String key,
Number val,
Metric.Context ctx)
Add to a metric value.
|
Metric.Context |
createContext(Map<String,?> keys)
Creates a
MetricConsumer -specific Metric.Context object that encapsulates the given properties. |
private MetricConsumer |
currentConsumer() |
void |
set(String key,
Number val,
Metric.Context ctx)
Set a metric value.
|
private final MetricImpl.LocalConsumer consumer
@Inject public MetricImpl(com.google.inject.Provider<MetricConsumer> provider)
public void set(String key, Number val, Metric.Context ctx)
Metric
Set a metric value. This is typically used with histogram-type metrics.
public void add(String key, Number val, Metric.Context ctx)
Metric
Add to a metric value. This is typically used with counter-type metrics.
public Metric.Context createContext(Map<String,?> keys)
Metric
Creates a MetricConsumer
-specific Metric.Context
object that encapsulates the given properties. The
returned Context object should be passed along every future call to Metric.set(String, Number, Context)
and
Metric.add(String, Number, Context)
where the properties match those given here.
createContext
in interface Metric
keys
- The properties to incorporate in the context.private MetricConsumer currentConsumer()
Copyright © 2018. All rights reserved.