The new probe will convert all node's LatestControls to Controls, so
the old app can consume them. Also, the new app will convert all
node's Controls to LatestControl, so it can consume the reports from
old probes.
This allows plugins to add controls to nodes that already have some
controls set by other plugin. Previously only the last plugin that
sets the controls in the node would have its controls visible. That
was because of NodeControls' Merge function that actually weren't
merging data from two inputs, but rather returning data that was newer
and discarding the older one.
This commit makes the LatestMap type a sort of a base class, that
should not be used directly. This also adds a generator for LatestMap
"concrete" types with a specific data type in the LatestEntry.
* Helps reduce garbage (MakeMetric() now takes a slice and there's a shorter version MakeSingletonMetric())
* Fixes bug computing Max (Min) in samples since using MakeMetric()
was causing a default Max/Min of zero.
* Simplifies code a bit
Also:
* Remove Gob encoder/decoder
* Stop using custom encoders/decoders for Timestamps (both ugorji and the Golang JSON codecs use nanosecond precision).
* Use idiomatic way to check for existence in metric.LastSample()
Merge() is always returning a copy, so there is no need to Copy()
struct fields first before calling Merge() on them.
This reduces GC pressure (#1010) and helps overall app performance
(#1457).
* Allocate all map entries of the intermadiate representation at once
* Use UnsafeMutableMap to improve performance of LatestMap construction
* Remove gob encoder/decoder
* Customer encoder for latest maps
- Cuts out intermediate type
- Should be backwards compatible with existing reports.
* Make it build cleanly
* Review feedback
Avoids creating O(n) garbage by using a slice with enough capacity to
hold the temporary head-portion of the list accumulated while walking
the list to insert element(s).