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

Custom vars show as "N/A" #27

Closed blainsmith closed 7 years ago

blainsmith commented 7 years ago

I've added custom vars to the JSON and they appear when viewing them in a browser.

{
"cmdine": {...},
"latency.p50": 125248.5,
"latency.p90": 614798.4545454546,
"latency.p95": 1019194.25,
"latency.p99": 2460674,
"memstats": {...}
}

When running expvarmon -ports="8181" -vars="duration:latency.p50,duration:latency.p90,duration:latency.p95,duration:latency.p99" those values all appear as N/A in the UI.

Am I doing something weird when running the command?

divan commented 7 years ago

Hi @blainsmith,

I suspect the dot in the latency.p90 is a problem. expvarmon uses dot to refer for the fields like memstat.Alloc.

Do you have control over the expvar variables (latency.*) naming? Can you change . to, say, _ or something else?

blainsmith commented 7 years ago

Unfortunately no. I can only set the "latency" namespace. Here is the package I'm using it with if it helps. https://github.com/go-kit/kit/blob/master/metrics/expvar/expvar.go#L75-L78

I'd be happy to submit a PR to kit to change it so I can file an issue over there as well for the use case.

divan commented 7 years ago

@blainsmith I just realized that support for variables with dot character has been added in this PR https://github.com/divan/expvarmon/pull/14. Can you try to escape the dot character when specifying -vars? Like this:

-vars "duration:latency\.p90"

Should work.

blainsmith commented 7 years ago

This does work thank you!