Package org.eclipse.microprofile.fault.tolerance.tck.telemetryMetrics.util

# Class TelemetryHistogramMetric

java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.telemetryMetrics.util.TelemetryHistogramMetric

public class TelemetryHistogramMetric extends Object
Allows tests to get the value of a Histogram, it does not support comparing with a baseline

Most tests should use `TelemetryMetricGetter` to create instances of this class.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final List<Double>`
`EXPECTED_BOUNDARIES`

## Constructor Summary

Constructors
Constructor
Description
`TelemetryHistogramMetric(TelemetryMetricID metricId)`

## Method Summary

Modifier and Type
Method
Description
`void`
`assertBoundaries()`
`void`
`assertBucketCounts(long... expectedResultsMillis)`
Assert that the bucket counts of the histogram are consistent with the expected set of recorded results.
`static int`
`findBucket(List<Double> boundaries, double value)`
Given a list of bucket boundaries, find the bucket that the given value falls into
`Optional<Long>`
`getHistogramCount()`
`Optional<io.opentelemetry.sdk.metrics.data.HistogramPointData>`
`getHistogramPoint()`
`boolean`
`isPresent()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### EXPECTED_BOUNDARIES

public static final List<Double> EXPECTED_BOUNDARIES

## Constructor Details

### TelemetryHistogramMetric

public TelemetryHistogramMetric(TelemetryMetricID metricId)

## Method Details

### getHistogramPoint

public Optional<io.opentelemetry.sdk.metrics.data.HistogramPointData> getHistogramPoint()

### getHistogramCount

public Optional<Long> getHistogramCount()

### isPresent

public boolean isPresent()

### assertBoundaries

public void assertBoundaries()

### assertBucketCounts

public void assertBucketCounts(long... expectedResultsMillis)
Assert that the bucket counts of the histogram are consistent with the expected set of recorded results.

The results are adjusted using `TCKConfig.getTimeoutInMillis(long)`.

A 20% deviation from the expected time is permitted and the upper limit is extended to 200ms. E.g.:

- An expected time of 1000ms will allow a time recorded between 800ms and 1200ms
- An expected time of 0ms will allow a time recorded between 0ms and 200ms

Parameters:
  `expectedResultsMillis` - the list of values which the histogram is expected to have recorded

### findBucket

public static int findBucket(List<Double> boundaries, double value)
Given a list of bucket boundaries, find the bucket that the given value falls into

Parameters:
  `boundaries` - the list of boundaries
  `value` - the value to test
Returns:
  the bucket index that should contain `value`