telegraf/plugins/aggregators
Patrick Hemmer 910b726876
Optimize SeriesGrouper & aggregators.merge (#8391)
The previous implementation of SeriesGrouper required breaking a metric object apart into its constituents, converting tags and keys into unoptimized maps, only to have it put them back together into another metric object. This resulted in a significant performance overhead. This overhead was further compounded when the number of fields was large.

This change adds a new AddMetric method to SeriesGrouper which preserves the metric object and removes the back-and-forth conversion.

Additionlly the method used for calculating the metric's hash was switched to use maphash, which is optimized for this case.

----

Benchmarks

Before:

    BenchmarkMergeOne-16          106012	     11790 ns/op
    BenchmarkMergeTwo-16           48529	     24819 ns/op
    BenchmarkGroupID-16           780018	      1608 ns/op

After:

    BenchmarkMergeOne-16          907093	      1173 ns/op
    BenchmarkMergeTwo-16          508321	      2168 ns/op
    BenchmarkGroupID-16         11217788	      99.4 ns/op
2021-01-07 11:39:12 -05:00
..
all Add merge aggregator (#6410) 2019-09-26 17:09:44 -07:00
basicstats Add rate and interval to the basicstats aggregator plugin (#8428) 2020-11-20 15:53:51 -05:00
final Add final aggregator (#5820) 2019-05-15 14:46:28 -07:00
histogram Add non-cumulative histogram (#7071) 2020-03-02 10:59:19 -08:00
merge Optimize SeriesGrouper & aggregators.merge (#8391) 2021-01-07 11:39:12 -05:00
minmax Fix minmax and basicstats aggregators to use uint64 (#4294) 2018-06-29 19:07:08 -07:00
valuecounter Allow floats in valuecounter aggregator (#5168) 2018-12-26 19:39:34 -08:00
registry.go Support Processor & Aggregator Plugins 2016-10-12 14:50:19 +01:00