EDIT: Now that Fluent exists, a direct implementation of middleware may be possible.
Things middleware should be able to do:
Renaming (prefix/suffix metric names and labels)
Filtering (isolate metrics by property matching)
Ordering (reorder metrics)
Two kinds of middleware:
MetricMiddleware. These operate on Metric objects. Renaming and Filtering may be written at this scope. This design enables intelligent chaining to execute in O(n) time.
CollectionMiddleware. These operate on MetricCollection objects. Ordering may be written at this scope.
EDIT: Now that Fluent exists, a direct implementation of middleware may be possible.
Things middleware should be able to do:
Two kinds of middleware: