DataDog / php-datadogstatsd

A PHP client for DogStatsd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to set gauge to 0

ZymoticB opened this issue · comments

Oct  1 14:10:34 ip-172-30-102-247 agent[14320]: 2020-10-01 10:10:34 EDT | CORE | ERROR | (pkg/dogstatsd/server.go:421 in errLog) | Dogstatsd: error parsing metric message '"name:|g|#tag:tag-value"': invalid name and value: "name:"

When setting a gauge to 0, the value is completely elided. This was caused by #100. There was a code review comment to replace some string manipulation with

return rtrim(rtrim(number_format($value, 5, '.', ''), "0"), ".");

is was instead replaced with

return rtrim(trim(number_format($value, 5, '.', ''), "0"), ".");

which transforms a zero to an empty string

Same problem for me.