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

[WIP] Use custom summary trend stat #1760

Closed

Conversation

asettouf
Copy link
Contributor

@asettouf asettouf commented Dec 8, 2020

Hello,

I started working on #1611 and though I think I figured it out, however my solution is the ugliest thing I've done in a long while...

Do note that I'm relatively recent at coding in Go.

Any suggestion would be highly appreciated!

@na--
Copy link
Member

na-- commented Dec 9, 2020

Ah, sorry, I should have been more clear in #1611 (comment), and removed the good first issue label 😞 Thanks for making this PR, however, we're currently in the middle of a big revamping in how the end-of-test summary is handled, so unfortunately I can't merge this...

I should have created a new issue after our internal discussions, and closed (or commented in) the old ones... And I am hoping to make a PR in the next few days with the changes, so it's probably a bit late now. But to give you a summary, we're trying to address a whole bunch of current issues simultaneously (#351, #647, #1319, #1611, #1675, #1120, #1366, #1316) and lay the groundwork for some future improvements as well (#1315, maybe #817).

We'll do that by allowing users to define a JS function for handling the end-of-test summary in a very flexible way. Something like this:

import http from 'k6/http';
import { JUnit, TextSummary } from 'https://jslib.k6.io/k6-summary/1.0.0/index.js' // or something like that
// ...
export function handleSummary(data) {
    // only show the human-readable intermediate summary if the test is still running
    if (data.execution.runStatus == 'running') {
        return {stdout: TextSummary(data.summary)};
    }
   
    // save everything to files and send it to a server when the test finishes or gets aborted
    http.post('https://example.com/testResults', JSON.stringify(data));

    return {
        'stdout': TextSummary(data.summary),
        './results/junit.xml': JUnit(data.summary),
        './results/summary.json': JSON.stringify(data.summary),
    }
}

@asettouf
Copy link
Contributor Author

asettouf commented Dec 9, 2020

@na-- All right fair enough, that makes more sense than what I was trying to do yesterday! :)

@asettouf asettouf closed this Dec 9, 2020
@asettouf asettouf deleted the fix/use_percentile_for_trend_sink branch December 9, 2020 07:41
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.

2 participants