* Linter fixes - revive:unused-parameter and unparam
* Linter fixes - revive:unused-parameter and unparam
* Linter fixes - revive:unused-parameter and unparam
* "nolint"'s removed
* Fixes for "varcheck" and "unused" added.
* Fixes for "varcheck" and "unused" added.
* Fixes for "varcheck" and "unused" added.
* Fixes for "varcheck" and "unused" added.
* Fixes for "varcheck" and "unused" added.
* Fixes for "varcheck" and "unused" added.
* Fixes for "varcheck" and "unused" added.
Co-authored-by: Pawel Zak <Pawel Zak>
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
There is a small chance the newTrackingID() function in tracking.go
will return the same id to multiple simultaneous callers.
The function must return the value returned by atomic.AddUint64()
to be safe.
Before this change Fields() method on a metric parsed from a line with
unescaped quotes could panic. This change makes such line unparseable.
Fixes#3326
It is not possible to encode a measurement, tag, or field whose last
character is a backslash due to it being an unescapable character.
Because the tight coupling between line protocol and the internal metric
model, prevent metrics like this from being created.
Measurements with a trailing slash are not allowed and the point will be
dropped. Tags and fields with a trailing a slash will be dropped from
the point.
Line protocol does not require or allow escaping of backslash, the only
requirement for a byte to be escaped is if it is an escapable char and
preceeded immediately by a slash.