Closed alex-davidson closed 7 years ago
I think I've found what I was looking for in the form of AdvancedMetricsContext#AttachContext. It means implementing an entire MetricsContext, but mine's read-only and doesn't need to support the methods which add Counters, etc.
I've been trying to figure out how to hook into the data provider to do this, but can't quite see where to make it fit, so...
Use case: report on available disk space using WMI queries. Entire Metrics set is dumped to JSON periodically. Problem: Each disk needs its own gauge, but the disks attached to the system may change over time. If a disk is removed, its gauge should be removed (absence of the metric vs. zero value is a significant difference)
What's the recommended way of approaching this with the Metrics.NET public API? Or should I look at building support for WMI queries and transient metrics directly against Metrics.NET's internals and submit a pull request?