divan / expvarmon

TermUI based monitor for Go apps using expvars (/debug/vars). Quickest way to monitor your Go app(s).
MIT License
2.02k stars 101 forks source link

Breaks if the map key contains "\x" string #19

Open arsham opened 8 years ago

arsham commented 8 years ago

Hi,

Given the following snippet:

package main

import (
    "expvar"
    "net/http"
)

func main() {
    m := expvar.NewMap("test")
    m.Add("\x00", 1)
    http.ListenAndServe(":1234", nil)
}

Expvarmon stops showing results all together. You can add a sleep time before the add and observe it only happens when the string is added.

marklr commented 7 years ago

This looks like a bug in expvar itself, as it doesn't use a JSON encoder but rather just spits out key-value strings with the %q format specifier... see https://github.com/golang/go/blob/master/src/expvar/expvar.go#L331