New Relic K6 integration

@mstoykov
I have generated the NR_API_KEY.
I have the NR_ACCOUNT_ID.

Trying to understand what should be the hostname in the below command? Can you please help ?

I tried with one.newrlic.com. But getting error as no host found.

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

I am not familiar with NewRelic or even StatsD, but why do you need to give a hostname to the docker container at all? It should bind to localhost by default, right? And this is what the k6 StatsD output also expects by default: StatsD

Hi both, just joined this forum (I’m from New Relic :wave:) and catching up on topics.
Indeed you don’t have to include the hostname. The New Relic - k6 integration works fine without that argument. We do recommend it though.
The reason that we include the hostname argument in the results visualisation guide, was to make it easier for users in New Relic to see where the results are being sent in from (which client is running it) which might be easier to determine and more user friendly than a docker container ID. One typical example might be somebody leaving the New Relic output enabled on a local client that is sending data to NR but they may not want to be - so to easier get to the source of who might be running this :slightly_smiling_face:

So this works equally fine:

docker run
-d --restart unless-stopped
–name newrelic-statsd
-e NR_ACCOUNT_ID=
-e NR_API_KEY=“”
-p 8125:8125/udp
newrelic/nri-statsd:latest


So see above the difference in New Relic is the source of the telemetry, which like I mention might be friendlier with a machines name rather than a container ID.

@pawansinha4u - hopefully running the same command without the hostname arg works for you - please reach out if you’re still facing issues.

Also cheeky plug for the k6 and New Relic webinar next Tuesday :wink:

2 Likes

Hey @gspncr - Thanks for everything.
I am able to integrate k6 and NR.

I have got a question on the metrics thrown to NR. I am not able to find which metrics to be considered for the response time. Below are the metrics listed for 1 transaction, transaction name is 00_getProduct. however. apply-pnv. - this is a namespace name using this variable K6_STATSD_NAMESPACE.I am not able to find "http_req_duration to check on response time.
i just see below metrics for any transactions. please help @mstoykov @gspncr

apply-pnv.00_getProduct.count.percentiles

apply-pnv.00_getProduct.mean

apply-pnv.00_getProduct.mean.percentiles

apply-pnv.00_getProduct.median

apply-pnv.00_getProduct.per_second

apply-pnv.00_getProduct.sum_squares

apply-pnv.00_getProduct.sum_squares.percentiles

apply-pnv.00_getProduct.sum.percentiles

apply-pnv.00_getProduct.upper.percentiles

@mostafa and @gspncr - Can you please help

Does no one have information on this ?

I am stunned no response on this?

Hi @pawansinha4u,

sorry about the lack of response on this, there’s just not a lot of New Relic users here.

I did a quick test and am able to see the http_req_duration metric in NR when setting K6_STATSD_NAMESPACE=apply-pnv.:

I’m not sure what you mean by “transaction” though, or how you set its name. Is that done via a name tag on a request?

If you could share a small script that reproduces this issue and the command to run it, it would help with troubleshooting.

Otherwise I’d suggest asking on a New Relic forum, as from what I can see k6 is sending all metrics correctly.

Thanks @imiric - This is the transaction name - 00_getProduct. (this is what I call a transaction)

This is the way i am giving - group(‘00_getProduct’, getProduct.getProductF).
getProductF - this is the function used to call http operation(not to worry about this).
So, all the stats come like below after execution: So the question is which one is exactly I should refer to get the response times?

apply-pnv.00_getProduct.count.percentiles
apply-pnv.00_getProduct.mean
apply-pnv.00_getProduct.mean.percentiles
apply-pnv.00_getProduct.median
apply-pnv.00_getProduct.per_second
apply-pnv.00_getProduct.sum_squares
apply-pnv.00_getProduct.sum_squares.percentiles
apply-pnv.00_getProduct.sum.percentiles
apply-pnv.00_getProduct.upper.percentiles

I will try catching NR guys on their support forum as well…

I think those are the group_duration values, while http_req_duration is a metric emitted per request.

If you’re only making a single request within that group, then you could lookup the standalone metric as I showed in my screenshot or by tagging the request. Otherwise, to get the response times for the entire group you’d have to define a custom metric and aggregate all response.timings.duration values in your script. See the documentation.

It has only one http request in the group, as you said you have given a screenshot, where is it ? @imiric. Also, the script has multiple group like this
group(‘00_getProduct’, getProduct.getProductF)
group(‘01_getJWT’, getToken.getJWT)

now it comes like below : for both the groups, i have just given for 1 group. so can you now tell me which one to consider for the response time ?
apply-pnv.00_getProduct.count.percentiles
apply-pnv.00_getProduct.mean
apply-pnv.00_getProduct.mean.percentiles
apply-pnv.00_getProduct.median
apply-pnv.00_getProduct.per_second
apply-pnv.00_getProduct.sum_squares
apply-pnv.00_getProduct.sum_squares.percentiles
apply-pnv.00_getProduct.sum.percentiles
apply-pnv.00_getProduct.upper.percentiles