Replies: 1 comment
-
There are assertions available in the metricdatatest package. The idea is to use this with a manual reader in your tests: rdr := sdkmetric.NewManualReader()
mp := sdkmetric.NewMeterProvider(sdkmetric.WithReader(rdr)) Pass the meter provider so it's used within your tested code. var data metricdata.ResourceMetrics
err := rdr.Collect(context.Background(), &data)
// Check for no error, and that the provided data is as expected. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There used to be a
metrictest
package that made it possible to test metrics collection in testing code.I see it has been removed, but are there plans to bring it back?
If not, is there a recommendation on testing a
metric.MeterProvider
. Is there something in the Go otel package that could satisfy that interface?Beta Was this translation helpful? Give feedback.
All reactions