Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K6_STATSD_NAMESPACE env var is broken for string.empty #2549

Closed
kkriegkxs opened this issue May 30, 2022 · 4 comments
Closed

K6_STATSD_NAMESPACE env var is broken for string.empty #2549

kkriegkxs opened this issue May 30, 2022 · 4 comments
Labels
bug metrics-output Issues related to the metrics output (a.k.a. just output) statsd Something related to the statsd

Comments

@kkriegkxs
Copy link

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_"

@kkriegkxs kkriegkxs added the bug label May 30, 2022
@mstoykov
Copy link
Contributor

mstoykov commented Jun 2, 2022

Hi @kkriegkxs, thank you for reporting this 🙇

While at first glance it seemed like the fix was going to be to just fix this line

k6/output/statsd/output.go

Lines 130 to 132 in 582a2a7

if namespace := o.config.Namespace.String; namespace != "" {
o.client.Namespace = namespace
}

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?

@kkriegkxs
Copy link
Author

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 :)

@olegbespalov olegbespalov added metrics-output Issues related to the metrics output (a.k.a. just output) statsd Something related to the statsd labels Jul 12, 2024
@LeonAdato
Copy link

Per @olegbespalov and @javaducky, this issue should probably be part of the StatsD project. Feel free to transfer it here:

https://github.com/LeonAdato/xk6-output-statsd

@olegbespalov
Copy link
Contributor

Closing in favor of LeonAdato/xk6-output-statsd#26

@olegbespalov olegbespalov closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2024
@olegbespalov olegbespalov removed their assignment Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug metrics-output Issues related to the metrics output (a.k.a. just output) statsd Something related to the statsd
Projects
None yet
Development

No branches or pull requests

4 participants