Skip to content

Use default format for metric values#300

Draft
vickenty wants to merge 1 commit intomasterfrom
vickenty/fpp
Draft

Use default format for metric values#300
vickenty wants to merge 1 commit intomasterfrom
vickenty/fpp

Conversation

@vickenty
Copy link
Contributor

Numeric metric values were formatted using specialized number format that truncated values to 6 fractional digits and did not use exponential format for larger numbers. While it slightly reduces number of transmitted bytes for fractional numbers close zero, it is less efficient for larger values.

A micro-benchmark also shows that not using NumberFormat is generally much faster. These numbers are from JDK 11, but the numbers are similar for JDK 8 and 25.

Benchmark                                               (value)   Mode  Cnt   Score   Error   Units
FullPrecisionBenchmark.format_default         3.141592653589793  thrpt   10   3.035 ± 0.182  ops/us
FullPrecisionBenchmark.format_default                    3.3E20  thrpt   10   3.465 ± 0.764  ops/us
FullPrecisionBenchmark.format_default                      42.0  thrpt   10   5.711 ± 1.908  ops/us
FullPrecisionBenchmark.format_default                     0.423  thrpt   10   4.977 ± 1.437  ops/us
FullPrecisionBenchmark.format_default                     243.5  thrpt   10   4.871 ± 0.232  ops/us
FullPrecisionBenchmark.format_full_precision  3.141592653589793  thrpt   10   5.888 ± 0.411  ops/us
FullPrecisionBenchmark.format_full_precision             3.3E20  thrpt   10  20.946 ± 0.681  ops/us
FullPrecisionBenchmark.format_full_precision               42.0  thrpt   10  33.849 ± 0.391  ops/us
FullPrecisionBenchmark.format_full_precision              0.423  thrpt   10  23.927 ± 0.685  ops/us
FullPrecisionBenchmark.format_full_precision              243.5  thrpt   10  16.318 ± 0.777  ops/us

This brings brings client behavior closer to that of other clients: Python uses built-in str() conversion which will use exponential format for large numbers, and Go, which, while doesn't use exponential format, does not truncate precision (on most metrics at least).

All agent versions and ADP/Saluki are able to handle this format. An option is added to restore legacy behavior in case this causes any compatibility issues.

Numeric metric values were formatted using specialized number format
that truncated values to 6 fractional digits and did not use
exponential format for larger numbers. While it slightly reduces
number of transmitted bytes for fractional numbers close zero, it is
less efficient for larger values.

A micro-benchmark also shows that not using NumberFormat is generally
much faster. These numbers are from JDK 11, but the numbers are
similar for JDK 8 and 25.

Benchmark                                               (value)   Mode  Cnt   Score   Error   Units
FullPrecisionBenchmark.format_default         3.141592653589793  thrpt   10   3.035 ± 0.182  ops/us
FullPrecisionBenchmark.format_default                    3.3E20  thrpt   10   3.465 ± 0.764  ops/us
FullPrecisionBenchmark.format_default                      42.0  thrpt   10   5.711 ± 1.908  ops/us
FullPrecisionBenchmark.format_default                     0.423  thrpt   10   4.977 ± 1.437  ops/us
FullPrecisionBenchmark.format_default                     243.5  thrpt   10   4.871 ± 0.232  ops/us
FullPrecisionBenchmark.format_full_precision  3.141592653589793  thrpt   10   5.888 ± 0.411  ops/us
FullPrecisionBenchmark.format_full_precision             3.3E20  thrpt   10  20.946 ± 0.681  ops/us
FullPrecisionBenchmark.format_full_precision               42.0  thrpt   10  33.849 ± 0.391  ops/us
FullPrecisionBenchmark.format_full_precision              0.423  thrpt   10  23.927 ± 0.685  ops/us
FullPrecisionBenchmark.format_full_precision              243.5  thrpt   10  16.318 ± 0.777  ops/us

This brings brings client behavior closer to that of other clients:
Python uses built-in str() conversion which will use exponential
format for large numbers, and Go, which, while doesn't use exponential
format, does not truncate precision (on most metrics at least).

All agent versions and ADP/Saluki are able to handle this format. An
option is added to restore legacy behavior in case this causes any
compatibility issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant