This morning, our application quietly stopped uploading statistics to DataDog.
We're using the metrics
crate, which requires users to call this setup function. The docs say:
Any metrics recorded before the call to
set_recorder
occurs will be completely ignored.
The function sets a global variable. There's shared mutable state inside the crate.
So if you accidentally get two versions of the metrics
crate built into your application, like we did, whichever one receives the set_recorder
call will get metrics, and the other will silently ignore all metrics!
I'm thinking about ways to help others avoid this. Is there anything the metrics
authors could do to make Cargo warn at build time if this happens, maybe something like the links
field, but for crates instead of native libraries? Or something we could do as users of metrics
?