Newrelic statsd integration in circle ci

I am struggling to send k6 data to new relic via new relic statsd integration when running from circle ci. Same code works fine when run in local.


here is the circle ci config.yml code

docker pull loadimpact/k6:latest

docker run \
  -d --restart unless-stopped \
  --name newrelic-statsd \
  -h bridge \
  -e NR_ACCOUNT_ID=******** \
  -e NR_API_KEY="****************" \
  -p 8125:8125/udp \

docker run -i -v $HOME/*********/lib/shim:/ci/ loadimpact/k6:latest run --out statsd /ci/script.js

latest: Pulling from loadimpact/k6

b1bc80d0: Pulling fs layer 
b9c5a8d0: Pulling fs layer 
Digest: sha256:2718b83ca8d60197b883d9c81d3d54b0e9c4ac9f9f366573048b7e2cadbc0b7e
Status: Downloaded newer image for loadimpact/k6:latest
Unable to find image 'newrelic/nri-statsd:latest' locally
latest: Pulling from newrelic/nri-statsd

9388f04a: Pulling fs layer 
025ca458: Pulling fs layer 
3749d02f: Pulling fs layer 
6418287b: Pulling fs layer 
Digest: sha256:b0e3272d94d83f2f0a5898d686cbe4a2047a59269fafd44bcc021e559b4c6cc9
Status: Downloaded newer image for newrelic/nri-statsd:latest

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: /ci/script.js
     output: statsd (localhost:8125)

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

running (00m00.4s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [ 100% ] 1 VUs  00m00.4s/10m0s  1/1 iters, 1 per VU

     data_received..............: 3.8 kB  8.7 kB/s
     data_sent..................: 1.7 kB  4.0 kB/s
     http_req_blocked...........: avg=47.33ms  min=47.33ms  med=47.33ms  max=47.33ms  p(90)=47.33ms  p(95)=47.33ms 
     http_req_connecting........: avg=1.41ms   min=1.41ms   med=1.41ms   max=1.41ms   p(90)=1.41ms   p(95)=1.41ms  
     http_req_duration..........: avg=332.89ms min=332.89ms med=332.89ms max=332.89ms p(90)=332.89ms p(95)=332.89ms
     http_req_failed............: 100.00% ✓ 1        ✗ 0
     http_req_receiving.........: avg=93.79µs  min=93.79µs  med=93.79µs  max=93.79µs  p(90)=93.79µs  p(95)=93.79µs 
     http_req_sending...........: avg=197.77µs min=197.77µs med=197.77µs max=197.77µs p(90)=197.77µs p(95)=197.77µs
     http_req_tls_handshaking...: avg=37.52ms  min=37.52ms  med=37.52ms  max=37.52ms  p(90)=37.52ms  p(95)=37.52ms 
     http_req_waiting...........: avg=332.6ms  min=332.6ms  med=332.6ms  max=332.6ms  p(90)=332.6ms  p(95)=332.6ms 
     http_reqs..................: 1       2.315569/s
     iteration_duration.........: avg=380.63ms min=380.63ms med=380.63ms max=380.63ms p(90)=380.63ms p(95)=380.63ms
     iterations.................: 1       2.315569/s

Hi @pradeep

Welcome to the community forums! :wave:

Am I getting you right that if you run the commands from above (locally run docker containers) it works, but only when you’re running in CircleCI it fails? :thinking:


The above log is from circle ci. Test is running succesfully, but data is not flowing to NewRelic, though i can see output is routed to statsd integration.

The same setup works fine when i am executing in my mac machine. So want to understand , where am i going wrong when executing the same script in circle ci. Does it have to do anything with connection between two images loadimpact/k6 , newrelic/nri-statsd

Hey @pradeep

To be honest, I’m not familiar with CircleCI. However, one thing that potentially, I guess can be an issue is that you start newrelic/nri-statsd:latest in a detached mode, and straight after loadimpact/k6 maybe the time in between isn’t enough for starting the newrelic/nri-statsd:latest :thinking:

Let me know if that helps,

Any updates? I am stuck at same point