I recently came across in-memory exporters in OpenTelemetry (https://opentelemetry.io/docs/specs/otel/metrics/sdk_exporters/in-memory/) which is recommended for use in unit tests.
I was looking for an example of using this in Java.
I found this codebase (https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/testing/src/main/java/io/opentelemetry/sdk/testing/exporter/InMemoryMetricExporter.java )
and in the comment section, it talks about a InMemoryMetricExporterExample class to use InMemoryMetricExporter. But the code is not in sync with latest API of OpenTelemetry.
For example IntervalMetricReader class no longer exists. Or OpenTelemetrySdk.getMeterProvider() doesn’t exist as static method . and few other issues …
Has anyone successfully used InMemoryMetricExporter or InMemoryMetricReader and can provide a working example to capture traces or metrics.