Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add report summary CLI flag #1168

Merged
merged 5 commits into from Nov 13, 2019
Merged

Add report summary CLI flag #1168

merged 5 commits into from Nov 13, 2019

Conversation

cuonglm
Copy link
Contributor

@cuonglm cuonglm commented Sep 20, 2019

Add --summary-export flag for "k6 run", the parameter is output file to
write report summary in JSON format.

Empty string means output is ignored.

Close #355

@codecov-io
Copy link

codecov-io commented Sep 20, 2019

Codecov Report

Merging #1168 into master will increase coverage by <.01%.
The diff coverage is 69.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1168      +/-   ##
==========================================
+ Coverage   75.34%   75.34%   +<.01%     
==========================================
  Files         148      148              
  Lines       10763    10832      +69     
==========================================
+ Hits         8109     8161      +52     
- Misses       2189     2204      +15     
- Partials      465      467       +2
Impacted Files Coverage Δ
cmd/run.go 9.27% <0%> (-0.44%) ⬇️
core/engine.go 93.77% <100%> (ø) ⬆️
cmd/config.go 78.1% <75%> (-0.16%) ⬇️
ui/summary.go 90.28% <95.83%> (+1.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82d6dd4...15552be. Read the comment docs.

@cuonglm cuonglm changed the title [WIP] ui: refactoring Add report summary CLI flag Sep 23, 2019
@cuonglm cuonglm requested a review from imiric September 23, 2019 04:46
ui/summary.go Outdated Show resolved Hide resolved
Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation LGTM, but this needs some tests.

And would this PR also close #1120?

@cuonglm cuonglm added this to the v0.26.0 milestone Sep 24, 2019
cmd/run.go Outdated Show resolved Hide resolved
cmd/config.go Outdated Show resolved Hide resolved
cmd/config.go Outdated Show resolved Hide resolved
cmd/run.go Outdated Show resolved Hide resolved
@mstoykov
Copy link
Collaborator

IMHO this should wait for #1143 and definitely have tests (extend the one in #1143 ?) to test that everything works as expected :)
I haven't looked through the printing code and whether everything in the stdout summary is in the json one but given the lack of tests I would wait for them ;)

Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I mentioned in the inline comment, since this option is for making a JSON report of the end-of-test summary, in my opinion it's better to call it SummaryReport, not the current ReportSummary (which to me implies that we're making a summary of some report)

though now that I think about it, "report" itself is the ambiguous part here, maybe we can replace it? so... --summary-export? @cuonglm, @mstoykov , @imiric - thoughts?

@cuonglm
Copy link
Contributor Author

cuonglm commented Sep 27, 2019

as I mentioned in the inline comment, since this option is for making a JSON report of the end-of-test summary, in my opinion it's better to call it SummaryReport, not the current ReportSummary (which to me implies that we're making a summary of some report)

though now that I think about it, "report" itself is the ambiguous part here, maybe we can replace it? so... --summary-export? @cuonglm, @mstoykov , @imiric - thoughts?

/me +1 for --summary-export

@mstoykov
Copy link
Collaborator

I don't like "summary" to be honest :). --result-export though might be confused to be all the metrics ...

@na--
Copy link
Member

na-- commented Sep 27, 2019

"[End of test] summary" might not be the best name, but we're stuck with it anyway. It's referred so in the docs and the options --summary-trend-stats, --summary-time-unit, --no-summary exist... so, to be consistent, this option should feature summary in its name

@imiric
Copy link
Contributor

imiric commented Sep 27, 2019

To add another variation to consider 😄, how about --summary-output? "Summary" makes sense to me, since it's distinct from the actual metrics results and it is a summary of the results anyway, and "output" would be consistent with --out (perhaps this should be --output?), except one is the location of the metrics results and the other the location of the summary results. We could make it longer and more explicit with --results-summary-output and --results-output respectively.

@na--
Copy link
Member

na-- commented Sep 27, 2019

To add another variation to consider smile, how about --summary-output

👍, to me it seems slightly better than --summary-export, but it might be slightly confusing or conflicting with the rest of the "outputs", or with the desire to make this new flag independent from --no-summary above: #1168 (comment)

--results-summary-output and --results-output

As I mentioned in the previous comment, I feel like we should have summary somewhere in there

cmd/run.go Outdated Show resolved Hide resolved
@cuonglm cuonglm requested a review from imiric November 11, 2019 14:27
Comment on lines 217 to 220
"extra": {
"min": 1,
"max": 1
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think that we can move the data under extra to the level above as there is zero value added from this and also probably will be less code ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

ui/summary.go Outdated
Comment on lines 257 to 260
min := sink.Min
max := sink.Max
data["min"] = min
data["max"] = max
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need neither min nor max as well as probably most of the variables in the other cases of this switch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Collaborator

@mstoykov mstoykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still no support for thresholds and by the looks of it- it's going to be pretty simple to add.
You need to check that the metric has Thresholds and if it does ... just add them possibly as map
of Threshold.Source to Threshold.LastFailed to the metric itself ... Like:

        "http_req_duration{url:http://httpbin.org/post}": {
            "avg": 117.039762276,
            "max": 228.920154,
            "med": 116.05152949999999,
            "min": 113.477511,
            "p(90)": 117.4600813,
            "p(95)": 118.38552544999999,
            "thresholds": {
                "max<1000": false
            }
        },

Although maybe it would be good idea to have a separate place for all the thresholds either in addition or just there ... cc @na--, @imiric ?

@cuonglm
Copy link
Contributor Author

cuonglm commented Nov 11, 2019

This will get overwritten at 5d558ee#diff-cc7288c8b0cb64e706ac188a9e524b7fR444 for non Trend metrics

Fixed

ui/summary_test.go Outdated Show resolved Hide resolved
@cuonglm
Copy link
Contributor Author

cuonglm commented Nov 12, 2019

@na-- @mstoykov @imiric can you guys re-review this?

Hey guys, a gentle ping.

imiric
imiric previously approved these changes Nov 12, 2019
Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just remember to cleanup/squash before merge.

na--
na-- previously approved these changes Nov 13, 2019
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though we might want to do some corner case tests when we merge it (different and nested groups, custom metrics, tagged thresholds, custom trend percentile columns, etc.). And yeah, squash the commits before merging.

Add --summary-export flag for "k6 run", the parameter is output file to
write report summary in JSON format.

Empty string means output is ignored.

Close #355
Copy link
Collaborator

@mstoykov mstoykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I think that a few more tests will be a good idea, but definitely a lot of manual testing with different scripts is a must before release.

Also IMO we should be using Metric.Summary, possibly after changing it a bit.

@cuonglm
Copy link
Contributor Author

cuonglm commented Nov 13, 2019

LGTM, although I think that a few more tests will be a good idea, but definitely a lot of manual testing with different scripts is a must before release.

Also IMO we should be using Metric.Summary, possibly after changing it a bit.

Thanks, I don't know about it. Scratch the surface looking, m.Summary().Summary looks weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON -report does not work.
6 participants