k6 Performance Analytics for Jira

Integrate your k6 load testing results directly into Jira issues.


Why k6 + Jira?

This app allows you to bridge the gap between performance engineering and project management. No more manual copy-pasting of test results - let your k6 scripts talk directly to your Jira tickets.


Quick Start

  1. Install the app in your Jira Cloud instance.
  2. Go to Apps > k6 to Jira Config.
  3. Copy your Unique Webhook URL and Security Token.
  4. Add the handleSummary function to your k6 script (see example below).
  5. Run your test and see metrics appear in real-time.

Integration Guide

k6 makes it incredibly easy to send results using the handleSummary callback.

Example k6 Script

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 }),
  };
}