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

Added logic to save the error body only for failed requests #81

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public Point getPoint() {
* @param isToBeSaved set to true if body need to be saved; otherwise false.
* @return the normalized string if parameter @param isToBeSaved set to true; 'noData' string otherwise.
*/
private String getErrorBodyToBeSaved(boolean isToBeSaved)
private String getErrorBodyToBeSaved(boolean isToBeSaved, boolean isSuccessful)
{
String errorResponseBody;

if (isToBeSaved)
if (isToBeSaved && isSuccessful)
{
errorResponseBody = this.getErrorBody();
}
Expand Down Expand Up @@ -107,7 +107,7 @@ private Point getDefaultPoint() {
.addTag(RequestMeasurement.Tags.RESULT_CODE, this.sampleResultContext.getSampleResult().getResponseCode())
.addTag(RequestMeasurement.Tags.ERROR_MSG, this.getAssertionFailure())
.addTag(RequestMeasurement.Tags.SAMPLE_TYPE, this.sampleResultContext.getSamplerType())
.addTag(RequestMeasurement.Tags.ERROR_RESPONSE_BODY, this.getErrorBodyToBeSaved(this.sampleResultContext.isErrorBodyToBeSaved()))
.addTag(RequestMeasurement.Tags.ERROR_RESPONSE_BODY, this.getErrorBodyToBeSaved(this.sampleResultContext.isErrorBodyToBeSaved(), !this.sampleResultContext.getSampleResult().isSuccessful()))
.addField(RequestMeasurement.Fields.ERROR_COUNT, this.sampleResultContext.getSampleResult().getErrorCount())
.addField(RequestMeasurement.Fields.REQUEST_COUNT, this.sampleResultContext.getSampleResult().getSampleCount())
.addField(RequestMeasurement.Fields.RECEIVED_BYTES, this.sampleResultContext.getSampleResult().getBytesAsLong())
Expand Down