public class MetricsAssertHelperImpl extends Object implements MetricsAssertHelper
Modifier and Type | Class and Description |
---|---|
class |
MetricsAssertHelperImpl.MockMetricsBuilder |
class |
MetricsAssertHelperImpl.MockRecordBuilder |
Modifier and Type | Field and Description |
---|---|
private Map<String,Long> |
counters |
private Map<String,Number> |
gauges |
private Map<String,String> |
tags |
Constructor and Description |
---|
MetricsAssertHelperImpl() |
Modifier and Type | Method and Description |
---|---|
void |
assertCounter(String name,
long expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a counter exists and that it's value is equal to the expected value.
|
void |
assertCounterGt(String name,
long expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a counter exists and that it's value is greater than the given value.
|
void |
assertCounterLt(String name,
long expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a counter exists and that it's value is less than the given value.
|
void |
assertGauge(String name,
double expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a gauge exists and that it's value is equal to the expected value.
|
void |
assertGauge(String name,
long expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a gauge exists and that it's value is equal to the expected value.
|
void |
assertGaugeGt(String name,
double expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a gauge exists and it's value is greater than a given value
|
void |
assertGaugeGt(String name,
long expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a gauge exists and it's value is greater than a given value
|
void |
assertGaugeLt(String name,
double expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a gauge exists and it's value is less than a given value
|
void |
assertGaugeLt(String name,
long expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a gauge exists and it's value is less than a given value
|
void |
assertTag(String name,
String expected,
org.apache.hadoop.hbase.metrics.BaseSource source)
Assert that a tag exists and has a given value.
|
private String |
canonicalizeMetricName(String in) |
boolean |
checkCounterExists(String name,
org.apache.hadoop.hbase.metrics.BaseSource source)
Check if a dynamic counter exists.
|
boolean |
checkGaugeExists(String name,
org.apache.hadoop.hbase.metrics.BaseSource source)
Check if a gauge exists.
|
long |
getCounter(String name,
org.apache.hadoop.hbase.metrics.BaseSource source)
Get the value of a counter.
|
double |
getGaugeDouble(String name,
org.apache.hadoop.hbase.metrics.BaseSource source)
Get the value of a gauge as a double.
|
long |
getGaugeLong(String name,
org.apache.hadoop.hbase.metrics.BaseSource source)
Get the value of a gauge as a long.
|
private void |
getMetrics(org.apache.hadoop.hbase.metrics.BaseSource source) |
void |
init()
Init helper.
|
private void |
reset() |
String |
toDebugString(org.apache.hadoop.hbase.metrics.BaseSource source)
Generates a representation of all metrics exported by the given
source . |
public MetricsAssertHelperImpl()
public void init()
MetricsAssertHelper
init
in interface MetricsAssertHelper
public void assertTag(String name, String expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertTag
in interface MetricsAssertHelper
name
- The name of the tag.expected
- The expected valuesource
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertGauge(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertGauge
in interface MetricsAssertHelper
name
- The name of the gaugeexpected
- The expected value of the gauge.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertGaugeGt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertGaugeGt
in interface MetricsAssertHelper
name
- The name of the gaugeexpected
- Value that the gauge is expected to be greater thansource
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertGaugeLt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertGaugeLt
in interface MetricsAssertHelper
name
- The name of the gaugeexpected
- Value that the gauge is expected to be less thansource
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertGauge(String name, double expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertGauge
in interface MetricsAssertHelper
name
- The name of the gaugeexpected
- The expected value of the gauge.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertGaugeGt(String name, double expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertGaugeGt
in interface MetricsAssertHelper
name
- The name of the gaugeexpected
- Value that the gauge is expected to be greater thansource
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertGaugeLt(String name, double expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertGaugeLt
in interface MetricsAssertHelper
name
- The name of the gaugeexpected
- Value that the gauge is expected to be less thansource
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertCounter(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertCounter
in interface MetricsAssertHelper
name
- The name of the counter.expected
- The expected valuesource
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertCounterGt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertCounterGt
in interface MetricsAssertHelper
name
- The name of the counter.expected
- The value the counter is expected to be greater than.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public void assertCounterLt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
assertCounterLt
in interface MetricsAssertHelper
name
- The name of the counter.expected
- The value the counter is expected to be less than.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public long getCounter(String name, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
getCounter
in interface MetricsAssertHelper
name
- name of the counter.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public boolean checkCounterExists(String name, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
checkCounterExists
in interface MetricsAssertHelper
name
- name of the counter.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public boolean checkGaugeExists(String name, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
checkGaugeExists
in interface MetricsAssertHelper
name
- name of the gauge.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public double getGaugeDouble(String name, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
getGaugeDouble
in interface MetricsAssertHelper
name
- name of the gauge.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public long getGaugeLong(String name, org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
getGaugeLong
in interface MetricsAssertHelper
name
- name of the gauge.source
- The BaseSourceBaseSource
that will provide the tags, gauges, and
counters.public String toDebugString(org.apache.hadoop.hbase.metrics.BaseSource source)
MetricsAssertHelper
source
.toDebugString
in interface MetricsAssertHelper
source
- The BaseSource
that will provide the metrics.private void reset()
private void getMetrics(org.apache.hadoop.hbase.metrics.BaseSource source)
private String canonicalizeMetricName(String in)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.