Closed jfernandez closed 11 hours ago
One more note: I don't expect this LogRecorder to work for every scheduler, even after we enable more custom formatting. I think it's fine to continue to print explicitly to meet personal preferences. The primary goal of introducing metrics-rs is to enable exporting of metrics to backends. The LogRecorder is a nice to have if the format works for you, or you are bootstrapping a new scheduler. It also a good example that others can follow to create customer exporters.
Thanks @arighi.
I'm sharing context from the Slack discussion on this topic: @htejun suggested an additional hook that gets all counters in a struct so that you can customize how to group them visually. I think this is a good idea and will implement it in the following PR.
This change adds the ability to customize the log recorder format for each metric type. There is a default format that is used if no custom
MetricFormatter
is provided. This is the same format that was used before this change.The
MetricFormatter
should be implemented by the user to customize the format of the log recorder. TheLogRecorderBuilder
now takes aMetricFormatter
as an optional parameter.Following changes will allow additional customization of the log recorder format, such as how many metrics are logged per line.