## Prerequisites - Prometheus installation - a k6 script - a [k6 Cloud](https://k6.io) account for running load tests on the cloud - A visualization tool ## Steps (New Relic) ### Start Prometheus server ### Set up New Relic to get information from Prometheus - [New Relic documentation](https://docs.newrelic.com/docs/integrations/prometheus-integrations/install-configure-remote-write/set-your-prometheus-remote-write-integration/) - Involves going through the [Prometheus reomte write setup launcher in New Relic One](https://one.newrelic.com/launcher/nr1-core.settings?pane=eyJuZXJkbGV0SWQiOiJwcm9tZXRoZXVzLXJlbW90ZS13cml0ZS1pbnRlZ3JhdGlvbi1uZXJkbGV0cy5zZXR1cC1wcm9tZXRoZXVzIn0=) and going through the steps. - ![[new_relic-prometheus_integration.png]] ### Set up Prometheus. - Install Prometheus on a server. I used DigitalOcean's 1-click droplet deployment. - On your Prometheus server, modify your configuration file: `nano /etc/prometheus/prometheus.yml`. Add the remote write URL that New Relic gave you, like so: ```yml remote_write: - url: https://metric-api.newrelic.com/prometheus/v1/write?prometheus_server=prometheus-1 bearer_token: d16a82ab1334c326e1bc54ce2019248cfba1NRAL ``` Restart the Prometheus server. You should be able to see data from the Prometheus server flowing through to New Relic. ### Modify k6 script [k6 documentation](https://k6.io/docs/cloud/integrations/cloud-apm/prometheus-remote-write/#new-relic-setup) Add the following code: ```js ext: { loadimpact: { apm: [ { provider: "prometheus", remoteWriteURL: "https://metric-api.newrelic.com/prometheus/v1/write?prometheus_server=prometheus-1", credentials: { token: "d16a82ab1334c326e1bc54ce2019248cfba1NRAL" }, metrics: ["http_req_duration"], includeDefaultMetrics: true, includeTestRunId: false }, ] }, }, ``` Change the `remoteWriteURL` and the `token` parameter values. Get both from the YAML snippet New Relic generated for Prometheus.. Compared to the previous way: - Start up statsd via Docker - newrelic-helper.js - write your own - Can only run it locally and push results to cloud.