Package org.eclipse.microprofile.telemetry.metrics.tck.application.exporter

# Class InMemoryMetricExporter

java.lang.Object
org.eclipse.microprofile.telemetry.metrics.tck.application.exporter.InMemoryMetricExporter

All Implemented Interfaces:
  `io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector`, `io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector`, `io.opentelemetry.sdk.metrics.export.MetricExporter`, `Closeable`, `AutoCloseable`

@ApplicationScoped public class InMemoryMetricExporter extends Object implements io.opentelemetry.sdk.metrics.export.MetricExporter

## Constructor Summary

Constructors
Constructor
Description
`InMemoryMetricExporter()`

## Method Summary

Modifier and Type
Method
Description
`void`
`assertMetricNameFound(String metricName)`
`io.opentelemetry.sdk.common.CompletableResultCode`
`export(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metrics)`
Exports the collection of `Metric`s into the inmemory queue.
`io.opentelemetry.sdk.common.CompletableResultCode`
`flush()`
The InMemory exporter does not batch metrics, so this method will immediately return with success.
`io.opentelemetry.sdk.metrics.data.AggregationTemporality`
`getAggregationTemporality(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)`
`List<io.opentelemetry.sdk.metrics.data.MetricData>`
`getFinishedMetricItems()`
Returns a `List` of the finished `Metric`s, represented by `MetricData`.
`List<io.opentelemetry.sdk.metrics.data.MetricData>`
`getMetricData(String metricName)`
`void`
`reset()`
Clears the internal `List` of finished `Metric`s.
`io.opentelemetry.sdk.common.CompletableResultCode`
`shutdown()`
Clears the internal `List` of finished `Metric`s.

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

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

### Methods inherited from interface io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector

`with`

### Methods inherited from interface io.opentelemetry.sdk.metrics.export.MetricExporter

`close, getDefaultAggregation, getMemoryMode`

## Constructor Details

### InMemoryMetricExporter

public InMemoryMetricExporter()

## Method Details

### getFinishedMetricItems

public List<io.opentelemetry.sdk.metrics.data.MetricData> getFinishedMetricItems()
Returns a `List` of the finished `Metric`s, represented by `MetricData`.

Returns:
  a `List` of the finished `Metric`s.

### getMetricData

public List<io.opentelemetry.sdk.metrics.data.MetricData> getMetricData(String metricName)

### assertMetricNameFound

public void assertMetricNameFound(String metricName)

### reset

public void reset()
Clears the internal `List` of finished `Metric`s.

Does not reset the state of this exporter if already shutdown.

### getAggregationTemporality

public io.opentelemetry.sdk.metrics.data.AggregationTemporality getAggregationTemporality(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)

Specified by:
  `getAggregationTemporality` in interface `io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector`

### export

public io.opentelemetry.sdk.common.CompletableResultCode export(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metrics)
Exports the collection of `Metric`s into the inmemory queue.

If this is called after `shutdown`, this will return `ResultCode.FAILURE`.

Specified by:
  `export` in interface `io.opentelemetry.sdk.metrics.export.MetricExporter`

### flush

public io.opentelemetry.sdk.common.CompletableResultCode flush()
The InMemory exporter does not batch metrics, so this method will immediately return with success.

Specified by:
  `flush` in interface `io.opentelemetry.sdk.metrics.export.MetricExporter`
Returns:
  always Success

### shutdown

public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
Clears the internal `List` of finished `Metric`s.

Any subsequent call to export() function on this MetricExporter, will return `CompletableResultCode.ofFailure()`

Specified by:
  `shutdown` in interface `io.opentelemetry.sdk.metrics.export.MetricExporter`