grafana / metrictank

metrics2.0 based, multi-tenant timeseries store for Graphite and friends.
GNU Affero General Public License v3.0
623 stars 104 forks source link

panic when combining constantLine with asPercent #1781

Closed Dieterbe closed 3 years ago

Dieterbe commented 4 years ago

A query like this:

asPercent(foo,constantLine(120))

results in a 500 response, and this log:

metrictank_1    | [Macaron] PANIC: runtime error: integer divide by zero
metrictank_1    | /usr/lib/go/src/runtime/panic.go:191 (0x432bda)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/util/util.go:30 (0x8ea88b)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/expr/normalize.go:41 (0xba5981)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/expr/func_aspercent.go:215 (0xb89556)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/expr/func_aspercent.go:90 (0xb8692b)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/expr/plan.go:309 (0xbaafbf)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/api/graphite.go:834 (0xc1b970)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/api/graphite.go:270 (0xc15886)
metrictank_1    | /usr/lib/go/src/reflect/value.go:460 (0x4b684a)
metrictank_1    | /usr/lib/go/src/reflect/value.go:321 (0x4b5d53)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:177 (0xab160b)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:137 (0xab0fe9)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:121 (0xacbe48)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:112 (0xc037d1)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/raintank/gziper/gzip.go:100 (0xc037c4)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:79 (0xacbcf0)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:157 (0xab1337)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:135 (0xab10d8)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:121 (0xacbe48)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:112 (0xb30d80)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/api/middleware/logger.go:45 (0xb30d69)
metrictank_1    | /usr/lib/go/src/reflect/value.go:460 (0x4b684a)
metrictank_1    | /usr/lib/go/src/reflect/value.go:321 (0x4b5d53)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:177 (0xab160b)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:137 (0xab0fe9)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:121 (0xacbe48)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:112 (0xb3260b)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/api/middleware/tracer.go:70 (0xb325f6)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:79 (0xacbcf0)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:157 (0xab1337)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:135 (0xab10d8)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:121 (0xacbe48)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:112 (0xb31ced)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/api/middleware/stats.go:76 (0xb31cd8)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:79 (0xacbcf0)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:157 (0xab1337)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:135 (0xab10d8)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:121 (0xacbe48)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:112 (0xadc955)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/recovery.go:161 (0xadc948)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/logger.go:40 (0xacf8b3)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:157 (0xab1337)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/github.com/go-macaron/inject/inject.go:135 (0xab10d8)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/context.go:121 (0xacbe48)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/router.go:187 (0xaddb66)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/router.go:294 (0xad7fcd)
metrictank_1    | /home/dieter/go/src/github.com/grafana/metrictank/vendor/gopkg.in/macaron.v1/macaron.go:220 (0xad0bea)
metrictank_1    | /usr/lib/go/src/net/http/server.go:2807 (0x7420e2)
metrictank_1    | /usr/lib/go/src/net/http/server.go:1895 (0x73db5b)
metrictank_1    | /usr/lib/go/src/runtime/asm_amd64.s:1373 (0x467100)
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

fkaleo commented 4 years ago

please reopen

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.