k6
k6 copied to clipboard
K6_STATSD_NAMESPACE env var is broken for string.empty
Brief summary
env var K6_STATSD_NAMESPACE = "" does not override - treated as NULL?
k6 version
37
OS
win2019
Docker version and image (if applicable)
No response
Steps to reproduce the problem
set "K6_STATSD_NAMESPACE=" && k6 --out statsd run xxxx.js
Expected behaviour
tag prefix = ""
Actual behaviour
tag prefix = "k6_"
Hi @kkriegkxs, thank you for reporting this :bow:
While at first glance it seemed like the fix was going to be to just fix this line https://github.com/grafana/k6/blob/582a2a7ce7f39ab373cedfb5d5a34245d0a07375/output/statsd/output.go#L130-L132 It turns out that (unfortunately for us in this case) null.String#UnmarshalText specifically treats empty strings as if they aren't set.
This unfortunately means that we will need to fork it, hack around it or wait for #883 and potentially moving to croconf to fix this.
Am I correct in assuming this is more of an inconvenience and a surprise for you than actually a dealbreaker or something that you will need to work around?
hi @mstoykov! THX for a quick response
A quick hack of a reserved value "blank" or something to that tune. I think this hack would be an acceptable solution for more than one config esp if implemented globally. #883 has been around for a loooooong time and is unlikely to be resolved any time soon (I guess).
It does force me into using something I wasn't planning but it's pretty static so it is not a deal breaker or I would have forked it :)