Skip to content

k6-web-dashboard aggregate subcommand is not generating correct ndjson file #231

@someena-te

Description

@someena-te

Brief summary

Issue

Not able to generate html report from json files but works when used directly like k6 --out dashboard

How to reproduce

This works:

❯ ./k6 run script-threshold.js -d 30s -o json=1.json -o dashboard=export=1d.html

         /\      Grafana   /‾‾/
    /\  /  \     |\  __   /  /
   /  \/    \    | |/ /  /   ‾‾\
  /          \   |   (  |  (‾)  |
 / __________ \  |_|\_\  \_____/

     execution: local
        script: script-threshold.js
        output: json (1.json), dashboard http://127.0.0.1:5665

     scenarios: (100.00%) 1 scenario, 1 max VUs, 1m0s max duration (incl. graceful stop):
              * default: 1 looping VUs for 30s (gracefulStop: 30s)



  █ THRESHOLDS

    http_req_duration
    ✓ 'p(99)<1000' p(99)=320.99ms

    http_req_failed
    ✓ 'rate<0.01' rate=0.00%


  █ TOTAL RESULTS

    checks_total.......................: 184     6.081361/s
    checks_succeeded...................: 100.00% 184 out of 184
    checks_failed......................: 0.00%   0 out of 184

    ✓ response code was 200

    HTTP
    http_req_duration.......................................................: avg=161.52ms min=124.57ms med=131.03ms max=330.39ms p(90)=269.35ms p(95)=285.29ms
      { expected_response:true }............................................: avg=161.52ms min=124.57ms med=131.03ms max=330.39ms p(90)=269.35ms p(95)=285.29ms
    http_req_failed.........................................................: 0.00% 0 out of 184
    http_reqs...............................................................: 184   6.081361/s

    EXECUTION
    iteration_duration......................................................: avg=164.4ms  min=124.7ms  med=131.48ms max=733.42ms p(90)=269.84ms p(95)=289.73ms
    iterations..............................................................: 184   6.081361/s
    vus.....................................................................: 1     min=1        max=1
    vus_max.................................................................: 1     min=1        max=1

    NETWORK
    data_received...........................................................: 92 kB 3.1 kB/s
    data_sent...............................................................: 22 kB 722 B/s




running (0m30.3s), 0/1 VUs, 184 complete and 0 interrupted iterations
default ✓ [=====================================] 1 VUs  30s


Output

Image

But when render out of generated json file

This does not

$ k6-web-dashboard aggregate  1.json 1.ndjson

$ k6-web-dashboard report 1.ndjson 1.html --open 
# output  : empty webpage (there is content in html but webpage when viewed it render blank white page

More information

When i use report with k6 generated ndjson file, it works

k6 run --out web-dashboard=record=sktest1k6gen.ndjson script-threshold.js -d 30s -o json=sktest1.json -o dashboard=export=sktest1k6gen.html

This works: I can see the html report

./k6-web-dashboard report sktest1k6gen.ndjson sktest2.html --open

But when i convert the sktest1.json file generated by k6 command shown above, it does generate the sketst1.ndjson file but this file couldn't be then converted to html. So, following way to generate html report doesn't work

./k6-web-dashboard aggregate sktest1.json sktest1.ndjson

./k6-web-dashboard report sktest1.ndjson sktest2.html --open  # < EMPTY HTML PAGE

❯ ls -al sktest1.ndjson sktest1k6gen.ndjson
Found existing alias for "ls -al". You should use: "ll"
Alias tip: ll sktest1.ndjson sktest1k6gen.ndjson
-rw-r--r--  1 someena  staff  2769 Aug 20 09:36 sktest1.ndjson
-rw-r--r--  1 someena  staff  4500 Aug 20 09:29 sktest1k6gen.ndjson

Diff between these two ndjson files: https://www.diffchecker.com/HLIin929/

Enviornment information

k6 version

❯ ./k6 --version k6 v1.1.0 (go1.24.5, darwin/arm64) Extensions: github.com/grafana/xk6-dashboard v0.7.11, dashboard [output]

xk6-dashboard version

❯ k6-web-dashboard version dev (latest)

OS

macOs 15.6 (24G84)

Docker version and image (if applicable)

No response

Steps to reproduce the problem

read body

Expected behaviour

It should generate same html file as generated by passing argument to k6-run

Actual behaviour

The generated html file out of dashboard event (ndjson) file is not creating working html file. HTML file when opened on browser shows only a blank page

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions