Package org.apache.hadoop.hbase.test
Class MetricsAssertHelperImpl
java.lang.Object
org.apache.hadoop.hbase.test.MetricsAssertHelperImpl
- All Implemented Interfaces:
MetricsAssertHelper
A helper class that will allow tests to get into hadoop2's metrics2 values.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclass -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassertCounter(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.voidassertCounterGt(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.voidassertCounterLt(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.voidassertGauge(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.voidassertGauge(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.voidassertGaugeGt(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 valuevoidassertGaugeGt(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 valuevoidassertGaugeLt(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 valuevoidassertGaugeLt(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 valuevoidAssert that a tag exists and has a given value.private StringbooleancheckCounterExists(String name, org.apache.hadoop.hbase.metrics.BaseSource source) Check if a dynamic counter exists.booleancheckGaugeExists(String name, org.apache.hadoop.hbase.metrics.BaseSource source) Check if a gauge exists.longgetCounter(String name, org.apache.hadoop.hbase.metrics.BaseSource source) Get the value of a counter.doublegetGaugeDouble(String name, org.apache.hadoop.hbase.metrics.BaseSource source) Get the value of a gauge as a double.longgetGaugeLong(String name, org.apache.hadoop.hbase.metrics.BaseSource source) Get the value of a gauge as a long.private voidgetMetrics(org.apache.hadoop.hbase.metrics.BaseSource source) voidinit()Init helper.private voidreset()toDebugString(org.apache.hadoop.hbase.metrics.BaseSource source) Generates a representation of all metrics exported by the givensource.
-
Field Details
-
tags
-
gauges
-
counters
-
-
Constructor Details
-
MetricsAssertHelperImpl
public MetricsAssertHelperImpl()
-
-
Method Details
-
init
Description copied from interface:MetricsAssertHelperInit helper. This method will make sure that the metrics system is set up for tests.- Specified by:
initin interfaceMetricsAssertHelper
-
assertTag
public void assertTag(String name, String expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a tag exists and has a given value.- Specified by:
assertTagin interfaceMetricsAssertHelper- Parameters:
name- The name of the tag.expected- The expected valuesource- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertGauge
public void assertGauge(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a gauge exists and that it's value is equal to the expected value.- Specified by:
assertGaugein interfaceMetricsAssertHelper- Parameters:
name- The name of the gaugeexpected- The expected value of the gauge.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertGaugeGt
public void assertGaugeGt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a gauge exists and it's value is greater than a given value- Specified by:
assertGaugeGtin interfaceMetricsAssertHelper- Parameters:
name- The name of the gaugeexpected- Value that the gauge is expected to be greater thansource- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertGaugeLt
public void assertGaugeLt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a gauge exists and it's value is less than a given value- Specified by:
assertGaugeLtin interfaceMetricsAssertHelper- Parameters:
name- The name of the gaugeexpected- Value that the gauge is expected to be less thansource- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertGauge
public void assertGauge(String name, double expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a gauge exists and that it's value is equal to the expected value.- Specified by:
assertGaugein interfaceMetricsAssertHelper- Parameters:
name- The name of the gaugeexpected- The expected value of the gauge.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertGaugeGt
public void assertGaugeGt(String name, double expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a gauge exists and it's value is greater than a given value- Specified by:
assertGaugeGtin interfaceMetricsAssertHelper- Parameters:
name- The name of the gaugeexpected- Value that the gauge is expected to be greater thansource- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertGaugeLt
public void assertGaugeLt(String name, double expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a gauge exists and it's value is less than a given value- Specified by:
assertGaugeLtin interfaceMetricsAssertHelper- Parameters:
name- The name of the gaugeexpected- Value that the gauge is expected to be less thansource- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertCounter
public void assertCounter(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a counter exists and that it's value is equal to the expected value.- Specified by:
assertCounterin interfaceMetricsAssertHelper- Parameters:
name- The name of the counter.expected- The expected valuesource- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertCounterGt
public void assertCounterGt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a counter exists and that it's value is greater than the given value.- Specified by:
assertCounterGtin interfaceMetricsAssertHelper- Parameters:
name- The name of the counter.expected- The value the counter is expected to be greater than.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
assertCounterLt
public void assertCounterLt(String name, long expected, org.apache.hadoop.hbase.metrics.BaseSource source) Description copied from interface:MetricsAssertHelperAssert that a counter exists and that it's value is less than the given value.- Specified by:
assertCounterLtin interfaceMetricsAssertHelper- Parameters:
name- The name of the counter.expected- The value the counter is expected to be less than.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.
-
getCounter
Description copied from interface:MetricsAssertHelperGet the value of a counter.- Specified by:
getCounterin interfaceMetricsAssertHelper- Parameters:
name- name of the counter.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.- Returns:
- long value of the counter.
-
checkCounterExists
Description copied from interface:MetricsAssertHelperCheck if a dynamic counter exists.- Specified by:
checkCounterExistsin interfaceMetricsAssertHelper- Parameters:
name- name of the counter.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.- Returns:
- boolean true if counter metric exists.
-
checkGaugeExists
Description copied from interface:MetricsAssertHelperCheck if a gauge exists.- Specified by:
checkGaugeExistsin interfaceMetricsAssertHelper- Parameters:
name- name of the gauge.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.- Returns:
- boolean true if gauge metric exists.
-
getGaugeDouble
Description copied from interface:MetricsAssertHelperGet the value of a gauge as a double.- Specified by:
getGaugeDoublein interfaceMetricsAssertHelper- Parameters:
name- name of the gauge.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.- Returns:
- double value of the gauge.
-
getGaugeLong
Description copied from interface:MetricsAssertHelperGet the value of a gauge as a long.- Specified by:
getGaugeLongin interfaceMetricsAssertHelper- Parameters:
name- name of the gauge.source- The BaseSourceBaseSourcethat will provide the tags, gauges, and counters.- Returns:
- long value of the gauge.
-
toDebugString
Description copied from interface:MetricsAssertHelperGenerates a representation of all metrics exported by the givensource.- Specified by:
toDebugStringin interfaceMetricsAssertHelper- Parameters:
source- TheBaseSourcethat will provide the metrics.- Returns:
- A representation of the metrics as a String.
-
reset
-
getMetrics
-
canonicalizeMetricName
-