Skip to content

mtypes divide by zero crash if input has no summary or histogram metrics #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ringerc opened this issue Apr 4, 2025 · 1 comment · May be fixed by #137
Open

mtypes divide by zero crash if input has no summary or histogram metrics #136

ringerc opened this issue Apr 4, 2025 · 1 comment · May be fixed by #137

Comments

@ringerc
Copy link

ringerc commented Apr 4, 2025

The mtypes utility crashes with a 0 divide error if the input lacks summary or histogram metrics and the -avalanche-flags-for-adjusted-series flag is passed, e.g.

$ ./mtypes < /dev/null -avalanche-flags-for-adjusted-series 10

./mtypes < /dev/null -avalanche-flags-for-adjusted-series 10
Metric Type    Metric Families    Series (adjusted)    Series (adjusted) %        Average Buckets/Objectives
---            ---                ---                  ---                        ---
*              0                  0 (0)                100.000000 (100.000000)    -

Avalanche flags for the similar distribution to get to the adjusted series goal of: 10
panic: runtime error: integer divide by zero

goroutine 1 [running]:
main.computeAvalancheFlags(0x8a55a0?, {0x0, 0x0, 0x0, 0x0, 0x0}, 0xc0001239b0)
    [...]/avalanche/cmd/mtypes/main.go:127 +0xcbd
main.main()
    [...]/avalanche/cmd/mtypes/main.go:81 +0x5c5

This is true even if valid metrics are passed, so long as the metric set omits summary and/or histogram metrics.

@ringerc
Copy link
Author

ringerc commented Apr 4, 2025

I've raised #137 to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant