DEV Community

Orbit A
Orbit A

Posted on

Stop Sharing Grafana Links: How to Send k6 Load Test Results Directly to Jira

Your k6 load test just finished. The API survived 10,000 virtual users. Now, how do you communicate that success to the product manager and developers?

Usually, it goes like this: The performance engineer takes a screenshot of the terminal, exports a CSV, or drops a Grafana dashboard link into a Jira comment. The developer sees the link, realizes they have to log into another system, and ignores it.

Performance testing shouldn't live in a silo. When developers are working on a Jira ticket to "Optimize Checkout API," they need the performance metrics right there, inside the ticket.

Let's look at how to stop context-switching and push k6 results directly into Atlassian Jira.

The Hard Way: Custom Pipelines and API Tokens

Many DevOps teams try to build this themselves. They write custom scripts to parse the k6 JSON output, authenticate with Jira's REST API using user tokens (which eventually expire), and struggle to format the data into readable tables inside Jira comments.

It takes days to build and constantly requires maintenance.

The Smart Way: Direct Jira Issue Webhooks

Instead of building it from scratch, our team at Orbit A released the k6 Performance Analytics for Jira. It's a zero-config Atlassian Forge app that allows you to push k6 performance metrics directly into the Jira Issue Panel using a simple Webhook.

It natively hooks into the k6 handleSummary() callback, requiring no external dependencies. Here is how to set it up in under 2 minutes.

Step-by-Step Guide

Step 1: Install the App
Head over to the Atlassian Marketplace and install the k6 Performance Analytics for Jira (it's free to try).

Step 2: Generate Your Webhook
Go to your Jira Apps menu and open the k6 to Jira Config page. The app will instantly and securely generate your unique:

  • Webhook URL.
  • Secret Token.

config page

Step 3: Add handleSummary to Your k6 Script
k6 has a brilliant built-in feature called handleSummary, which runs at the very end of your test. You simply append this code to your existing k6 script.

Here is the secure, production-ready script. It accurately calculates error rates, pushes the data to Jira, and still preserves your standard terminal output!

const reporterCode = `import http from 'k6/http';
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js';

export default function () {
  http.get('https://test-api.k6.io');
}

export function handleSummary(data) {
  const issueId = __ENV.JIRA_ISSUE_ID;

  const avgResponseTime = data.metrics.http_req_duration ? data.metrics.http_req_duration.values.avg : 0;
  const reqCount = data.metrics.http_reqs ? data.metrics.http_reqs.values.count : 0;

  const errorRate = data.metrics.http_req_failed ? (data.metrics.http_req_failed.values.rate * 100) : 0;

  const status = (errorRate > 1 || avgResponseTime > 5000) ? "FAIL" : "PASS";

  const payload = JSON.stringify({
    token: "${token}", 
    issueId: issueId,
    status: status,
    avgResponseTime: avgResponseTime,
    errorRate: errorRate,
    transactions: [
      { 
        name: "Total API Requests", 
        avgTime: avgResponseTime, 
        errorRate: errorRate,
        requests: reqCount 
      }
    ]
  });

  if (!issueId) {
     console.log('\\n[Jira Reporter] ⚠️ No JIRA_ISSUE_ID provided. Skipping Jira update.');
     return { 'stdout': textSummary(data, { indent: ' ', enableColors: true }) };
  }

  console.log('\\n[Jira Reporter] Sending performance results to Jira issue: ' + issueId);

  const res = http.post('${webhookUrl}', payload, {
    headers: { 'Content-Type': 'application/json' },
  });

  if (res.status === 200) {
    console.log('[Jira Reporter] ✅ Successfully pushed results to Jira!');
  } else {
    console.log('[Jira Reporter] ❌ Failed to push to Jira. Status: ' + res.status);
  }

  return {
    'stdout': textSummary(data, { indent: ' ', enableColors: true }),
  };
}`;
Enter fullscreen mode Exit fullscreen mode

Note: Trigger this script in your CI/CD pipeline like this: k6 run -e JIRA_ISSUE_ID=PROJ-123 script.js

(Important: Please ensure issueId is the numeric ID, e.g., 10023, not the Key like PROJ-1)

How to find the Numeric Issue ID:
Open the Jira Issue you are testing.
Look at the URL in your browser.

  • If you are on a Board: You will see ...&selectedIssue=10023. The number is the ID.
  • If you are in the direct issue view: You can navigate to Jira ticket → click 'Actions' button → click 'Export XML' → copy value of 'key_id', i.e. KAN-7 (here you'll need to copy 10134)

numeric jira issue example

Note: You can trigger this script in your GitHub Actions, GitLab CI, or Jenkins pipeline dynamically passing the current Jira Issue ID based on the branch name!

The Result: Performance at a Glance

The moment your k6 load test finishes, the developer or SRE opening the Jira ticket will instantly see the core metrics right on the issue panel:

main panel

They can also click to expand the details and see the exact breakdown of transactions:

detailed panel

Conclusion

By bridging the gap between performance testing tools like k6 and project management tools like Jira, you eliminate data silos. QA engineers stop acting as messenger pigeons, and developers get immediate feedback exactly where they track their work.

👉 [Try k6 Performance Analytics for Jira on the Atlassian Marketplace]

If you found this helpful, be sure to follow Orbit A on LinkedIn. We are building a suite of native Atlassian apps for QA and DevOps teams, including integrations for Playwright, Cypress, and JMeter!

Top comments (0)