K6.io result are not pushed to NR in windows env

Hi
I am try to integrate K6 with new relic . When i tried in mac machine results are pushed to NR. But when i tried run from windows machines results are not pushed to NR .
When i tried below command its giving result

gzip -c environment.json | curl --data-binary @- -X POST
-H “Content-Type: application/json”
-H "X-Insert-Key: ****"
-H “Content-Encoding: gzip”
https://insights-collector.newrelic.com/v1/accounts/
/events

Results
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 61 100 2 100 59 5 161 --:–:-- --:–:-- --:–:-- 167{}

Command i tired
docker run
-d --restart unless-stopped
–name newrelic-statsd
-h $(hostname)
-e NR_ACCOUNT_ID=*****
-e NR_API_KEY="*******"
-p 8125:8125/udp
newrelic/nri-statsd:latest

How can i debug this issue

Note : I have verified NR process is running status
$ docker ps -a | grep new
fca3caec74a2 newrelic/nri-statsd:latest “/nri-statsd.sh” 18 minutes ago Up 18 minutes 0.0.0.0:8125->8125/udp newrelic-statsd

Hi, welcome to the forum :slight_smile:

Are you getting any errors when running k6 and submitting to NR? Try running the script in verbose mode with k6 run -v and see if you get any errors such as “Error while sending metric”.

A good test to confirm whether this is a general network issue and not related to k6 would be to check if you can send UDP packets to the container. On Linux I would use netcat and the command nc -vzuw1 localhost 8125. You can try the same with the Windows port found here.

This should output something like:

Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Connected to ::1:8125.
Ncat: UDP packet sent successfully
Ncat: 1 bytes sent, 0 bytes received in 2.02 seconds.

If it fails it would mean it’s some Docker or Windows related network issue, and that’s a bit more problematic to troubleshoot. :-/

Hi Imiric ,

Thanks for your suggestions
k6 run -v didnt show any error

when i tried netcat …it show message as
Service scan Timing: About 54.55% done; ETC: 10:50 (0:01:22 remaining)

Completed Service scan at 10:49, 156.04s elapsed (22 services on 1 host)
Initiating OS detection (try #1) against localhost (127.0.0.1)
Failed to resolve “8125”.

Failed to resolve “8125”

You’re actually using nmap there, instead of netcat. That page is not very clear, but you can download ncat for Windows here.

You can do the same check with nmap though, I believe the command should be nmap -sU -p 8125 localhost.

k6 run -v didnt show any error

If you didn’t see any errors, then you should’ve seen Pushing metrics to server and the metrics reaching the container. I don’t have a New Relic account to test with, but there should be some activity in the container logs as well. Try reading what it outputs to stdout with docker logs newrelic-statsd or see if it maintains an internal log file (docker exec -it newrelic-statsd sh).

Thanks for suggestion

ncat command shows connection
C:\Users\vino_joy>ncat -v -u -l localhost 8125
Ncat: Version 7.91 ( https://nmap.org/ncat )
Ncat: Listening on 127.0.0.1:8125
Ncat: Connection from 127.0.0.1.
k6.vus:1.000000|g
k6.vus_max:1.000000|g
k6.http_reqs:1|c
k6.http_req_duration:1419.998700|ms
k6.http_req_blocked:383.962100|ms
k6.http_req_connecting:0.998600|ms
k6.http_req_tls_handshaking:236.998800|ms
k6.http_req_sending:0.000000|ms
k6.http_req_waiting:1419.998700|ms
k6.http_req_receiving:0.000000|ms
k6.check.status is 200.pass:1|c
k6.group_duration:1805.997500|ms
k6.groupDuration:1806.000000|msk6.vus:1.000000|g
k6.vus_max:1.000000|g
k6.http_reqs:1|c

When i tried docker logs newrelic-statsd

time=“2021-03-01T17:23:31Z” level=warning msg="[newrelic] failed to send, sleeping for 569.576317ms: received bad status code 403"
time=“2021-03-01T17:23:31Z” level=info msg="[newrelic] failed request" body="[123 125]" status=403
time=“2021-03-01T17:23:31Z” level=warning msg="[newrelic] failed to send, sleeping for 346.74809ms: received bad status code 403"
time=“2021-03-01T17:23:31Z” level=info msg="[newrelic] failed request" body="[123 125]" status=403
time=“2021-03-01T17:23:31Z” level=warning msg="[newrelic] failed to send, sleeping for 426.4629ms: received bad status code 403"
time=“2021-03-01T17:23:31Z” level=info msg="[newrelic] failed request" body="[123 125]" status=403
time=“2021-03-01T17:23:31Z” level=warning msg="[newrelic] failed to send, sleeping for 517.997146ms: received bad status code 403"
time=“2021-03-01T17:23:31Z” level=info msg="[newrelic] failed request" body="[123 125]" status=403
time=“2021-03-01T17:23:31Z” level=warning msg="[newrelic] failed to send, sleeping for 583.722981ms: received bad status code 403"
time=“2021-03-01T17:23:31Z” level=info msg="[newrelic] failed request" body="[123 125]" status=403
time="2021

[newrelic] failed to send, sleeping for 569.576317ms: received bad status code 403"

Ah, well there’s your problem. :slight_smile:

So you confirmed that k6 can reach and submit metrics to the NR container, but it seems that the NR container is not able to pass metrics on to the NR server. Status code 403 is an authorization error, so make sure your account ID and API key are correct/valid.

I’m not sure why it would work on Mac but not on Windows, though. Try running env inside the container to ensure the NR_ACCOUNT_ID and NR_API_KEY are correctly set in the environment. It might be a quoting issue, as cmd.exe treats single and double quotes differently than Unix shells, so confirm that the environment variables are correct.

As this is not a k6 issue, I’d suggest you contact NR support if the issue persists. Good luck!

Thanks imiric,

Issue was about key i used … when i generated Insert Keys from NR Insight , data started to push.
Thanks for your suggestions