<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Real time on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/</link><description>Recent content in Real time on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/results-output/real-time/index.xml" rel="self" type="application/rss+xml"/><item><title>Amazon CloudWatch</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/amazon-cloudwatch/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/amazon-cloudwatch/</guid><content><![CDATA[&lt;h1 id=&#34;amazon-cloudwatch&#34;&gt;Amazon CloudWatch&lt;/h1&gt;


&lt;div data-shared=&#34;statsd-output.md&#34;&gt;
            

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;, or using the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/opentelemetry/&#34;&gt;OpenTelemetry output&lt;/a&gt; depending on your use case.&lt;/p&gt;
&lt;p&gt;For more information on the reason behind this change, you can follow &lt;a href=&#34;https://github.com/grafana/k6/issues/2982&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this issue&lt;/a&gt; in the k6 repository.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;p&gt;k6 can send metrics data to &lt;a href=&#34;https://aws.amazon.com/cloudwatch/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Amazon CloudWatch&lt;/a&gt; through the &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;CloudWatch Agent&lt;/a&gt; by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;. These metrics can then be visualized in dashboards.&lt;/p&gt;
&lt;p&gt;This guide covers how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run the CloudWatch agent&lt;/li&gt;
&lt;li&gt;Run the k6 test&lt;/li&gt;
&lt;li&gt;Visualize k6 metrics in Amazon CloudWatch&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use the StatsD output option, you have to build a k6 binary using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;. For more details, refer to 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;run-the-cloudwatch-agent&#34;&gt;Run the CloudWatch agent&lt;/h2&gt;
&lt;p&gt;We presume that you already have a machine that supports both running k6 and CloudWatch agent, which either runs a flavor of GNU/Linux or Windows. Just go ahead and &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;download&lt;/a&gt; the suitable CloudWatch agent version for your operating system.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create an &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-iam-roles-for-cloudwatch-agent.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;IAM role&lt;/a&gt; to send metrics to CloudWatch via the agent. Then, if you are running on Amazon EC2, just &lt;a href=&#34;https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/iam-roles-for-amazon-ec2.html#attach-iam-role&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;attach&lt;/a&gt; the role to your EC2 instance, so that you can send metrics to CloudWatch. Otherwise, if you are running on-premises servers, follow this &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-commandline-fleet.html#install-CloudWatch-Agent-iam_user-first&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;guide&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Download the CloudWatch Agent package suitable for your operating system. For example, on Debian 10 (Buster), we&amp;rsquo;ve used the following link. For other operating systems, please refer to this &lt;a href=&#34;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;guide&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;wget https://s3.amazonaws.com/amazoncloudwatch-agent/debian/amd64/latest/amazon-cloudwatch-agent.deb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the package:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;sudo dpkg -i amazon-cloudwatch-agent.deb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the agent to receive data from k6. For this, create a file called &amp;ldquo;&lt;em&gt;/opt/aws/amazon-cloudwatch-agent/etc/statsd.json&lt;/em&gt;&amp;rdquo; and paste the following JSON config object into it. This configuration means that the agent would listen on port number 8125, which is the default port number for k6 and StatsD. The interval for collecting metrics is 5 seconds and we don&amp;rsquo;t aggregate them, since we need the raw data later in CloudWatch.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;metrics&amp;#34;: {
    &amp;#34;namespace&amp;#34;: &amp;#34;k6&amp;#34;,
    &amp;#34;metrics_collected&amp;#34;: {
      &amp;#34;statsd&amp;#34;: {
        &amp;#34;service_address&amp;#34;: &amp;#34;:8125&amp;#34;,
        &amp;#34;metrics_collection_interval&amp;#34;: 5,
        &amp;#34;metrics_aggregation_interval&amp;#34;: 0
      }
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following command to start the agent:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;sudo amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/statsd.json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can check the status of the agent using the following command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;amazon-cloudwatch-agent-ctl -a status&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;
&lt;p&gt;Once the agent is running, you can run your test with:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_STATSD_ENABLE_TAGS=true k6 run --out output-statsd script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Make sure you&amp;rsquo;re using the k6 binary you built with the xk6-output-statsd extension.&lt;/p&gt;
&lt;p&gt;You can look at the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt; output page for configuration options.&lt;/p&gt;
&lt;h2 id=&#34;visualize-k6-metrics-in-amazon-cloudwatch&#34;&gt;Visualize k6 metrics in Amazon CloudWatch&lt;/h2&gt;
&lt;p&gt;Visualization of the exported metrics to CloudWatch is done by creating a dashboard and selecting desired metrics to be displayed.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/cloudwatch-k6-metrics.png&#34;
  alt=&#34;List of k6 metrics&#34; width=&#34;1280&#34;
     height=&#34;577&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s an example dashboard we&amp;rsquo;ve created to visualize the test results.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/cloudwatch-k6-dashboard.png&#34;
  alt=&#34;k6 Dashboard on Amazon CloudWatch&#34; width=&#34;1408&#34;
     height=&#34;671&#34;/&gt;&lt;/p&gt;
