The testutil package is really more meant for end-to-end testing exporters and such, where you want to mirror an external metric source and therefore know exactly the input and expected output.
If you want to test if your code was instrumented properly, I would rather go with a mock registry or mock metrics. (But that's tedious at the moment for various reasons. v2 of the instrumentation client will make that easier.) Having said that, if you only want to test for presence of a metric and are not interested in the value, the new filtering in `CollectAndCount` and `GatherAndCount` comes in handy. (It is not released yet, but I'll cut a release soon.) Check it out here: https://github.com/prometheus/client_golang/blob/master/prometheus/testutil/testutil.go#L134-L138 You would filter for the metric name whose presence you want to test for. -- Björn Rabenstein [PGP-ID] 0x851C3DA17D748D03 [email] [email protected] -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/20200529125035.GQ2326%40jahnn.

