-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve JSON parser and add labels parser hints. (#3080)
* Improve JSON parser and add labels parser hints. This is a rework of the json parser, that now uses iteration over reflection allowing to avoid allocations. I've also implemented a way to guess and hints what labels needs to be parsed when doing metric queries, this means we can extract only the few labels required from the log line. benchcmp ``` ❯ benchcmp before.txt after.txt5 benchmark old ns/op new ns/op delta Benchmark_Parser/json/no_labels_hints-16 9889 3281 -66.82% Benchmark_Parser/logfmt/no_labels_hints-16 1624 1671 +2.89% Benchmark_Parser/logfmt/labels_hints-16 1601 790 -50.66% benchmark old allocs new allocs delta Benchmark_Parser/json/no_labels_hints-16 139 56 -59.71% Benchmark_Parser/logfmt/no_labels_hints-16 31 31 +0.00% Benchmark_Parser/logfmt/labels_hints-16 31 5 -83.87% benchmark old bytes new bytes delta Benchmark_Parser/json/no_labels_hints-16 3671 912 -75.16% Benchmark_Parser/logfmt/no_labels_hints-16 464 464 +0.00% Benchmark_Parser/logfmt/labels_hints-16 464 144 -68.97% ``` I've experienced a 2x to 4x improvement in my cluster. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * typos. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com> * Review feedback. Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
- Loading branch information
1 parent
5898755
commit 7682f13
Showing
12 changed files
with
465 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.