&lt;p&gt;The above dashboard is exported as JSON and is available &lt;a href=&#34;https://github.com/k6io/example-cloudwatch-dashboards&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="amazon-cloudwatch">Amazon CloudWatch&lt;/h1>
&lt;div data-shared="statsd-output.md">
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href="https://github.com/LeonAdato/xk6-output-statsd" target="_blank" rel="noopener noreferrer">xk6-output-statsd extension&lt;/a>, or using the
&lt;a href="/docs/k6/v2.3.x/results-output/real-time/opentelemetry/">OpenTelemetry output&lt;/a> depending on your use case.&lt;/p></description></item><item><title>Apache Kafka</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/apache-kafka/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/apache-kafka/</guid><content><![CDATA[&lt;h1 id=&#34;apache-kafka&#34;&gt;Apache Kafka&lt;/h1&gt;
&lt;p&gt;&lt;a href=&#34;https://kafka.apache.org&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Apache Kafka&lt;/a&gt; is a stream-processing platform for handling real-time data. Using &lt;a href=&#34;https://github.com/grafana/xk6-output-kafka&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-kafka extension&lt;/a&gt;, you can send k6 metrics in real-time to Kafka, and, optionally, ingest them from InfluxDB.&lt;/p&gt;
&lt;h2 id=&#34;build-the-k6-version&#34;&gt;Build the k6 version&lt;/h2&gt;
&lt;p&gt;To build a k6 binary with the extension, first, make sure you have &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt; installed on your machine.&lt;/p&gt;
&lt;p&gt;Then, open your terminal and run the following commands:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build the k6 binary
xk6 build --with github.com/grafana/xk6-output-kafka

... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;xk6 will create the new k6 binary in the local folder.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To learn more about how to build custom k6 versions, check out &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;
&lt;p&gt;You can configure the broker (or multiple ones), topic and message format directly from the command line parameter like this:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out xk6-kafka=brokers=broker_host:8000,topic=k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;or if you want multiple brokers:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;--out xk6-kafka=brokers={broker1,broker2},topic=k6,format=json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also specify the message &lt;code&gt;format&lt;/code&gt; k6 will use. By default, it will be the same as the JSON output, but you can also use the InfluxDB line protocol for direct &amp;ldquo;consumption&amp;rdquo; by InfluxDB:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;--out xk6-kafka=brokers=someBroker,topic=someTopic,format=influxdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can even modify some of the &lt;code&gt;format&lt;/code&gt; settings such as &lt;code&gt;tagsAsFields&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;--out xk6-kafka=brokers=someBroker,topic=someTopic,format=influxdb,influxdb.tagsAsFields={url,myCustomTag}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;options&#34;&gt;Options&lt;/h3&gt;
&lt;p&gt;Here is the full list of options that can be configured and passed to the extension:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_BROKERS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of brokers&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_TOPIC&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The name of the topic to be sent&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_AUTH_MECHANISM&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Authentication mechanism. Default &lt;code&gt;none&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_SASL_USER&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Kafka User&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_SASL_PASSWORD&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Kafka User Password&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_SSL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_VERSION&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Kafka version. Default the latest&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_INSECURE_SKIP_TLS_VERIFY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether should ignore TLS verifications&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_PUSH_INTERVAL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Interval of the metrics&amp;rsquo; aggregation and upload to the endpoint&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_FORMAT&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Message format. &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;influxdb&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_KAFKA_LOG_ERROR&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Boolean indicating to log kafka errors&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;read-more&#34;&gt;Read more&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/xk6-output-kafka&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-kafka extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://k6.io/blog/integrating-k6-with-apache-kafka&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Integrating k6 with Apache Kafka&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="apache-kafka">Apache Kafka&lt;/h1>
&lt;p>&lt;a href="https://kafka.apache.org" target="_blank" rel="noopener noreferrer">Apache Kafka&lt;/a> is a stream-processing platform for handling real-time data. Using &lt;a href="https://github.com/grafana/xk6-output-kafka" target="_blank" rel="noopener noreferrer">xk6-output-kafka extension&lt;/a>, you can send k6 metrics in real-time to Kafka, and, optionally, ingest them from InfluxDB.&lt;/p></description></item><item><title>CSV</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/csv/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/csv/</guid><content><![CDATA[&lt;h1 id=&#34;csv&#34;&gt;CSV&lt;/h1&gt;
&lt;p&gt;You can output granular data points in CSV format.
To do so, use &lt;code&gt;k6 run&lt;/code&gt; with the &lt;code&gt;--out&lt;/code&gt; flag.
Pass the path for your CSV file as the flag argument:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out csv=test_results.csv script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also get the results gzipped, like this:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out csv=test_results.gz script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To inspect the output in real time, you can use a command like &lt;code&gt;tail -f&lt;/code&gt; on the file you save:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;tail -f test_results.csv&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;csv-format&#34;&gt;CSV format&lt;/h2&gt;
&lt;p&gt;The CSV result file will look something like this:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;metric_name,timestamp,metric_value,check,error,error_code,group,method,name,proto,scenario,status,subproto,tls_version,url,extra_tags
http_reqs,1595325560,1.000000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_duration,1595325560,221.899000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_blocked,1595325560,225.275000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_connecting,1595325560,217.680000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_tls_handshaking,1595325560,0.000000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_sending,1595325560,0.112000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_waiting,1595325560,220.280000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
http_req_receiving,1595325560,1.507000,,,,,GET,http://test.k6.io,HTTP/1.1,default,200,,,http://test.k6.io,
vus,1595325560,1.000000,,,,,,,,,,,,,
vus_max,1595325560,20.000000,,,,,,,,,,,,,
checks,1595325561,1.000000,status is 200,,,,,,,default,,,,,
checks,1595325561,0.000000,response body,,,,,,,default,,,,,
data_sent,1595325561,76.000000,,,,,,,,default,,,,,
data_received,1595325561,11045.000000,,,,,,,,default,,,,,
iteration_duration,1595325561,1449.049580,,,,,,,,default,,,,,
iterations,1595325561,1.000000,,,,,,,,default,,,,,&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Each entry in the report represents a metric, &lt;code&gt;metric_name&lt;/code&gt;, along with its value, &lt;code&gt;metric_value&lt;/code&gt;, at time, &lt;code&gt;timestamp&lt;/code&gt;.
If an error happens, then the &lt;code&gt;error&lt;/code&gt; along with the &lt;code&gt;error_code&lt;/code&gt; fields will be populated.&lt;/p&gt;
&lt;h2 id=&#34;csv-options&#34;&gt;CSV options&lt;/h2&gt;
&lt;p&gt;k6 provides a few options to help you configure your CSV output:&lt;/p&gt;
&lt;!-- vale off --&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;option&lt;/th&gt;
              &lt;th&gt;Configures&lt;/th&gt;
              &lt;th&gt;Possible values&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Env. variable&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;saveInterval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The time intervals at which k6 writes to the CSV&lt;/td&gt;
              &lt;td&gt;Either a string with time units(&lt;code&gt;&amp;quot;1m45s&amp;quot;&lt;/code&gt;), or a number of milliseconds&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;1s&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;K6_CSV_SAVE_INTERVAL&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;timeFormat&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The timestamp format&lt;/td&gt;
              &lt;td&gt;unix, unix_nano, unix_micro, unix_milli, &lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc3339&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;rfc3339&lt;/a&gt;, rfc3339_nano&lt;/td&gt;
              &lt;td&gt;unix&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;K6_CSV_TIME_FORMAT&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;fileName&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The file name and path where output is saved&lt;/td&gt;
              &lt;td&gt;N/A&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;file.csv&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;K6_CSV_FILENAME&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;!-- vale on --&gt;
&lt;h2 id=&#34;read-more&#34;&gt;Read more&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;Metrics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/javascript-api/error-codes/&#34;&gt;Error codes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="csv">CSV&lt;/h1>
&lt;p>You can output granular data points in CSV format.
To do so, use &lt;code>k6 run&lt;/code> with the &lt;code>--out&lt;/code> flag.
Pass the path for your CSV file as the flag argument:&lt;/p></description></item><item><title>Datadog</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/datadog/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/datadog/</guid><content><![CDATA[&lt;h1 id=&#34;datadog&#34;&gt;Datadog&lt;/h1&gt;


&lt;div data-shared=&#34;statsd-output.md&#34;&gt;
            

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;, or using the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/opentelemetry/&#34;&gt;OpenTelemetry output&lt;/a&gt; depending on your use case.&lt;/p&gt;
&lt;p&gt;For more information on the reason behind this change, you can follow &lt;a href=&#34;https://github.com/grafana/k6/issues/2982&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this issue&lt;/a&gt; in the k6 repository.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;p&gt;k6 can send metrics to &lt;a href=&#34;https://www.datadoghq.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Datadog&lt;/a&gt;. That allows visualizing and correlating performance testing metrics with other monitored metrics in Datadog.&lt;/p&gt;
&lt;p&gt;This guide covers how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run the Datadog Agent&lt;/li&gt;
&lt;li&gt;Run the k6 test&lt;/li&gt;
&lt;li&gt;Visualize in Datadog&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use the StatsD output option, you have to build a k6 binary using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;. For more details, refer to 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;run-the-datadog-agent&#34;&gt;Run the Datadog Agent&lt;/h2&gt;
&lt;p&gt;To get k6 metrics into Datadog, k6 sends metrics through the Datadog Agent, which collects, aggregates, and forwards the metrics to the Datadog platform.&lt;/p&gt;
&lt;p&gt;Run the Datadog Agent service as a Docker container with this command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;DOCKER_CONTENT_TRUST=1 \
docker run --rm -d \
    --name datadog \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    -v /proc/:/host/proc/:ro \
    -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
    -e DD_SITE=&amp;#34;datadoghq.com&amp;#34; \
    -e DD_API_KEY=&amp;lt;YOUR_DATADOG_API_KEY&amp;gt; \
    -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1 \
    -p 8125:8125/udp \
    datadog/agent:latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For &lt;code&gt;DD_SITE&lt;/code&gt;, make sure to use the correct &lt;a href=&#34;https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Datadog site URL&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Replace &lt;code&gt;&amp;lt;YOUR_DATADOG_API_KEY&amp;gt;&lt;/code&gt; with your &lt;a href=&#34;https://app.datadoghq.com/account/settings#api&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Datadog API key&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;For additional information, refer to the &lt;a href=&#34;https://docs.datadoghq.com/agent/docker/&#34;&gt;Datadog Docker Agent documentation&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;dogstatsd&#34;&gt;DogStatsD&lt;/h3&gt;
&lt;p&gt;The Datadog agent includes the &lt;a href=&#34;https://docs.datadoghq.com/developers/dogstatsd/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;DogStatsD&lt;/a&gt; service to collect and aggregate metrics. DogStatsD implements the &lt;a href=&#34;https://github.com/etsy/statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;StatsD&lt;/a&gt; protocol with some extensions. For example, &lt;a href=&#34;https://docs.datadoghq.com/tagging/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;DogStatsD tagging&lt;/a&gt; allows to collect k6 metrics with tags to distinguish between requests for different URLs, response statuses, groups, etc.&lt;/p&gt;
&lt;p&gt;The instruction above runs the &lt;code&gt;DogStatsD&lt;/code&gt; service in a &lt;a href=&#34;https://docs.datadoghq.com/developers/dogstatsd/?tab=containeragent#agent&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Docker container&lt;/a&gt;, but it&amp;rsquo;s also possible to run it either as &lt;a href=&#34;https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent#agent&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Host Agent&lt;/a&gt;, &lt;a href=&#34;https://docs.datadoghq.com/developers/dogstatsd/?tab=kubernetes#agent&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Kubernetes&lt;/a&gt;, and &lt;a href=&#34;https://docs.datadoghq.com/developers/dogstatsd/?tab=helm#agent&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Helm&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;
&lt;p&gt;Once the Datadog Agent service is running, run the k6 test and send the metrics to the Agent with:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_STATSD_ENABLE_TAGS=true k6 run --out output-statsd script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Make sure you&amp;rsquo;re using the k6 binary you built with the xk6-output-statsd extension.&lt;/p&gt;
&lt;p&gt;You can look at the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt; output page for configuration options.&lt;/p&gt;
&lt;h2 id=&#34;visualize-in-datadog&#34;&gt;Visualize in Datadog&lt;/h2&gt;
&lt;p&gt;While running the test, k6 sends metrics periodically to Datadog. By default, these metrics have &lt;code&gt;k6.&lt;/code&gt; as the name prefix.&lt;/p&gt;
&lt;p&gt;You can visualize k6 metrics in real-time with the &lt;a href=&#34;https://docs.datadoghq.com/metrics/explorer/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;metrics explorer&lt;/a&gt;, &lt;a href=&#34;https://docs.datadoghq.com/monitors/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;monitors&lt;/a&gt;, or &lt;a href=&#34;https://docs.datadoghq.com/graphing/dashboards/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;custom dashboards&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/datadog-performance-testing-metrics.png&#34;
  alt=&#34;Datadog visualizing performance testing metrics&#34; width=&#34;2414&#34;
     height=&#34;1202&#34;/&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To learn more about all the types of k6 metrics, read the 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 Metrics guide&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first time Datadog detects the &lt;code&gt;k6.http_reqs&lt;/code&gt; metric, the k6 integration tile is installed automatically, and the default k6 dashboard is added to your dashboard list.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/datadog-k6-dashboard.png&#34;
  alt=&#34;k6 Datadog Dashboard&#34; width=&#34;2218&#34;
     height=&#34;1076&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Optionally, you can install the k6 integration tile following these instructions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Log in to &lt;code&gt;Datadog&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;From the sidebar menu, choose &lt;code&gt;Integrations&lt;/code&gt; &amp;gt; &lt;code&gt;Integrations&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Search for &lt;code&gt;k6&lt;/code&gt;, then select the &lt;code&gt;k6&lt;/code&gt; integration.&lt;/li&gt;
&lt;li&gt;Click on the &lt;code&gt;Configuration&lt;/code&gt; tab option.&lt;/li&gt;
&lt;li&gt;Scroll down and click on the &lt;code&gt;Install integration&lt;/code&gt; button.&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="datadog">Datadog&lt;/h1>
&lt;div data-shared="statsd-output.md">
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href="https://github.com/LeonAdato/xk6-output-statsd" target="_blank" rel="noopener noreferrer">xk6-output-statsd extension&lt;/a>, or using the
&lt;a href="/docs/k6/v2.3.x/results-output/real-time/opentelemetry/">OpenTelemetry output&lt;/a> depending on your use case.&lt;/p></description></item><item><title>Dynatrace</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/dynatrace/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/dynatrace/</guid><content><![CDATA[&lt;h1 id=&#34;dynatrace&#34;&gt;Dynatrace&lt;/h1&gt;
&lt;p&gt;With the &lt;a href=&#34;https://github.com/Dynatrace/xk6-output-dynatrace&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Dynatrace k6 extension&lt;/a&gt;,
you can send visualize and correlate performance testing metrics with the other metrics that you monitor in Dynatrace.&lt;/p&gt;
&lt;h2 id=&#34;build-the-k6-version&#34;&gt;Build the k6 version&lt;/h2&gt;
&lt;p&gt;To build a k6 binary with the extension, first, make sure you have &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt; installed on your machine.&lt;/p&gt;
&lt;p&gt;Then, open your terminal and run the following commands:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build the k6 binary
xk6 build --with github.com/Dynatrace/xk6-output-dynatrace

... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;xk6 will create the new k6 binary in the local folder.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To learn more about how to build custom k6 versions, check out &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;run-the-test&#34;&gt;Run the test&lt;/h2&gt;
&lt;p&gt;Create a Dynatrace API token to send the data.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;The Dynatrace API Token must have the scope name &amp;ldquo;metrics.ingest&amp;rdquo; (scope type &lt;code&gt;API v2&lt;/code&gt;).&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can use the Dynatrace UI:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/dynatrace-api-token.png&#34;
  alt=&#34;Dynatrace API token&#34; width=&#34;2000&#34;
     height=&#34;988&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Or a &lt;code&gt;curl&lt;/code&gt; command (replace &lt;code&gt;&amp;lt;environment-id&amp;gt;&lt;/code&gt; and the &lt;code&gt;Api-Token&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -X POST &amp;#34;https://&amp;lt;environment-id&amp;gt;.live.dynatrace.com/api/v2/apiTokens&amp;#34; -H &amp;#34;accept: application/json; charset=utf-8&amp;#34; -H &amp;#34;Content-Type: application/json; charset=utf-8&amp;#34; -d &amp;#34;{\&amp;#34;name\&amp;#34;:\&amp;#34;\&amp;#34;,\&amp;#34;scopes\&amp;#34;:[\&amp;#34;metrics.ingest\&amp;#34;]}&amp;#34; -H &amp;#34;Authorization: Api-Token XXXXXXXX&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Use the previously built k6 binary and run the test passing the Dynatrace URL and API token as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# export dynatrace variables
export K6_DYNATRACE_URL=https://&amp;lt;environmentid&amp;gt;.live.dynatrace.com
export K6_DYNATRACE_APITOKEN=&amp;lt;Dynatrace API token&amp;gt;

# run the test
./k6 run script.js -o output-dynatrace&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Check the metrics in your Dynatrace environment, filtering for &lt;code&gt;k6&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/dynatrace-k6-metrics.png&#34;
  alt=&#34;Dynatrace Test result&#34; width=&#34;1200&#34;
     height=&#34;642&#34;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/dynatrace-k6-test-result.png&#34;
  alt=&#34;Dynatrace Test result&#34; width=&#34;2000&#34;
     height=&#34;1034&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;options&#34;&gt;Options&lt;/h3&gt;
&lt;p&gt;When streaming the k6 results to Dynatrace, you can configure the following Dynatrace options:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_DYNATRACE_APITOKEN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Dynatrace API token to write the metrics. The token must have the scope &lt;code&gt;metrics.ingest API v2&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_DYNATRACE_FLUSH_PERIOD&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Define how often metrics are sent to Dynatrace. The default value is 1 second.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_DYNATRACE_URL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Dynatrace URL. The default value is &lt;code&gt;https://dynatrace.live.com&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_DYNATRACE_INSECURE_SKIP_TLS_VERIFY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If &lt;code&gt;true&lt;/code&gt;, the HTTP client skips TLS verification on the endpoint. The default value is &lt;code&gt;true&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_DYNATRACE_HEADER_&amp;lt;here-the-header-key&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Additional headers to include in the HTTP requests. &lt;code&gt;K6_DYNATRACE_HEADER_COOL_HEADER=&amp;quot;cool value of the header&amp;quot;&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="dynatrace">Dynatrace&lt;/h1>
&lt;p>With the &lt;a href="https://github.com/Dynatrace/xk6-output-dynatrace" target="_blank" rel="noopener noreferrer">Dynatrace k6 extension&lt;/a>,
you can send visualize and correlate performance testing metrics with the other metrics that you monitor in Dynatrace.&lt;/p>
&lt;h2 id="build-the-k6-version">Build the k6 version&lt;/h2>
&lt;p>To build a k6 binary with the extension, first, make sure you have &lt;a href="https://golang.org/doc/install" target="_blank" rel="noopener noreferrer">Go&lt;/a> and &lt;a href="https://git-scm.com/" target="_blank" rel="noopener noreferrer">Git&lt;/a> installed on your machine.&lt;/p></description></item><item><title>Elasticsearch</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/elasticsearch/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/elasticsearch/</guid><content><![CDATA[&lt;h1 id=&#34;elasticsearch&#34;&gt;Elasticsearch&lt;/h1&gt;
&lt;p&gt;Using the &lt;a href=&#34;https://github.com/elastic/xk6-output-elasticsearch&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Elasticsearch k6 extension&lt;/a&gt;, you can store k6 metrics in &lt;a href=&#34;https://github.com/elastic/elasticsearch&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Elasticsearch&lt;/a&gt; and analyze your performance results with Kibana or Grafana.&lt;/p&gt;
&lt;h2 id=&#34;build-the-k6-version&#34;&gt;Build the k6 version&lt;/h2&gt;
&lt;p&gt;To build a k6 binary with the extension, first, make sure you have &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt; installed on your machine.&lt;/p&gt;
&lt;p&gt;Then, open your terminal and run the following commands:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build the k6 binary
xk6 build --with github.com/elastic/xk6-output-elasticsearch

... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;xk6 will create the new k6 binary in the local folder.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To learn more about how to build custom k6 versions, check out &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;run-the-test&#34;&gt;Run the test&lt;/h2&gt;
&lt;p&gt;Check that the Elasticsearch instance to store the k6 metrics is running.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re running on Elasticsearch cloud, use the previous k6 binary and run the test passing the cloud credentials as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# export cloud configuration
export K6_ELASTICSEARCH_CLOUD_ID=your-cloud-id-here
export K6_ELASTICSEARCH_USER=your-user-here
export K6_ELASTICSEARCH_PASSWORD=your-password-here

# run the test
./k6 run script.js -o output-elasticsearch&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;k6 runs the test script and sends the metrics in real-time to Elasticsearch.&lt;/p&gt;
&lt;p&gt;You can also send the metrics to a local Elasticsearch cluster:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# export local url
export K6_ELASTICSEARCH_URL=http://localhost:9200

# run the test
./k6 run script.js -o output-elasticsearch&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Security and self-signed certificates for non-cloud clusters are not yet supported.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can now connect to Elasticsearch and query the 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 metrics&lt;/a&gt; stored in the &lt;code&gt;k6-metrics&lt;/code&gt; index.
The following example uses an unsecured local Elasticsearch, version &lt;code&gt;7.17.9&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -XGET &amp;#39;http://localhost:9200/k6-metrics/_search?pretty&amp;#39; -H &amp;#39;Content-Type: application/json&amp;#39; -d&amp;#39;
{
  &amp;#34;sort&amp;#34;: [
    {
      &amp;#34;Time&amp;#34;: {
        &amp;#34;order&amp;#34;: &amp;#34;desc&amp;#34;
      }
    }
  ],
  &amp;#34;size&amp;#34;: 10
}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Or use &lt;a href=&#34;https://www.elastic.co/guide/en/kibana/7.17/discover.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Kibana Discover&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/kibana-discover-test-result.png&#34;
  alt=&#34;Kibana Discover k6 results&#34; width=&#34;2000&#34;
     height=&#34;1462&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;options&#34;&gt;Options&lt;/h3&gt;
&lt;p&gt;Here is the full list of options that can be configured and passed to the extension:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_ELASTICSEARCH_CLOUD_ID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Elasticsearch &lt;code&gt;cloud.id&lt;/code&gt;, which can be found in the Elastic Cloud web console.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_ELASTICSEARCH_FLUSH_PERIOD&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Define how often metrics are sent to Elasticsearch. The default value is 1 second.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_ELASTICSEARCH_URL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Elasticsearch URL.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_ELASTICSEARCH_USER&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Elasticsearch username.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_ELASTICSEARCH_PASSWORD&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Elasticsearch password.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="elasticsearch">Elasticsearch&lt;/h1>
&lt;p>Using the &lt;a href="https://github.com/elastic/xk6-output-elasticsearch" target="_blank" rel="noopener noreferrer">Elasticsearch k6 extension&lt;/a>, you can store k6 metrics in &lt;a href="https://github.com/elastic/elasticsearch" target="_blank" rel="noopener noreferrer">Elasticsearch&lt;/a> and analyze your performance results with Kibana or Grafana.&lt;/p>
&lt;h2 id="build-the-k6-version">Build the k6 version&lt;/h2>
&lt;p>To build a k6 binary with the extension, first, make sure you have &lt;a href="https://golang.org/doc/install" target="_blank" rel="noopener noreferrer">Go&lt;/a> and &lt;a href="https://git-scm.com/" target="_blank" rel="noopener noreferrer">Git&lt;/a> installed on your machine.&lt;/p></description></item><item><title>Grafana Cloud k6</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/cloud/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/cloud/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-cloud-k6&#34;&gt;Grafana Cloud k6&lt;/h1&gt;
&lt;p&gt;Besides 
    &lt;a href=&#34;/docs/k6/v2.3.x/get-started/running-k6/#execution-modes&#34;&gt;running cloud tests&lt;/a&gt;, you can also run a test locally and stream the results to &lt;a href=&#34;/docs/grafana-cloud/testing/k6/get-started/run-cloud-tests-from-the-cli/#run-locally-and-stream-to-the-cloud&#34;&gt;Grafana Cloud k6&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When streaming the results to the cloud, the machine - where you execute the k6 CLI command - runs the test and uploads the results to the cloud-based solution. Then, you will be able to visualize and analyze the results on the web app in real-time.&lt;/p&gt;
&lt;h2 id=&#34;streaming-results-vs-running-on-cloud-servers&#34;&gt;Streaming results vs. running on cloud servers&lt;/h2&gt;
&lt;p&gt;Don&amp;rsquo;t confuse &lt;code&gt;k6 cloud run --local-execution script.js&lt;/code&gt; (what this page is about) with &lt;code&gt;k6 cloud run script.js&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Fundamentally the difference is the machine that the test runs on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;k6 cloud run --local-execution&lt;/code&gt; runs k6 locally and streams the results to the cloud.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k6 cloud run&lt;/code&gt;, on the other hand, uploads your script to the cloud solution and runs the test on the cloud infrastructure. In this case you&amp;rsquo;ll only see status updates in your CLI.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In all cases you&amp;rsquo;ll be able to see your test results at &lt;a href=&#34;https://app.k6.io&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;k6 Cloud&lt;/a&gt; or &lt;a href=&#34;/products/cloud/&#34;&gt;Grafana Cloud&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Data storage and processing are primary cloud costs,
so &lt;code&gt;k6 cloud run --local-execution&lt;/code&gt; will consume VUH or test runs from your subscription.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;instructions&#34;&gt;Instructions&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Log in to the cloud&lt;/p&gt;
&lt;p&gt;Assuming you have installed k6, the first step is to log in to the cloud service.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;k6 cloud login&lt;/code&gt; — it will prompt you interactively for your API token and stack:&lt;/p&gt;



  






  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;bash&amp;#34;], false)&#34; x-init=&#34;init()&#34; &gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;div class=&#34;toggle-toolbar__item toggle-toolbar__item-active&#34;&gt;Bash&lt;/div&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @click=&#34;copy()&#34;&gt;
            &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
            &lt;span&gt;Copy&lt;/span&gt;
          &lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class=&#34;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#34; &gt;
      
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 cloud login&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;For non-interactive environments such as CI/CD, pass the values directly:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 cloud login --token &amp;lt;YOUR_API_TOKEN&amp;gt; --stack &amp;lt;YOUR_STACK_SLUG&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the tests and upload the results&lt;/p&gt;
&lt;p&gt;Now, k6 will authenticate you against the cloud service, and you can use the &lt;code&gt;--local-execution&lt;/code&gt; option to send the k6 results to the cloud as:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 cloud run --local-execution script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Alternatively, you could skip the &lt;code&gt;k6 cloud login&lt;/code&gt; command when passing your API token and stack ID (available in your settings, along with your API token) to the &lt;code&gt;k6 cloud run&lt;/code&gt; command as:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_CLOUD_TOKEN=&amp;lt;YOUR_API_TOKEN&amp;gt; K6_CLOUD_STACK_ID=&amp;lt;YOUR_STACK_ID&amp;gt; k6 cloud run --local-execution script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;After running the command, the console shows a URL. Copy this URL and paste it in your browser&amp;rsquo;s address bar to visualize the test results.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;execution: local
    output: cloud (https://acmecorp.grafana.net/a/k6-app/runs/123456)
    script: script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/screenshot-stream-k6-results-to-grafana-cloud-k6.png&#34;
  alt=&#34;Grafana Cloud k6 Test Results&#34; width=&#34;3008&#34;
     height=&#34;1852&#34;/&gt;&lt;/p&gt;
&lt;p&gt;When you send the results to the k6 Cloud with &lt;code&gt;k6 cloud run --local-execution&lt;/code&gt;, data will be
continuously streamed to the cloud. While this happens the state of the test run
will be marked as &lt;code&gt;Running&lt;/code&gt;. A test run that ran its course will be marked
&lt;code&gt;Finished&lt;/code&gt;. The run state has nothing to do with the test passing any
thresholds, only that the test itself is operating correctly.&lt;/p&gt;
&lt;p&gt;If you deliberately abort your test (e.g. by pressing &lt;em&gt;Ctrl-C&lt;/em&gt;), your test will
end up as &lt;code&gt;Aborted by User&lt;/code&gt;. You can still look and analyze the test data you
streamed so far. The test will just have run shorter than originally planned.&lt;/p&gt;
&lt;p&gt;Another possibility would be if you lose network connection with the cloud service
while your test is running. In that case the cloud service will patiently wait for
you to reconnect. In the meanwhile your test&amp;rsquo;s run state will continue to
appear as &lt;code&gt;Running&lt;/code&gt; on the web app.&lt;/p&gt;
&lt;p&gt;If no reconnection happens, the cloud service will time out after two minutes of no
data, setting the run state to &lt;code&gt;Timed out&lt;/code&gt;. You can still analyze a timed out
test but you&amp;rsquo;ll of course only have access to as much data as was streamed
before the network issue.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;The &lt;code&gt;k6 cloud run --local-execution script.js&lt;/code&gt; command uploads the test archive k6 produces from your test script and resources to Grafana Cloud.&lt;/p&gt;
&lt;p&gt;This behavior can be deactivated by adding the &lt;code&gt;--no-archive-upload&lt;/code&gt; option to your
command: &lt;code&gt;k6 cloud run --local-execution --no-archive-upload script.js&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;stream-logs-to-the-cloud&#34;&gt;Stream logs to the cloud&lt;/h2&gt;
&lt;p&gt;Starting in k6 v2.2.0, &lt;code&gt;k6 cloud run --local-execution&lt;/code&gt; also streams k6&amp;rsquo;s logs to Grafana Cloud k6. You can view them in the test run alongside the results, the same as a test that runs on cloud servers. Your local log output is unaffected.&lt;/p&gt;
&lt;p&gt;To stop streaming logs to the cloud, pass &lt;code&gt;--no-cloud-logs&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 cloud run --local-execution --no-cloud-logs script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="grafana-cloud-k6">Grafana Cloud k6&lt;/h1>
&lt;p>Besides
&lt;a href="/docs/k6/v2.3.x/get-started/running-k6/#execution-modes">running cloud tests&lt;/a>, you can also run a test locally and stream the results to &lt;a href="/docs/grafana-cloud/testing/k6/get-started/run-cloud-tests-from-the-cli/#run-locally-and-stream-to-the-cloud">Grafana Cloud k6&lt;/a>.&lt;/p>
&lt;p>When streaming the results to the cloud, the machine - where you execute the k6 CLI command - runs the test and uploads the results to the cloud-based solution. Then, you will be able to visualize and analyze the results on the web app in real-time.&lt;/p></description></item><item><title>Grafana Cloud Prometheus</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/grafana-cloud-prometheus/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/grafana-cloud-prometheus/</guid><content><![CDATA[&lt;h1 id=&#34;grafana-cloud-prometheus&#34;&gt;Grafana Cloud Prometheus&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;This page includes instructions for running a local test that sends the test results to a Prometheus instance in Grafana Cloud.&lt;/p&gt;
&lt;p&gt;For running and managing cloud tests in Grafana Cloud, check out &lt;a href=&#34;/docs/grafana-cloud/testing/k6/&#34;&gt;Grafana Cloud k6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can send your k6 results to a Prometheus instance running in &lt;a href=&#34;/products/cloud&#34;&gt;Grafana Cloud&lt;/a&gt; for visualization and analysis. By bringing k6 metrics into Grafana, you can correlate them with other observability metrics.&lt;/p&gt;
&lt;p&gt;While this topic uses Grafana Cloud as an example, this approach is compatible with any remote write capable Prometheus installation.&lt;/p&gt;
&lt;h2 id=&#34;set-up-grafana-cloud-prometheus&#34;&gt;Set up Grafana Cloud Prometheus&lt;/h2&gt;
&lt;p&gt;Before you start, you need the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Grafana Cloud account (&lt;a href=&#34;/products/cloud/&#34;&gt;sign up&lt;/a&gt;).
The free plan includes 10,000 Prometheus series.&lt;/li&gt;
&lt;li&gt;The URL, username, and password of your Grafana Cloud Prometheus instance to configure the integration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After you&amp;rsquo;ve set up your account, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Log in to &lt;code&gt;Grafana.com&lt;/code&gt; and visit the &lt;a href=&#34;/docs/grafana-cloud/fundamentals/cloud-portal/&#34;&gt;Cloud Portal&lt;/a&gt;.
Select the &lt;strong&gt;Details&lt;/strong&gt; of your Prometheus service.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/grafana_cloud_portal.png&#34;
  alt=&#34;Grafana Cloud Portal&#34; width=&#34;2452&#34;
     height=&#34;1312&#34;/&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy the URL of the Remote Write Endpoint, along with the Username and Instance ID.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/grafana_cloud_prometheus_configuration-v2.png&#34;
  alt=&#34;Grafana Cloud Prometheus Configuration&#34; width=&#34;1098&#34;
     height=&#34;913&#34;/&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the &lt;strong&gt;Password / API Token&lt;/strong&gt; section, create and copy a &lt;a href=&#34;/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/&#34;&gt;Grafana Cloud Access Policy Token&lt;/a&gt; with the &lt;code&gt;metrics:write&lt;/code&gt; scope (permission). The token will be used as a password.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/grafana_cloud_create_api_key_metrics_publisher-v2.png&#34;
  alt=&#34;Create API Key&#34; width=&#34;1077&#34;
     height=&#34;427&#34;/&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;run-the-test&#34;&gt;Run the test&lt;/h2&gt;
&lt;p&gt;Now, pass the Username, Access Policy Token, and Remote Write Endpoint of the Grafana Cloud Prometheus Configuration to the k6 binary:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_USERNAME=USERNAME \
K6_PROMETHEUS_RW_PASSWORD=ACCESS_POLICY_API_TOKEN \
K6_PROMETHEUS_RW_SERVER_URL=REMOTE_WRITE_ENDPOINT \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;visualize-test-results&#34;&gt;Visualize test results&lt;/h2&gt;
&lt;p&gt;To visualize test results with Grafana, you can import the &lt;a href=&#34;/grafana/dashboards/19665-k6-prometheus/&#34;&gt;k6 Prometheus dashboard by Grafana k6&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the Dashboards UI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Click &lt;code&gt;New&lt;/code&gt; and select &lt;code&gt;Import&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Paste the Grafana URL or ID of the dashboard, and click &lt;code&gt;Load&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Select the Prometheus data source, and click &lt;code&gt;Import&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/k6-prometheus-dashboard-part1.png&#34;
  alt=&#34;k6 Prometheus Dashboard&#34; width=&#34;3454&#34;
     height=&#34;1992&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Optionally, when running the test, you can set the &lt;code&gt;testid&lt;/code&gt; tag as a 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/tags-and-groups/#test-wide-tags&#34;&gt;wide test tag&lt;/a&gt; to filter results of a particular test run on this dashboard (or in PromQL queries). &lt;code&gt;testid&lt;/code&gt; can be any unique string that allows you to identify the test run.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_USERNAME=USERNAME \
K6_PROMETHEUS_RW_PASSWORD=ACCESS_POLICY_API_TOKEN \
K6_PROMETHEUS_RW_SERVER_URL=REMOTE_WRITE_ENDPOINT \
k6 run -o experimental-prometheus-rw --tag testid=TEST_ID script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Additionally, you can also use the &lt;a href=&#34;/docs/grafana/latest/explore/&#34;&gt;Explore UI&lt;/a&gt; to query k6 time series, design your visualization panels, and add them to any of your existing dashboards.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/grafana_cloud_explore_k6_metrics_from_extension.png&#34;
  alt=&#34;Explore k6 metrics in Grafana Cloud&#34; width=&#34;1317&#34;
     height=&#34;924&#34;/&gt;&lt;/p&gt;
&lt;p&gt;All the k6 time series have a &lt;strong&gt;k6_&lt;/strong&gt; prefix.
For more details, refer to the documentation on the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/prometheus-remote-write/#metrics-mapping&#34;&gt;mapping of k6 metrics with Prometheus metrics&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also important to understand the default 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/prometheus-remote-write/#trend-metric-conversions&#34;&gt;Trend metric conversion&lt;/a&gt; process and the format and querying limitations. The 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/prometheus-remote-write/#options&#34;&gt;&lt;code&gt;K6_PROMETHEUS_RW_TREND_STATS&lt;/code&gt; option&lt;/a&gt; allows you to convert trend metrics to multiple Prometheus time series. For instance, &lt;code&gt;K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),max,min&lt;/code&gt; transforms each k6 trend metric into four Prometheus metrics as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;k6_*_p95&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k6_*_p99&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k6_*_max&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k6_*_min&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="grafana-cloud-prometheus">Grafana Cloud Prometheus&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>This page includes instructions for running a local test that sends the test results to a Prometheus instance in Grafana Cloud.&lt;/p></description></item><item><title>InfluxDB</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/influxdb/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/influxdb/</guid><content><![CDATA[&lt;h1 id=&#34;influxdb&#34;&gt;InfluxDB&lt;/h1&gt;
&lt;p&gt;k6 supports sending output metrics to InfluxDB v1.0 and v2.0.&lt;/p&gt;
&lt;h2 id=&#34;send-k6-metrics-to-influxdb-v10&#34;&gt;Send k6 metrics to InfluxDB v1.0&lt;/h2&gt;
&lt;p&gt;k6 has built-in support to send metrics to InfluxDB v1.0.&lt;/p&gt;
&lt;p&gt;You can use the &lt;code&gt;--out&lt;/code&gt; flag with the &lt;code&gt;influxdb&lt;/code&gt; option:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out influxdb=http://localhost:8086/myk6db script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The example command makes k6 connect to a local InfluxDB instance and send the results from the test to a database named &lt;code&gt;myk6db&lt;/code&gt;. If the database doesn&amp;rsquo;t exist, k6 creates one automatically.&lt;/p&gt;
&lt;h3 id=&#34;use-a-url-path-prefix&#34;&gt;Use a URL path prefix&lt;/h3&gt;
&lt;p&gt;A reverse proxy can expose several InfluxDB instances under one hostname, using a different path prefix for each instance. Include that prefix before the database name to send metrics to the correct instance with the built-in InfluxDB v1 output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;k6 run --out influxdb=https://influxdb.example.com/influxdb/myk6db script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace &lt;code&gt;https://influxdb.example.com/influxdb&lt;/code&gt; with your InfluxDB address and path prefix, &lt;code&gt;myk6db&lt;/code&gt; with your database name, and &lt;code&gt;script.js&lt;/code&gt; with your test script.&lt;/p&gt;
&lt;p&gt;k6 uses the final URL path segment as the database name and preserves the preceding path as the address prefix. In this example, k6 sends metrics to &lt;code&gt;/influxdb/write&lt;/code&gt; for the &lt;code&gt;myk6db&lt;/code&gt; database.&lt;/p&gt;
&lt;p&gt;A trailing slash means that the entire path is the prefix and the URL does not specify a database name. For example, &lt;code&gt;https://influxdb.example.com/influxdb/&lt;/code&gt; uses &lt;code&gt;/influxdb&lt;/code&gt; as the prefix and keeps the database configured through other options, or the default &lt;code&gt;k6&lt;/code&gt; database.&lt;/p&gt;
&lt;h2 id=&#34;send-k6-metrics-to-influxdb-v20&#34;&gt;Send k6 metrics to InfluxDB v2.0&lt;/h2&gt;
&lt;p&gt;Using the &lt;a href=&#34;https://github.com/grafana/xk6-output-influxdb&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB extension&lt;/a&gt;, you can store k6 metrics in &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.0/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB v2.0&lt;/a&gt; and analyze your performance results with Grafana or &lt;a href=&#34;https://docs.influxdata.com/influxdb/cloud-serverless/query-data/tools/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;other tools&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;build-the-k6-version&#34;&gt;Build the k6 version&lt;/h3&gt;
&lt;p&gt;To build a k6 binary with the extension, first, make sure you have &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt; installed on your machine.&lt;/p&gt;
&lt;p&gt;Then, open your terminal and run the following commands:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build the k6 binary
xk6 build --with github.com/grafana/xk6-output-influxdb

... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;xk6 will create the new k6 binary in the local folder.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To learn more about how to build custom k6 versions, check out &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;run-the-test&#34;&gt;Run the test&lt;/h3&gt;
&lt;p&gt;Check that the InfluxDB instance to store the k6 metrics is running.&lt;/p&gt;
&lt;p&gt;Use the previous k6 binary and run the test passing the following &lt;a href=&#34;#options&#34;&gt;options&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_INFLUXDB_ORGANIZATION=&amp;#34;&amp;lt;INFLUXDB-ORGANIZATION-NAME&amp;gt;&amp;#34; \
K6_INFLUXDB_BUCKET=&amp;#34;&amp;lt;INFLUXDB-BUCKET-NAME&amp;gt;&amp;#34; \
K6_INFLUXDB_TOKEN=&amp;#34;&amp;lt;INFLUXDB-TOKEN&amp;gt;&amp;#34; \
K6_INFLUXDB_ADDR=&amp;#34;&amp;lt;INFLUXDB-HTTP-ADDRESS&amp;gt;&amp;#34; \
./k6 run script.js -o xk6-influxdb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;k6 runs the test script and sends the 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 metrics&lt;/a&gt; in real-time to the InfluxDB instance. You can now select the bucket to &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/query-data/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;query&lt;/a&gt; and &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/visualize-data/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;visualize&lt;/a&gt; the stored k6 metrics, for example, using the &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/query-data/execute-queries/data-explorer/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB Data Explorer&lt;/a&gt;.&lt;/p&gt;
&lt;br/&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/influxdb-data-explorer-k6-bucket.png&#34;
  alt=&#34;InfluxDB Data Explorer / k6 bucket&#34; width=&#34;1352&#34;
     height=&#34;845&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;options&#34;&gt;Options&lt;/h3&gt;
&lt;p&gt;Here is the full list of options that can be configured and passed to the extension:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;ENV&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_ORGANIZATION&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;Your InfluxDB organization name. &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/organizations/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;View organizations&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_BUCKET&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;The bucket name to store k6 metrics data. &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/organizations/buckets/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Manage buckets&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_TOKEN&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;An API token that provides authorized access to store data. &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/security/tokens/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Manage API tokens&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_ADDR&lt;/td&gt;
              &lt;td&gt;http://localhost:8086&lt;/td&gt;
              &lt;td&gt;The address of the InfluxDB instance.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_PUSH_INTERVAL&lt;/td&gt;
              &lt;td&gt;1s&lt;/td&gt;
              &lt;td&gt;The flush&amp;rsquo;s frequency of the &lt;code&gt;k6&lt;/code&gt; metrics.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_CONCURRENT_WRITES&lt;/td&gt;
              &lt;td&gt;4&lt;/td&gt;
              &lt;td&gt;Number of concurrent requests for flushing data. It is useful when a request takes more than the expected time (more than flush interval).&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_TAGS_AS_FIELDS&lt;/td&gt;
              &lt;td&gt;vu:int,iter:int,url&lt;/td&gt;
              &lt;td&gt;A comma-separated string to set &lt;code&gt;k6&lt;/code&gt; metrics as non-indexable fields (instead of tags). An optional type can be specified using :type as in vu:int will make the field integer. The possible field types are int, bool, float and string, which is the default. Example: vu:int,iter:int,url:string,event_time:int.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_INSECURE&lt;/td&gt;
              &lt;td&gt;false&lt;/td&gt;
              &lt;td&gt;When &lt;code&gt;true&lt;/code&gt;, it will skip &lt;code&gt;https&lt;/code&gt; certificate verification.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_PRECISION&lt;/td&gt;
              &lt;td&gt;1ns&lt;/td&gt;
              &lt;td&gt;The timestamp &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/reference/glossary/#precision&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Precision&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;K6_INFLUXDB_HTTP_PROXY&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;Sets an HTTP proxy for the InfluxDB output.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;grafana-dashboards&#34;&gt;Grafana Dashboards&lt;/h3&gt;
&lt;p&gt;You can use Grafana to query and visualize data from an InfluxDB instance. The instructions are available on &lt;a href=&#34;https://docs.influxdata.com/influxdb/v2.7/tools/grafana/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB&lt;/a&gt; and &lt;a href=&#34;/docs/grafana/latest/datasources/influxdb/&#34;&gt;Grafana&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can also build a 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/grafana-dashboards/&#34;&gt;custom Grafana dashboard&lt;/a&gt; to visualize the testing results in your own way.&lt;/p&gt;
&lt;p&gt;For testing purposes, the &lt;a href=&#34;https://github.com/grafana/xk6-output-influxdb&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;InfluxDB extension&lt;/a&gt; repository includes a &lt;a href=&#34;https://github.com/grafana/xk6-output-influxdb#docker-compose&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;docker-compose setup&lt;/a&gt; with two basic dashboards.&lt;/p&gt;
]]></content><description>&lt;h1 id="influxdb">InfluxDB&lt;/h1>
&lt;p>k6 supports sending output metrics to InfluxDB v1.0 and v2.0.&lt;/p>
&lt;h2 id="send-k6-metrics-to-influxdb-v10">Send k6 metrics to InfluxDB v1.0&lt;/h2>
&lt;p>k6 has built-in support to send metrics to InfluxDB v1.0.&lt;/p></description></item><item><title>JSON</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/json/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/json/</guid><content><![CDATA[&lt;h1 id=&#34;json&#34;&gt;JSON&lt;/h1&gt;
&lt;p&gt;You can output granular data points in JSON format.
To do so, use &lt;code&gt;k6 run&lt;/code&gt; with the &lt;code&gt;--out&lt;/code&gt; flag.
Pass the path for your JSON file as the flag argument:&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;bash&amp;#34;,&amp;#34;docker&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;bash&#39; }&#34; @click=&#34;$store.code.language = &#39;bash&#39;&#34;&gt;
              &lt;span&gt;Bash&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;docker&#39; }&#34; @click=&#34;$store.code.language = &#39;docker&#39;&#34;&gt;
              &lt;span&gt;docker&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @click=&#34;copy()&#34;&gt;
            &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
            &lt;span&gt;Copy&lt;/span&gt;
          &lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class=&#34;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#34; &gt;
      
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out json=test_results.json script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;docker&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-docker&#34;&gt;docker run -it --rm \
    -v &amp;lt;scriptdir&amp;gt;:/scripts \
    -v &amp;lt;outputdir&amp;gt;:/jsonoutput \
    grafana/k6 run --out json=/jsonoutput/my_test_result.json /scripts/script.js

# Note that the docker user must have permission to write to &amp;lt;outputdir&amp;gt;!&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;Or if you want to get the result gzipped, like this:&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;bash&amp;#34;,&amp;#34;docker&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;bash&#39; }&#34; @click=&#34;$store.code.language = &#39;bash&#39;&#34;&gt;
              &lt;span&gt;Bash&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;docker&#39; }&#34; @click=&#34;$store.code.language = &#39;docker&#39;&#34;&gt;
              &lt;span&gt;docker&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @click=&#34;copy()&#34;&gt;
            &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
            &lt;span&gt;Copy&lt;/span&gt;
          &lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class=&#34;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#34; &gt;
      
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out json=test_results.gz script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;docker&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-docker&#34;&gt;docker run -it --rm \
    -v &amp;lt;scriptdir&amp;gt;:/scripts \
    -v &amp;lt;outputdir&amp;gt;:/jsonoutput \
    grafana/k6 run --out json=/jsonoutput/my_test_result.gz /scripts/script.js

# Note that the docker user must have permission to write to &amp;lt;outputdir&amp;gt;!&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;To inspect the output in real time, you can use a command like &lt;code&gt;tail -f&lt;/code&gt; on the file you save:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;tail -f test_results.json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;json-format&#34;&gt;JSON format&lt;/h2&gt;
&lt;p&gt;The JSON output has lines as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{&amp;#34;type&amp;#34;:&amp;#34;Metric&amp;#34;,&amp;#34;data&amp;#34;:{&amp;#34;type&amp;#34;:&amp;#34;gauge&amp;#34;,&amp;#34;contains&amp;#34;:&amp;#34;default&amp;#34;,&amp;#34;tainted&amp;#34;:null,&amp;#34;thresholds&amp;#34;:[],&amp;#34;submetrics&amp;#34;:null},&amp;#34;metric&amp;#34;:&amp;#34;vus&amp;#34;}
{&amp;#34;type&amp;#34;:&amp;#34;Point&amp;#34;,&amp;#34;data&amp;#34;:{&amp;#34;time&amp;#34;:&amp;#34;2017-05-09T14:34:45.625742514&amp;#43;02:00&amp;#34;,&amp;#34;value&amp;#34;:5,&amp;#34;tags&amp;#34;:null},&amp;#34;metric&amp;#34;:&amp;#34;vus&amp;#34;}
{&amp;#34;type&amp;#34;:&amp;#34;Metric&amp;#34;,&amp;#34;data&amp;#34;:{&amp;#34;type&amp;#34;:&amp;#34;trend&amp;#34;,&amp;#34;contains&amp;#34;:&amp;#34;time&amp;#34;,&amp;#34;tainted&amp;#34;:null,&amp;#34;thresholds&amp;#34;:[&amp;#34;avg&amp;lt;1000&amp;#34;],&amp;#34;submetrics&amp;#34;:null},&amp;#34;metric&amp;#34;:&amp;#34;http_req_duration&amp;#34;}
{&amp;#34;type&amp;#34;:&amp;#34;Point&amp;#34;,&amp;#34;data&amp;#34;:{&amp;#34;time&amp;#34;:&amp;#34;2017-05-09T14:34:45.239531499&amp;#43;02:00&amp;#34;,&amp;#34;value&amp;#34;:459.865729,&amp;#34;tags&amp;#34;:{&amp;#34;group&amp;#34;:&amp;#34;::my group::json&amp;#34;,&amp;#34;method&amp;#34;:&amp;#34;GET&amp;#34;,&amp;#34;status&amp;#34;:&amp;#34;200&amp;#34;,&amp;#34;url&amp;#34;:&amp;#34;https://quickpizza.grafana.com/api/tools&amp;#34;}},&amp;#34;metric&amp;#34;:&amp;#34;http_req_duration&amp;#34;}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Each line either has information about a metric, or logs a data point (sample) for a metric.
Lines consist of three items:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;type&lt;/code&gt; - can have the values &lt;a href=&#34;#metric&#34;&gt;Metric&lt;/a&gt; or &lt;a href=&#34;#point&#34;&gt;Point&lt;/a&gt; where &lt;code&gt;Metric&lt;/code&gt; means the line is declaring a metric, and &lt;code&gt;Point&lt;/code&gt; is an actual data point (sample) for a metric.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;data&lt;/code&gt; - is a dictionary that contains lots of stuff, varying depending on the &lt;code&gt;&amp;quot;type&amp;quot;&lt;/code&gt; above.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;metric&lt;/code&gt; - the name of the metric.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;metric&#34;&gt;Metric&lt;/h3&gt;
&lt;p&gt;This line has metadata about a metric. Here, &lt;code&gt;&amp;quot;data&amp;quot;&lt;/code&gt; contains the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;type&amp;quot;&lt;/code&gt; - the metric type (&amp;ldquo;gauge&amp;rdquo;, &amp;ldquo;rate&amp;rdquo;, &amp;ldquo;counter&amp;rdquo; or &amp;ldquo;trend&amp;rdquo;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;contains&amp;quot;&lt;/code&gt; - information on the type of data collected (can e.g. be &amp;ldquo;time&amp;rdquo; for timing metrics)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;tainted&amp;quot;&lt;/code&gt; - has this metric caused a threshold to fail?&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;threshold&amp;quot;&lt;/code&gt; - are there any thresholds attached to this metric?&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;submetrics&amp;quot;&lt;/code&gt; - any derived metrics created as a result of adding a threshold using tags.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;point&#34;&gt;Point&lt;/h3&gt;
&lt;p&gt;This line has actual data samples. Here, &lt;code&gt;&amp;quot;data&amp;quot;&lt;/code&gt; contains these fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;time&amp;quot;&lt;/code&gt; - timestamp when the sample was collected&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;value&amp;quot;&lt;/code&gt; - the actual data sample; time values are in milliseconds&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;tags&amp;quot;&lt;/code&gt; - dictionary with tagname-tagvalue pairs that can be used when filtering results data&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;processing-json-output&#34;&gt;Processing JSON output&lt;/h2&gt;
&lt;p&gt;You can use &lt;a href=&#34;https://stedolan.github.io/jq/&#34; title=&#34;jq_url&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;jq&lt;/a&gt; to process the k6 JSON output.&lt;/p&gt;
&lt;p&gt;You can quickly create &lt;a href=&#34;https://stedolan.github.io/jq/manual/#Basicfilters&#34; title=&#34;jq_filters_url&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;filters&lt;/a&gt; to return a particular metric of the JSON file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;jq &amp;#39;. | select(.type==&amp;#34;Point&amp;#34; and .metric == &amp;#34;http_req_duration&amp;#34; and .data.tags.status &amp;gt;= &amp;#34;200&amp;#34;)&amp;#39; myscript-output.json&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And calculate an aggregated value of any metric:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;jq &amp;#39;. | select(.type==&amp;#34;Point&amp;#34; and .metric == &amp;#34;http_req_duration&amp;#34; and .data.tags.status &amp;gt;= &amp;#34;200&amp;#34;) | .data.value&amp;#39; myscript-output.json | jq -s &amp;#39;add/length&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;jq &amp;#39;. | select(.type==&amp;#34;Point&amp;#34; and .metric == &amp;#34;http_req_duration&amp;#34; and .data.tags.status &amp;gt;= &amp;#34;200&amp;#34;) | .data.value&amp;#39; myscript-output.json | jq -s min&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;jq &amp;#39;. | select(.type==&amp;#34;Point&amp;#34; and .metric == &amp;#34;http_req_duration&amp;#34; and .data.tags.status &amp;gt;= &amp;#34;200&amp;#34;) | .data.value&amp;#39; myscript-output.json | jq -s max&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more advanced cases, check out the &lt;a href=&#34;https://stedolan.github.io/jq/manual/&#34; title=&#34;jq_manual_url&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;jq Manual&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;summary-export&#34;&gt;Summary export&lt;/h2&gt;
&lt;p&gt;If you want to see only the aggregated data, you can export the end-of-test summary to a JSON file.
For more details, refer to the &lt;code&gt;handleSummary()&lt;/code&gt; topic in the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/end-of-test/&#34;&gt;end-of-test summary docs&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;read-more&#34;&gt;Read more&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;Metrics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="json">JSON&lt;/h1>
&lt;p>You can output granular data points in JSON format.
To do so, use &lt;code>k6 run&lt;/code> with the &lt;code>--out&lt;/code> flag.
Pass the path for your JSON file as the flag argument:&lt;/p></description></item><item><title>Netdata</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/netdata/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/netdata/</guid><content><![CDATA[&lt;h1 id=&#34;netdata&#34;&gt;Netdata&lt;/h1&gt;


&lt;div data-shared=&#34;statsd-output.md&#34;&gt;
            

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;, or using the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/opentelemetry/&#34;&gt;OpenTelemetry output&lt;/a&gt; depending on your use case.&lt;/p&gt;
&lt;p&gt;For more information on the reason behind this change, you can follow &lt;a href=&#34;https://github.com/grafana/k6/issues/2982&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this issue&lt;/a&gt; in the k6 repository.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;p&gt;k6 can send performance testing metrics to &lt;a href=&#34;https://netdata.cloud&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Netdata&lt;/a&gt;. This enables the user to start monitoring their k6 experiments right away, as Netdata is a monitoring tool with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Auto-configuration and auto-detection of data sources&lt;/li&gt;
&lt;li&gt;Automatic organization of metrics into &lt;strong&gt;meaningful&lt;/strong&gt; charts and visualization&lt;/li&gt;
&lt;li&gt;Per-second metric granularity&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use the StatsD output option, you have to build a k6 binary using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;. For more details, refer to 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;run-netdata&#34;&gt;Run Netdata&lt;/h2&gt;
&lt;p&gt;Netdata runs on many different systems and platforms. The easiest way to download and run Netdata is through the &lt;code&gt;kickstart&lt;/code&gt; script:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;bash &amp;lt;(curl -Ss https://my-netdata.io/kickstart.sh)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Alternatively, you can read more about installing and running Netdata in their &lt;a href=&#34;https://learn.netdata.cloud/docs/get-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;setup-netdata-for-k6&#34;&gt;Setup Netdata for K6&lt;/h2&gt;
&lt;p&gt;Netdata runs a fully functional &lt;a href=&#34;https://github.com/netdata/netdata/blob/master/collectors/statsd.plugin/README.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;StatsD&lt;/a&gt; server by default and we have included a default configuration file for k6 metrics.&lt;/p&gt;
&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run --out output-statsd script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Make sure you&amp;rsquo;re using the k6 binary you built with the xk6-output-statsd extension.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt;: By default, Netdata binds the StatsD server to &lt;code&gt;localhost&lt;/code&gt;. That means that if Netdata and k6 are in different hosts, you will need to edit the configuration file of Netdata.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Visit the &lt;a href=&#34;https://github.com/netdata/netdata/blob/master/collectors/statsd.plugin/README.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;StatsD documentation&lt;/a&gt; for a reference on the configuration options. We are interested in the &lt;code&gt;#bind to&lt;/code&gt; option.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;sudo ./edit-config netdata.conf&lt;/code&gt; from inside the directory where Netdata stores its configuration files (e.g &lt;code&gt;/etc/netdata/&lt;/code&gt;) and add &lt;code&gt;bind to=udp:0.0.0.0:8125&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;visualize-in-netdata&#34;&gt;Visualize in Netdata&lt;/h2&gt;
&lt;p&gt;Netdata will automatically create charts for your application, as illustrated in the &lt;a href=&#34;https://github.com/netdata/netdata/blob/master/collectors/statsd.plugin/k6.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Simply head over to &lt;code&gt;localhost:19999&lt;/code&gt; (assuming that you are running Netdata on the same machine) and find the k6 section. If you had opened Netdata before running the experiment, you will need to refresh the dashboard page.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/netdata-k6-dashboard.png&#34;
  alt=&#34;Netdata k6 dashboard&#34; width=&#34;1674&#34;
     height=&#34;1801&#34;/&gt;&lt;/p&gt;
]]></content><description>&lt;h1 id="netdata">Netdata&lt;/h1>
&lt;div data-shared="statsd-output.md">
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href="https://github.com/LeonAdato/xk6-output-statsd" target="_blank" rel="noopener noreferrer">xk6-output-statsd extension&lt;/a>, or using the
&lt;a href="/docs/k6/v2.3.x/results-output/real-time/opentelemetry/">OpenTelemetry output&lt;/a> depending on your use case.&lt;/p></description></item><item><title>New Relic</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/new-relic/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/new-relic/</guid><content><![CDATA[&lt;h1 id=&#34;new-relic&#34;&gt;New Relic&lt;/h1&gt;


&lt;div data-shared=&#34;statsd-output.md&#34;&gt;
            

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;, or using the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/opentelemetry/&#34;&gt;OpenTelemetry output&lt;/a&gt; depending on your use case.&lt;/p&gt;
&lt;p&gt;For more information on the reason behind this change, you can follow &lt;a href=&#34;https://github.com/grafana/k6/issues/2982&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this issue&lt;/a&gt; in the k6 repository.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;p&gt;k6 can send telemetry data to &lt;a href=&#34;https://newrelic.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;New Relic&lt;/a&gt; through the New Relic &lt;a href=&#34;https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/statsd-monitoring-integration-version-2&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;StatsD integration&lt;/a&gt;. Within New Relic you can find your k6 performance data alongside your real users data and server side performance. This data can be visualized in dashboards and shared with others, used to compare load impact with system performance, and alert on metrics too.&lt;/p&gt;
&lt;p&gt;This guide covers running the New Relic integration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run the New Relic StatsD integration&lt;/li&gt;
&lt;li&gt;Run the k6 test&lt;/li&gt;
&lt;li&gt;Visualize k6 telemetry in New Relic&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use the StatsD output option, you have to build a k6 binary using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;. For more details, refer to 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;run-the-new-relic-statsd-integration&#34;&gt;Run the New Relic StatsD integration&lt;/h2&gt;
&lt;p&gt;To get k6 metrics into New Relic, k6 sends metrics to the New Relic StatsD integration which will take care of collecting, aggregate, format and send the telemetry to the New Relic Telemetry Data Platform. You can run this with or without a New Relic agent.&lt;/p&gt;
&lt;p&gt;Run the New Relic integration as a Docker container with this command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;docker run --rm \
  -d \
  --name newrelic-statsd \
  -h $(hostname) \
  -e NR_ACCOUNT_ID=&amp;lt;NR-ACCOUNT-ID&amp;gt; \
  -e NR_API_KEY=&amp;#34;&amp;lt;NR-INSERT-API-KEY&amp;gt;&amp;#34; \
  -p 8125:8125/udp \
  newrelic/nri-statsd:latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace &lt;code&gt;&amp;lt;NR-ACCOUNT-ID&amp;gt;&lt;/code&gt; with your &lt;a href=&#34;https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/account-id#:~:text=If%20you%20have%20a%20single,account%20ID%20is%20displayed%20there.&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;New Relic Account ID&lt;/a&gt; and &lt;code&gt;&amp;lt;NR-INSERT-API-KEY&amp;gt;&lt;/code&gt; with your &lt;a href=&#34;https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/introduction-event-api#register&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;New Relic Insert API Key&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If your account is hosted in the New Relic EU region, then also add this to the above command: &lt;code&gt;-e NR_EU_REGION=true \&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;required&lt;/em&gt; environment variables used in the above command are:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;NR_ACCOUNT_ID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Account ID used in New Relic You can find your account ID &lt;a href=&#34;https://docs.newrelic.com/docs/accounts/accounts-billing/account-setup/account-id#:~:text=If%20you%20have%20a%20single,account%20ID%20is%20displayed%20there.&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;here&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;NR_API_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The Insert API Key for your New Relic account to send k6 telemetry to the account ID specified above. You can generate an Insert API key &lt;a href=&#34;https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/introduction-event-api#register&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;here&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;em&gt;Optional&lt;/em&gt; environment variables you can use:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;NR_EU_REGION&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Setting this to &lt;code&gt;true&lt;/code&gt; tells the integration your account is housed in the New Relic EU region.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;TAGS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Setting tags in key:value format separated by a space lets you further understand your data in New Relic. For example identifying different test runs or machines running the tests. In the docker command add: &lt;code&gt;-e TAGS=&amp;quot;k6Test:myExampleTest someKey:someValue&amp;quot; \&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;NR_LOG_METRICS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Setting this to &lt;code&gt;true&lt;/code&gt; activates verbose logging for the integration.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;about-the-new-relic-integration&#34;&gt;About the New Relic integration&lt;/h3&gt;
&lt;p&gt;The New Relic StatsD integration installed above can run standalone. Installing a New Relic agent is optional.&lt;/p&gt;
&lt;p&gt;Everything provided in the command above is enough to send k6 performance metrics to New Relic. You can optionally however &lt;a href=&#34;https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/statsd-monitoring-integration-version-2#configure&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;add further configuration&lt;/a&gt;, &lt;a href=&#34;https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/statsd-monitoring-integration-version-2#metric-format&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;further define metrics and their formats&lt;/a&gt; (you can however do this on the New Relic side configuration), &lt;a href=&#34;https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/statsd-monitoring-integration-version-2#add-tags&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;add custom tags&lt;/a&gt;, and &lt;a href=&#34;https://docs.newrelic.com/docs/integrations/host-integrations/host-integrations-list/statsd-monitoring-integration-version-2#alerts&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;create alerts&lt;/a&gt;. This is covered in the optional table below.&lt;/p&gt;
&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;
&lt;p&gt;Once the integration is running, run the k6 test and send the metrics to the integration with:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_STATSD_ENABLE_TAGS=true k6 run --out output-statsd script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Make sure you&amp;rsquo;re using the k6 binary you built with the xk6-output-statsd extension.&lt;/p&gt;
&lt;p&gt;You can look at the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/statsd/&#34;&gt;StatsD&lt;/a&gt; output page for configuration options.&lt;/p&gt;
&lt;h2 id=&#34;visualisation-in-new-relic&#34;&gt;Visualisation in New Relic&lt;/h2&gt;
&lt;p&gt;As your k6 test is running, k6 is sending performance metrics to the New Relic StatsD integration which in turn is sending these metrics to the New Relic Telemetry Data Platform. These will be prefixed with &lt;code&gt;k6.&lt;/code&gt; so you can identify them.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/new-relic-data-explorer.png&#34;
  alt=&#34;k6 metrics as seen in the New Relic data explorer&#34; width=&#34;3520&#34;
     height=&#34;1908&#34;/&gt;&lt;/p&gt;
&lt;p&gt;You can visualize the metrics sent from this integration in the &lt;a href=&#34;https://docs.newrelic.com/docs/insights/use-insights-ui/explore-data/metric-explorer-search-chart-metrics-sent-new-relic-agents&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;data explorer&lt;/a&gt; in the top right of New Relic (&lt;em&gt;query your data&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/new-relic-dashboard.png&#34;
  alt=&#34;Sample New Relic k6 dashboard&#34; width=&#34;3250&#34;
     height=&#34;2480&#34;/&gt;&lt;/p&gt;
&lt;p&gt;You can also add these metrics to &lt;a href=&#34;https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/introduction-new-relic-one-dashboards&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;dashboards&lt;/a&gt; and &lt;a href=&#34;https://docs.newrelic.com/docs/alerts-applied-intelligence/new-relic-alerts/alert-conditions/create-nrql-alert-conditions&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;alert on k6 metrics&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;example-nrql-queries&#34;&gt;Example NRQL Queries&lt;/h3&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;New Relic doesn&amp;rsquo;t support calculating percentiles from metric data, which is the data format sent by this k6 output. See &lt;a href=&#34;https://discuss.newrelic.com/t/percentiles-of-values-from-metrics-api-with-nrql-not-working/95832&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this New Relic forum post&lt;/a&gt; and &lt;a href=&#34;https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/query-metric-data-type/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;the documentation about the metric data type&lt;/a&gt; for details.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Here are some example NRQL queries you can easily copy and paste into widgets in a New Relic dashboard, you can however stick with the &lt;a href=&#34;https://docs.newrelic.com/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;chart builder&lt;/a&gt;. Find all your k6 Metrics under the metrics tab, prefixed with &lt;code&gt;k6.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Number of Virtual Users&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT latest(k6.vus) FROM Metric TIMESERIES&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Max, Median, and Average Request Duration&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT max(k6.http_req_duration.summary) AS &amp;#39;Max Duration&amp;#39;, average(k6.http_req_duration.median) AS &amp;#39;Median&amp;#39;, average(k6.http_req_duration.mean) AS &amp;#39;Avg&amp;#39; FROM Metric TIMESERIES&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Rate of Requests&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT rate(max(k6.http_reqs), 1 seconds) FROM Metric TIMESERIES&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Data Sent and Data Received&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT sum(k6.data_received) as &amp;#39;Data Received&amp;#39;, max(k6.data_sent) AS &amp;#39;Data Sent&amp;#39; FROM Metric TIMESERIES&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Histogram bucketing Requests&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT histogram(`k6.http_reqs`, 80, 20) FROM Metric&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Change in the number of Requests&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT derivative(k6.http_reqs, 30 seconds) AS &amp;#39;Rate /reqs&amp;#39; FROM Metric TIMESERIES&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Scrolling List of all k6 Performance Metrics&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;plain&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-plain&#34;&gt;SELECT uniques(metricName) FROM Metric WHERE metricName LIKE &amp;#39;k6%&amp;#39; LIMIT MAX&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="new-relic">New Relic&lt;/h1>
&lt;div data-shared="statsd-output.md">
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href="https://github.com/LeonAdato/xk6-output-statsd" target="_blank" rel="noopener noreferrer">xk6-output-statsd extension&lt;/a>, or using the
&lt;a href="/docs/k6/v2.3.x/results-output/real-time/opentelemetry/">OpenTelemetry output&lt;/a> depending on your use case.&lt;/p></description></item><item><title>OpenTelemetry</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/opentelemetry/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/opentelemetry/</guid><content><![CDATA[&lt;h1 id=&#34;opentelemetry&#34;&gt;OpenTelemetry&lt;/h1&gt;
&lt;p&gt;Grafana k6 can push test run metrics in the &lt;a href=&#34;https://opentelemetry.io/docs/specs/otel/metrics/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry (OTEL) metrics format&lt;/a&gt; to an OTEL metrics collector or a metrics backend that supports the OTEL metrics format by using the OpenTelemetry output &lt;code&gt;--out opentelemetry&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For any feedback, bugs or suggestions feel free to &lt;a href=&#34;https://github.com/grafana/k6/issues&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;open an issue&lt;/a&gt; directly in the k6 repository. Contributions are also welcome!&lt;/p&gt;
&lt;h2 id=&#34;metrics-mapping&#34;&gt;Metrics mapping&lt;/h2&gt;
&lt;p&gt;k6 converts all 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 metric types&lt;/a&gt; to an equivalent &lt;a href=&#34;https://opentelemetry.io/docs/specs/otel/metrics/data-model/#timeseries-model&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OTEL metric type&lt;/a&gt;, and all k6 tags to OTEL attributes. When possible, the units are also passed with the metrics.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;k6 Metric&lt;/th&gt;
              &lt;th&gt;OpenTelemetry Metric&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;Float64CounterOption&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;Float64ObservableGauge&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Rate&lt;/td&gt;
              &lt;td&gt;Exported as a single &lt;code&gt;Int64Counter&lt;/code&gt; counter named &lt;code&gt;metric_name&lt;/code&gt; with an attribute &lt;code&gt;condition&lt;/code&gt; that can have two values: &lt;code&gt;zero&lt;/code&gt; and &lt;code&gt;nonzero&lt;/code&gt;. If you previously used the legacy pair-of-counters format (&lt;code&gt;metric_name.occurred&lt;/code&gt; / &lt;code&gt;metric_name.total&lt;/code&gt;), update your dashboards and queries to filter on the &lt;code&gt;condition&lt;/code&gt; attribute instead.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Trend&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;Float64Histogram&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;
&lt;p&gt;You can use the &lt;code&gt;--out opentelemetry&lt;/code&gt; option when running your tests to use this extension:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_OTEL_GRPC_EXPORTER_INSECURE=true K6_OTEL_METRIC_PREFIX=k6_ k6 run --tag test-id=123 -o opentelemetry examples/script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;configuration&#34;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;The following options can be configured:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_SERVICE_NAME&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The name of the service to use for the metrics exporting. Default value is &lt;code&gt;k6&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_SERVICE_VERSION&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The version of the service to use for the metrics exporting. Default is version of the k6, e.g. &lt;code&gt;v0.54.0&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_METRIC_PREFIX&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Metric prefix. Default is empty.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_FLUSH_INTERVAL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;How frequently to flush metrics from k6 metrics engine. Default is &lt;code&gt;1s&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_EXPORT_INTERVAL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the intervening time between metrics exports. Default is &lt;code&gt;10s&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_HEADERS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures headers in the W3C Correlation-Context format without additional semi-colon delimited metadata (i.e. &amp;ldquo;k1=v1,k2=v2&amp;rdquo;). Passes the headers to the exporter.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_TLS_INSECURE_SKIP_VERIFY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disables server certificate verification.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_TLS_CERTIFICATE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the path to the root CA certificate file for TLS credentials. If it is not provided but TLS is enabled then the host&amp;rsquo;s root CAs set is used.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_TLS_CLIENT_CERTIFICATE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the path to the client certificate file.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_TLS_CLIENT_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the path to the client key file.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_EXPORTER_PROTOCOL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the protocol of exporter to use. Valid options are &lt;code&gt;grpc&lt;/code&gt; and &lt;code&gt;http/protobuf&lt;/code&gt;. Default is &lt;code&gt;grpc&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_GRPC_EXPORTER_INSECURE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disables client transport security for the gRPC exporter.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_GRPC_EXPORTER_ENDPOINT&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the gRPC exporter endpoint. Default is &lt;code&gt;localhost:4317&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_HTTP_EXPORTER_INSECURE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disables client transport security for the HTTP exporter.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_HTTP_EXPORTER_ENDPOINT&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the HTTP exporter endpoint. Must be host and port only, without scheme. Default is &lt;code&gt;localhost:4318&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_HTTP_EXPORTER_URL_PATH&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configures the HTTP exporter path. Default is &lt;code&gt;/v1/metrics&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_HTTP_EXPORTER_USERNAME&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Username for HTTP Basic authentication on the HTTP exporter.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_OTEL_HTTP_EXPORTER_PASSWORD&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Password for HTTP Basic authentication on the HTTP exporter.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can also use the OpenTelemetry SDK configuration environment variables to configure the OpenTelemetry output, like the &lt;a href=&#34;https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc@v1.26.0&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;gRPC exporter configuration&lt;/a&gt;. The &lt;code&gt;K6_OTEL_*&lt;/code&gt; environment variables take precedence over the OpenTelemetry SDK configuration environment variables.&lt;/p&gt;
]]></content><description>&lt;h1 id="opentelemetry">OpenTelemetry&lt;/h1>
&lt;p>Grafana k6 can push test run metrics in the &lt;a href="https://opentelemetry.io/docs/specs/otel/metrics/" target="_blank" rel="noopener noreferrer">OpenTelemetry (OTEL) metrics format&lt;/a> to an OTEL metrics collector or a metrics backend that supports the OTEL metrics format by using the OpenTelemetry output &lt;code>--out opentelemetry&lt;/code>.&lt;/p></description></item><item><title>Prometheus remote write</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/prometheus-remote-write/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/prometheus-remote-write/</guid><content><![CDATA[&lt;h1 id=&#34;prometheus-remote-write&#34;&gt;Prometheus remote write&lt;/h1&gt;


&lt;div data-shared=&#34;experimental-module.md&#34;&gt;
            

&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;This is an experimental module.
&lt;br&gt;
&lt;br&gt;
While we intend to keep experimental modules as stable as possible, we may need to introduce breaking changes. This could happen at future k6 releases until the module becomes fully stable and graduates as a k6 core module. For more information, refer to the 
    &lt;a href=&#34;/docs/k6/v2.3.x/reference/versioning-and-stability-guarantees/#experimental&#34;&gt;versioning and stability guarantees document&lt;/a&gt;.
&lt;br&gt;
&lt;br&gt;
Experimental modules maintain a high level of stability and follow regular maintenance and security measures. Feel free to &lt;a href=&#34;https://github.com/grafana/k6/issues&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;open an issue&lt;/a&gt; if you have any feedback or suggestions.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;p&gt;&lt;a href=&#34;https://prometheus.io/docs/concepts/remote_write_spec/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus remote write&lt;/a&gt; is a protocol that makes it possible to reliably propagate data in real-time from a sender to a receiver.
It has multiple compatible &lt;a href=&#34;https://prometheus.io/docs/concepts/remote_write_spec/#compatible-senders-and-receivers&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;implementations&lt;/a&gt; and &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;storage integrations&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For instance, when using the &lt;code&gt;experimental-prometheus-rw&lt;/code&gt; output, k6 can send test-result metrics to the remote-write endpoint and store them in Prometheus.&lt;/p&gt;
&lt;p&gt;The output, during the &lt;code&gt;k6 run&lt;/code&gt; execution, gets all the generated time-series data points for the 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 metrics&lt;/a&gt;.
It then generates the equivalent Prometheus time series and sends them to the Prometheus remote write endpoint.&lt;/p&gt;
&lt;h2 id=&#34;metrics-mapping&#34;&gt;Metrics mapping&lt;/h2&gt;
&lt;p&gt;All 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 metric types&lt;/a&gt; are converted into an equivalent &lt;a href=&#34;https://prometheus.io/docs/concepts/metric_types/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus metric type&lt;/a&gt;.
The output maps the metrics into time series with Name labels.
As much as possible, k6 respects the &lt;a href=&#34;https://prometheus.io/docs/practices/naming&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;naming best practices&lt;/a&gt; that the Prometheus project defines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All time series are prefixed with the &lt;code&gt;k6_&lt;/code&gt; namespace.&lt;/li&gt;
&lt;li&gt;All time series are suffixed with the base unit of the sample value (if k6 knows what the base unit is).&lt;/li&gt;
&lt;li&gt;Trends and rates have the relative suffixes, to make them more discoverable.&lt;/li&gt;
&lt;/ul&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;k6&lt;/th&gt;
              &lt;th&gt;Prometheus&lt;/th&gt;
              &lt;th&gt;Name label&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Counter&lt;/td&gt;
              &lt;td&gt;Counter&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;k6_*_total&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Gauge&lt;/td&gt;
              &lt;td&gt;Gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;k6_*_&amp;lt;unit-suffix&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Rate&lt;/td&gt;
              &lt;td&gt;Gauge&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;k6_*_rate&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Trend&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;#1-counter-and-gauges&#34;&gt;Counter and Gauges (default)&lt;/a&gt; or &lt;a href=&#34;#2-prometheus-native-histogram&#34;&gt;Native Histogram&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;k6_*_&amp;lt;unit-suffix&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;trend-metric-conversions&#34;&gt;Trend metric conversions&lt;/h2&gt;
&lt;p&gt;This output provides two distinct mechanisms to send 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 Trend metrics&lt;/a&gt; to Prometheus:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;#1-counter-and-gauges&#34;&gt;Counter and Gauge metrics&lt;/a&gt; (default)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#2-prometheus-native-histogram&#34;&gt;Prometheus Native histogram&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Both options provide efficient storage of test results while providing high-precision queries.&lt;/p&gt;
&lt;p&gt;Note that k6 aggregates trend metric data before sending it to Prometheus in both options. The reasons for aggregating data are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Prometheus stores data in a millisecond precision (&lt;code&gt;ms&lt;/code&gt;), but k6 metrics collect data points with higher accuracy, nanosecond (&lt;code&gt;ns&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;A load test could generate vast amounts of data points. High-precision raw data could quickly become expensive and complex to scale and is unnecessary when analyzing performance trends.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;1-counter-and-gauges&#34;&gt;1. Counter and gauges&lt;/h3&gt;
&lt;p&gt;By default, Prometheus supports &lt;a href=&#34;https://prometheus.io/docs/concepts/metric_types/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Counter and Gauge Metric types&lt;/a&gt;. Therefore, this option is the default of this output and converts all the k6 &lt;code&gt;Trend&lt;/code&gt; metrics to Counter and Gauges Prometheus metrics.&lt;/p&gt;
&lt;p&gt;You can configure how to convert all the k6 trend metrics with the &lt;a href=&#34;#options&#34;&gt;&lt;code&gt;K6_PROMETHEUS_RW_TREND_STATS&lt;/code&gt; option&lt;/a&gt; that accepts a comma-separated list of stats functions: &lt;code&gt;count&lt;/code&gt;, &lt;code&gt;sum&lt;/code&gt;, &lt;code&gt;min&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt;, &lt;code&gt;avg&lt;/code&gt;, &lt;code&gt;med&lt;/code&gt;, &lt;code&gt;p(x)&lt;/code&gt;. The default is &lt;code&gt;p(99)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Given the list of stats functions, k6 converts all trend metrics to the respective math functions as Prometheus metrics.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;K6_PROMETHEUS_RW_TREND_STATS=p(90),p(95),max&lt;/code&gt; transforms each trend metric into three Prometheus metrics as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;k6_*_p90&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k6_*_p95&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k6_*_max&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This option provides a configurable solution to represent &lt;code&gt;Trend&lt;/code&gt; metrics in Prometheus but has the following drawbacks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Convert a k6 &lt;code&gt;Trend&lt;/code&gt; metric to several Prometheus metrics.&lt;/li&gt;
&lt;li&gt;It is impossible to aggregate some gauge values (especially percentiles).&lt;/li&gt;
&lt;li&gt;It uses a memory-expensive k6 data structure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-prometheus-native-histogram&#34;&gt;2. Prometheus native histogram&lt;/h3&gt;
&lt;p&gt;To address the limitations of the previous option, you can convert k6 trend metrics to high-fidelity histograms enabling &lt;a href=&#34;https://prometheus.io/docs/concepts/metric_types/#histogram&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus native histograms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With this option, each k6 trend metric maps to its corresponding Prometheus histogram metric: &lt;code&gt;k6_*&lt;/code&gt;. You can then query them using Prometheus histogram functions, such as &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;histogram_quantile()&lt;/a&gt;.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;🌟 To learn the benefits and outcomes of using Histograms, watch &lt;a href=&#34;https://www.youtube.com/watch?v=F72Tk8iaWeA&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;High-resolution Histograms in Prometheus&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;⚠️ Note that Native Histogram is an experimental feature released in Prometheus v2.40.0, and other remote write implementations might not support it yet. In the future, when Prometheus makes this feature stable, k6 will consider using it as the default conversion method for Trend metrics.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;send-test-metrics-to-a-remote-write-endpoint&#34;&gt;Send test metrics to a remote write endpoint&lt;/h2&gt;
&lt;p&gt;To use remote write in Prometheus 2.x, enable the feature flag &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/feature_flags/#remote-write-receiver&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&amp;ndash;web.enable-remote-write-receiver&lt;/a&gt;. For remote write storage options, refer to the &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus docs&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;To send k6 metrics to a &lt;strong&gt;remote write endpoint without native histograms&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Set up a running remote write endpoint and ensure k6 can reach it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run your k6 script with the &lt;code&gt;--out&lt;/code&gt; flag and the URL of the RW endpoint as follows:&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Trend stats&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;HTTP Basic Authentication&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
K6_PROMETHEUS_RW_USERNAME=USERNAME \
K6_PROMETHEUS_RW_PASSWORD=PASSWORD \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Optionally, pass the &lt;code&gt;K6_PROMETHEUS_RW_TREND_STATS&lt;/code&gt; to gain the ability to query additional stats for trend metrics. The default is &lt;code&gt;p(99)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),min,max \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To send k6 metrics to a &lt;strong&gt;remote write endpoint with native histograms&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Enable the feature flag &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/feature_flags/#native-histograms&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&amp;ndash;enable-feature=native-histograms&lt;/a&gt; in Prometheus 2.40.0 or higher. Set up a running remote write endpoint and ensure k6 can reach it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run your k6 script with the &lt;code&gt;--out&lt;/code&gt; flag, enabling the &lt;code&gt;K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM&lt;/code&gt; option, and the URL of the RW endpoint as follows:&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Native Histogram&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;HTTP Basic Authentication&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
K6_PROMETHEUS_RW_USERNAME=USERNAME \
K6_PROMETHEUS_RW_PASSWORD=PASSWORD \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When running the previous &lt;code&gt;k6 run&lt;/code&gt; commands, k6 starts sending time-series metrics to Prometheus.
All the time series have a &lt;a href=&#34;#metrics-mapping&#34;&gt;&lt;code&gt;k6_&lt;/code&gt; prefix&lt;/a&gt;.
In the Prometheus Web UI, they appear like this:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/query-k6-metrics-in-the-prometheus-web-ui.png&#34;
  alt=&#34;k6 metrics as seen in the Prometheus UI&#34; width=&#34;1437&#34;
     height=&#34;840&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;options&#34;&gt;Options&lt;/h2&gt;
&lt;p&gt;k6 has special options for remote write output.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_SERVER_URL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of the Prometheus remote write implementation&amp;rsquo;s endpoint. Default is &lt;code&gt;http://localhost:9090/api/v1/write&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_HEADERS_&amp;lt;header-key&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Additional header to include in the HTTP requests. It can be set using the described format, for example &lt;code&gt;K6_PROMETHEUS_RW_HEADERS_CUSTOM-HEADER-KEY=custom-header-value&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_HTTP_HEADERS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A comma-separated list of key-values&lt;/td&gt;
              &lt;td&gt;Additional headers to include in the HTTP requests. &lt;code&gt;K6_PROMETHEUS_RW_HTTP_HEADERS=key1:value1,key2:value2&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_LABELS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A comma-separated list of key-value pairs&lt;/td&gt;
              &lt;td&gt;Static labels to add to remote write time series, for example &lt;code&gt;environment=production,server=srv1&lt;/code&gt;. No additional labels by default. Refer to &lt;a href=&#34;#add-static-labels&#34;&gt;Add static labels&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_PUSH_INTERVAL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Interval between the metrics&amp;rsquo; aggregation and upload to the endpoint. Default is &lt;code&gt;5s&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If true, maps all the defined trend metrics as &lt;a href=&#34;#2-prometheus-native-histogram&#34;&gt;Native Histograms&lt;/a&gt;. Default is &lt;code&gt;false&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_TREND_STATS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;list of &lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If Native Histogram is not enabled, then it defines the stats functions to map for all of the defined trend metrics. It&amp;rsquo;s a comma-separated list of stats functions to include (e.g. &lt;code&gt;p(90),avg,sum&lt;/code&gt;). Check the trend section to see the list of supported stats. Default is &lt;code&gt;p(99)&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_INSECURE_SKIP_TLS_VERIFY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If true, the HTTP client skips TLS verification on the endpoint. Default is &lt;code&gt;false&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_TLS_MIN_VERSION&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the minimum TLS version used by the HTTP client. Available options: &lt;code&gt;1.2&lt;/code&gt; and &lt;code&gt;1.3&lt;/code&gt;. Default is &lt;code&gt;1.3&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_STALE_MARKERS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;boolean&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If true, the output at the end of the test marks all the seen time series as stale. Default is &lt;code&gt;false&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_USERNAME&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Username for the HTTP Basic authentication at the Prometheus remote write endpoint.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_PASSWORD&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Password for the HTTP Basic authentication at the Prometheus remote write endpoint.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_CLIENT_CERTIFICATE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A path to the PEM (Privacy-Enhanced Mail) formatted client certificate.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_CLIENT_CERTIFICATE_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A path to the PEM formatted client private key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_BEARER_TOKEN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the Authorization Bearer Token Header.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_SIGV4_REGION&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the AWS region where the workspace is. Along with the others &lt;code&gt;K6_PROMETHEUS_RW_SIGV4_*&lt;/code&gt; configurations enables signing requests.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_SIGV4_ACCESS_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the AWS access key.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_PROMETHEUS_RW_SIGV4_SECRET_KEY&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sets the AWS secret key.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;add-static-labels&#34;&gt;Add static labels&lt;/h3&gt;
&lt;p&gt;When several k6 processes send metrics to the same Prometheus endpoint, use a label such as &lt;code&gt;server&lt;/code&gt; or &lt;code&gt;job_id&lt;/code&gt; to distinguish their time series. Set a different value for each process or job that you want to identify separately. This lets you configure labels in your deployment or CI job without changing the test script.&lt;/p&gt;
&lt;p&gt;Set &lt;code&gt;K6_PROMETHEUS_RW_LABELS&lt;/code&gt; to add static labels to every time series sent to the remote write endpoint. Use a comma-separated list of &lt;code&gt;key=value&lt;/code&gt; pairs:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;K6_PROMETHEUS_RW_LABELS=&amp;#34;environment=production,server=srv1&amp;#34; \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace &lt;code&gt;script.js&lt;/code&gt; with your test script and configure your remote write endpoint as described in &lt;a href=&#34;#send-test-metrics-to-a-remote-write-endpoint&#34;&gt;Send test metrics to a remote write endpoint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can also set &lt;code&gt;collectors.experimental-prometheus-rw.labels&lt;/code&gt; in a JSON configuration file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
  &amp;#34;collectors&amp;#34;: {
    &amp;#34;experimental-prometheus-rw&amp;#34;: {
      &amp;#34;labels&amp;#34;: {
        &amp;#34;environment&amp;#34;: &amp;#34;production&amp;#34;,
        &amp;#34;server&amp;#34;: &amp;#34;srv1&amp;#34;
      }
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Save this as &lt;code&gt;config.json&lt;/code&gt; and run your test:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;k6 run --config config.json -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you configure the same label in both places, &lt;code&gt;K6_PROMETHEUS_RW_LABELS&lt;/code&gt; takes precedence over the JSON configuration.&lt;/p&gt;
&lt;p&gt;These labels apply only to the remote write output. Existing time-series labels, including labels from script tags, take precedence over static labels with the same name. k6 ignores labels with an empty name or value, and ignores the reserved &lt;code&gt;__name__&lt;/code&gt; label.&lt;/p&gt;
&lt;h3 id=&#34;stale-trend-metrics&#34;&gt;Stale trend metrics&lt;/h3&gt;
&lt;p&gt;This k6 output can mark the time series at the end of the test as stale.
To enable the stale marker option, set the &lt;code&gt;K6_PROMETHEUS_RW_STALE_MARKERS&lt;/code&gt; environment variable to &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;By default, the metrics are active for 5 minutes after the last flushed sample.
They are automatically marked as stale after.
For details about staleness, refer to the &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/basics/#staleness&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus docs&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;time-series-visualization&#34;&gt;Time series visualization&lt;/h2&gt;
&lt;p&gt;To visualize time series with Grafana, you can use the &lt;a href=&#34;/docs/grafana/latest/explore/&#34;&gt;Explore UI&lt;/a&gt; or import any of the existing pre-built dashboards:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/grafana/dashboards/19665-k6-prometheus/&#34;&gt;k6 Prometheus dashboard by Grafana k6&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/grafana/dashboards/18030-k6-prometheus-native-histograms/&#34;&gt;k6 Prometheus (Native Histograms) dashboard by Grafana k6&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/grafana/dashboards/?search=k6&amp;amp;dataSource=prometheus&#34;&gt;Other public dashboards available from the community&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are a Grafana Cloud user, please refer to the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/grafana-cloud-prometheus/&#34;&gt;Grafana Cloud Prometheus docs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For a local environment, the &lt;a href=&#34;https://github.com/grafana/xk6-output-prometheus-remote&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;xk6-output-prometheus-remote&lt;/code&gt; repository&lt;/a&gt; includes a docker-compose setup that provisions the &lt;code&gt;k6 Prometheus&lt;/code&gt; and &lt;code&gt;k6 Prometheus (Native Histograms)&lt;/code&gt; dashboards:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/list-provisioned-prometheus-dashboards.png&#34;
  alt=&#34;Provisioned k6 Prometheus Dashboards&#34; width=&#34;2494&#34;
     height=&#34;814&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;docker-compose-example&#34;&gt;Docker compose example&lt;/h3&gt;
&lt;p&gt;Clone the repository to get started and follow these steps for using the &lt;a href=&#34;https://github.com/grafana/xk6-output-prometheus-remote/blob/main/docker-compose.yml&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;docker-compose.yml&lt;/a&gt; file that starts &lt;em&gt;Prometheus&lt;/em&gt; and &lt;em&gt;Grafana&lt;/em&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Start the docker compose environment.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;docker compose up -d prometheus grafana&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;# Output
Creating xk6-output-prometheus-remote_grafana_1     ... done
Creating xk6-output-prometheus-remote_prometheus_1  ... done&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Prometheus is started with Native Histogram enabled. You can use the same Prometheus instance to receive k6 trend metrics as native histograms or multiple metric stats.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the k6 test with one of the options detailed on &lt;a href=&#34;#send-test-metrics-to-a-remote-write-endpoint&#34;&gt;Send test metrics to a remote write endpoint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Trend stats&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),min,max \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Native Histograms&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
k6 run -o experimental-prometheus-rw script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Optionally, you can set the &lt;code&gt;testid&lt;/code&gt; tag as a 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/tags-and-groups/#test-wide-tags&#34;&gt;wide test tag&lt;/a&gt; to segment metrics into discrete test runs and filter specific test results on the pre-built Grafana dashboards or in PromQL queries. &lt;code&gt;testid&lt;/code&gt; can be any unique string that let you clearly identify the test run.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Trend stats&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),min,max \
k6 run -o experimental-prometheus-rw --tag testid=&amp;lt;SET-HERE-A-UNIQUE-ID&amp;gt; script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Native Histograms&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
k6 run -o experimental-prometheus-rw --tag testid=&amp;lt;SET-HERE-A-UNIQUE-ID&amp;gt; script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After running the test, visit &lt;a href=&#34;http://localhost:3000&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;http://localhost:3000&lt;/a&gt;. If you enabled native histograms, select the &lt;strong&gt;k6 Prometheus (Native Histograms)&lt;/strong&gt; dashboard; otherwise, select the &lt;strong&gt;k6 Prometheus&lt;/strong&gt; Dashboard.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/k6-prometheus-dashboard.png&#34;
  alt=&#34;k6 Prometheus Dashboard&#34; width=&#34;3454&#34;
     height=&#34;1992&#34;/&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="prometheus-remote-write">Prometheus remote write&lt;/h1>
&lt;div data-shared="experimental-module.md">
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>This is an experimental module.
&lt;br>
&lt;br>
While we intend to keep experimental modules as stable as possible, we may need to introduce breaking changes. This could happen at future k6 releases until the module becomes fully stable and graduates as a k6 core module. For more information, refer to the
&lt;a href="/docs/k6/v2.3.x/reference/versioning-and-stability-guarantees/#experimental">versioning and stability guarantees document&lt;/a>.
&lt;br>
&lt;br>
Experimental modules maintain a high level of stability and follow regular maintenance and security measures. Feel free to &lt;a href="https://github.com/grafana/k6/issues" target="_blank" rel="noopener noreferrer">open an issue&lt;/a> if you have any feedback or suggestions.&lt;/p></description></item><item><title>StatsD</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/statsd/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/statsd/</guid><content><![CDATA[&lt;h1 id=&#34;statsd&#34;&gt;StatsD&lt;/h1&gt;


&lt;div data-shared=&#34;statsd-output.md&#34;&gt;
            

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;, or using the 
    &lt;a href=&#34;/docs/k6/v2.3.x/results-output/real-time/opentelemetry/&#34;&gt;OpenTelemetry output&lt;/a&gt; depending on your use case.&lt;/p&gt;
&lt;p&gt;For more information on the reason behind this change, you can follow &lt;a href=&#34;https://github.com/grafana/k6/issues/2982&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this issue&lt;/a&gt; in the k6 repository.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;p&gt;k6 can push test metrics to a &lt;a href=&#34;https://github.com/statsd/statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;StatsD&lt;/a&gt; service by using the &lt;a href=&#34;https://github.com/LeonAdato/xk6-output-statsd&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6-output-statsd extension&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;build-the-k6-version&#34;&gt;Build the k6 version&lt;/h2&gt;
&lt;p&gt;To build a k6 binary with the extension, first, make sure you have &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt; installed on your machine.&lt;/p&gt;
&lt;p&gt;Then, open your terminal and run the following commands:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build the k6 binary
xk6 build --with github.com/LeonAdato/xk6-output-statsd

... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;xk6 will create the new k6 binary in the local folder.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To learn more about how to build custom k6 versions, check out &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;run-the-k6-test&#34;&gt;Run the k6 test&lt;/h2&gt;
&lt;p&gt;Using the k6 binary you built in the previous step, you can use the &lt;code&gt;--out output-statsd&lt;/code&gt; option when running your tests to use this extension:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;./k6 run --out output-statsd script.js&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following options can be configured:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_STATSD_ADDR&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Address of the statsd service, currently only UDP is supported. The default value is &lt;code&gt;localhost:8125&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_STATSD_NAMESPACE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The namespace used as a prefix for all the metric names. The default value is &lt;code&gt;k6&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_STATSD_PUSH_INTERVAL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Configure how often data batches are sent. The default value is &lt;code&gt;1s&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_STATSD_BUFFER_SIZE&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The buffer size. The default value is &lt;code&gt;20&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_STATSD_ENABLE_TAGS&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;If &lt;code&gt;true&lt;/code&gt; enables sending tags. &lt;code&gt;false&lt;/code&gt; by default as old versions of statsd, prior to v0.9.0 did not support tags.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_STATSD_TAG_BLOCKLIST&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;This is a comma-separated list of tags that should NOT be sent to statsd. For example, &amp;ldquo;tag1,tag2&amp;rdquo;. The default value is &lt;code&gt;vu,iter,url&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;]]></content><description>&lt;h1 id="statsd">StatsD&lt;/h1>
&lt;div data-shared="statsd-output.md">
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>The built-in StatsD output has been deprecated on k6 v0.47.0 and removed in v0.55.0. You can continue to stream metrics to StatsD by using the &lt;a href="https://github.com/LeonAdato/xk6-output-statsd" target="_blank" rel="noopener noreferrer">xk6-output-statsd extension&lt;/a>, or using the
&lt;a href="/docs/k6/v2.3.x/results-output/real-time/opentelemetry/">OpenTelemetry output&lt;/a> depending on your use case.&lt;/p></description></item><item><title>TimescaleDB</title><link>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/timescaledb/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/results-output/real-time/timescaledb/</guid><content><![CDATA[&lt;h1 id=&#34;timescaledb&#34;&gt;TimescaleDB&lt;/h1&gt;
&lt;p&gt;Using the &lt;a href=&#34;https://github.com/grafana/xk6-output-timescaledb&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;TimescaleDB k6 extension&lt;/a&gt;, you can store k6 metrics in &lt;a href=&#34;https://www.timescale.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;TimescaleDB&lt;/a&gt; and analyze your performance results with SQL and dashboards. The extension repository includes two Grafana dashboards.&lt;/p&gt;
&lt;h2 id=&#34;build-the-k6-version&#34;&gt;Build the k6 version&lt;/h2&gt;
&lt;p&gt;To build a k6 binary with the extension, first, make sure you have &lt;a href=&#34;https://golang.org/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt; and &lt;a href=&#34;https://git-scm.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Git&lt;/a&gt; installed on your machine.&lt;/p&gt;
&lt;p&gt;Then, open your terminal and run the following commands:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build the k6 binary
xk6 build --with github.com/grafana/xk6-output-timescaledb

... [INFO] Build environment ready
... [INFO] Building k6
... [INFO] Build complete: ./k6&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;xk6 will create the new k6 binary in the local folder.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;To learn more about how to build custom k6 versions, check out &lt;a href=&#34;https://github.com/grafana/xk6&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;xk6&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;run-the-test&#34;&gt;Run the test&lt;/h2&gt;
&lt;p&gt;Check that the TimescaleDB instance is running. Copy the Postgres connection string of the database, which will store the k6 metrics.&lt;/p&gt;
&lt;p&gt;Use the previous k6 binary and run the test passing the Postgres connection string to the 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/k6-options/reference/#results-output&#34;&gt;output option&lt;/a&gt; as follows:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6 run script.js -o timescaledb=postgresql://&amp;lt;postgresql_user_name&amp;gt;:&amp;lt;password&amp;gt;@&amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;/&amp;lt;database&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;k6 runs the test script and sends the metrics in real-time to the TimescaleDB instance. You can now connect to TimescaleDB and query the 
    &lt;a href=&#34;/docs/k6/v2.3.x/using-k6/metrics/&#34;&gt;k6 metrics&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;k6=# SELECT metric,AVG (value) FROM samples GROUP BY metric;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;options&#34;&gt;Options&lt;/h3&gt;
&lt;p&gt;Here is the full list of options that can be configured and passed to the extension:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;K6_TIMESCALEDB_PUSH_INTERVAL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Define how often metrics are sent to TimescaleDB. The default value is 1s (1 second).&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;grafana-dashboards&#34;&gt;Grafana Dashboards&lt;/h2&gt;
&lt;p&gt;The extension repository includes a &lt;a href=&#34;https://github.com/grafana/xk6-output-timescaledb/#docker-compose&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;docker-compose setup&lt;/a&gt; with two pre-built dashboards to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;list test runs&lt;/li&gt;
&lt;li&gt;visualize the results of a test run&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/timescaledb-dashboard-test-runs.png&#34;
  alt=&#34;TimescaleDB list test runs&#34; width=&#34;2308&#34;
     height=&#34;974&#34;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/k6-oss/timescaledb-dashboard-test-result.png&#34;
  alt=&#34;TimescaleDB k6 results&#34; width=&#34;2920&#34;
     height=&#34;2792&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;read-more&#34;&gt;Read more&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://k6.io/blog/store-k6-metrics-in-timescaledb-and-visualize-with-grafana/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Store k6 metrics in TimescaleDB and visualize with Grafana&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="timescaledb">TimescaleDB&lt;/h1>
&lt;p>Using the &lt;a href="https://github.com/grafana/xk6-output-timescaledb" target="_blank" rel="noopener noreferrer">TimescaleDB k6 extension&lt;/a>, you can store k6 metrics in &lt;a href="https://www.timescale.com/" target="_blank" rel="noopener noreferrer">TimescaleDB&lt;/a> and analyze your performance results with SQL and dashboards. The extension repository includes two Grafana dashboards.&lt;/p></description></item></channel></rss>