divan / expvarmon

TermUI based monitor for Go apps using expvars (/debug/vars). Quickest way to monitor your Go app(s).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for custom headers

marklr opened this issue · comments

We have an application that requires a specific HTTP header to be passed to expose certain counters via expvar.

I've hacked together a rudimentary solution at https://github.com/marklr/expvarmon -- if the code is up to @divan's standards, I'd be glad to submit a PR pending any cleanups/modifications.

Hey @marklr! Thanks for bringing the solution. The code is definitely ok, but I rarely seen this approach (custom header). If it was common practice, there no doubt would be sense to include your contribution into the master. But for now it seems like your case is pretty unique, so the best option for you would be to use your fork.
If similar requests will arise in the future, I definitely consider to include your changes!

Hey @divan, yeah, it's a little esoteric. Just wanted to confirm that my code doesn't smell bad, haven't written much Go (yet).

Thanks!

@marklr ha, no, it's nice. I've even learnt something new from your code :) (flag.Value interface and implementing own flag types - never did this before)

The only feedback I can provide is on the ParseHeaders() function - would be nice to have tests for it. It's not very obvious how the parsing is going from the first glance, and having tests with examples would really help future code readers (even yourself in the future) to understand how this function is expected to work.

I agree completely, @divan, just wanted to get it to work first :)

I'll definitely add some tests.