ScheduledReporter#report signature

12 views
Skip to first unread message

Aviem Zur

unread,
Nov 13, 2019, 1:23:25 PM11/13/19
to metrics-user
Hi,


    public abstract void report(SortedMap<MetricName, Gauge> gauges,
                                SortedMap<MetricName, Counter> counters,
                                SortedMap<MetricName, Histogram> histograms,
                                SortedMap<MetricName, Meter> meters,
                                SortedMap<MetricName, Timer> timers);

This signature only supports these 5 metric types, while a user could create new custom metrics that implement the Metric interface.
Would it make sense for this method to receive for example something like Map<Class<? extends Metric>, SortedMap<MetricName, Metric>> where the key would be the type of metric, for example Gauge.class, Counter.class, MyCustomMetricType.class.

This way implementations of ScheduledReporter can keep reporting the existing types as they do today, but also allow users to create reporters which handle their custom metric types and opens the door for existing ScheduledReporter implementations to handle higher level abstractions of Metrics (For example if something implements Counting but is not Counter this could add flexibility for users to create custom metrics but still implement an existing interface that ScheduledReporter implementations can support.
Reply all
Reply to author
Forward
0 new messages