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

#309 Enable the average report to display more than one average #320

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Glenmorangie
Copy link

@Glenmorangie Glenmorangie commented Jan 27, 2023

Solves #309

@Glenmorangie Glenmorangie added enhancement New feature or request report Change to report or reporting. labels Jan 27, 2023
#
# index ........ Numeric value for indexing.
#
# percentile ... The percentage of values taken when calculating the moving average series.
Copy link
Contributor

Choose a reason for hiding this comment

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

When a percentage of a value set is used, we should name it percentage.

Comment on lines 86 to +92
## The percentage of values taken when calculating the moving average series.
com.xceptance.xlt.reportgenerator.charts.movingAverage.percentageOfValues = 5

###############################################################################
#
# Additional Moving Average Settings
#
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having two different formats to configure moving averages (one for the required moving average and one for the optional additional ones), it might be worth to think about how we can make a transition from the "old" to the "new" format.

This way, users don't have to riddle about how they should configure their average(s) but simply use the new format and add additional ones if desired. Of course, this would require some kind of compatibility for report-generator configurations created prior to XLT v7.

What about the following:

  • configuration of any moving average is done via properties com.xceptance.xlt.reportgenerator.charts.movingAverages.<index>.<percentage|time|requestCount>
  • drop property com.xceptance.xlt.reportgenerator.charts.movingAverage.percentageOfValues from this file
  • for compatibility with pre-XLT v7 report-generator configurations, still read value of property com.xceptance.xlt.reportgenerator.charts.movingAverage.percentageOfValues and if present, transform it internally into the new format (as if explicitly configured as com.xceptance.xlt.reportgenerator.charts.movingAverages.0.percentage = 5)
  • check if configuration makes use of both formats and error out in that case (w/ a proper error message saying that either the "old" format or the "new" format should be used)

Copy link
Contributor

Choose a reason for hiding this comment

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

Had a talk w/ the PO about that topic and he was fine w/ the current approach as the "default" moving average is used for all charts whereas the additional moving averages are used on the Averages Charts only.

Of course, consolidation of the two formats might still be an option (although some way to "mark" a moving average as default would be needed then).

@jowerner What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

See here for more input regarding this topic.

Comment on lines +104 to +112
# time ......... Time value to create the moving average. If the time is larger than the actual runtime,
# the value will not be shown in the charts.
# Allowed values are for example:
# example: 30m
# example: 1h30m
# example: 1h15m30s
#
# requests ..... Integer value for requests. If the amount is above the actual request value
# the average will not be shown in the charts.
Copy link
Contributor

Choose a reason for hiding this comment

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

The description/explanation reads as if the configured value acts as some kind of minimum value that must be satisfied by a request so it is selected for the moving average.

According to the description of the feature request, the supported moving averages should select the "last X", "last X seconds" and "last X %" values, respectively.

Thus, I'm wondering whether the description should read as follows:

#  percentage . Amount of most recent values (percentage) to consider for calculating the moving average - last X% of all values.  
#  time ....... Time range of the sliding window used to calculate the moving average - requests within the configured time.
#  requests ... Number of most recent requests to consider for calculating the moving average - last X requests.

@@ -117,7 +121,7 @@ public class ReportGeneratorConfiguration extends AbstractConfiguration implemen
*/
public double parameter;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't add superfluous white-space (it come in handy to configure your IDE to show white-space characters).

Comment on lines +211 to +213
private int movingAveragePoints;

private List<MovingArerage> movingAverageEntries;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be declared as final as both fields do not change anymore once initialized.

@@ -365,6 +379,7 @@ public ReportGeneratorConfiguration(Properties xltProperties, final File overrid
{
testReportsRootDir = new File(homeDirectory, testReportsRootDir.getPath());
}
this.movingAveragePoints = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Initialization of this field is done in line 426. Please remove.

Comment on lines +47 to +62
private int intValue = 0;

/**
* The value used for the time.
*/
private long longValue = 0;

/**
* Given property value for the time.
*/
private String timeString = "";

/**
* Current used type for moving average.
*/
private MovingAverages type;
Copy link
Contributor

Choose a reason for hiding this comment

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

In case the values are not expected to change (as the absence of any setter method implies) once they have been set via c'tor, they should be declared as final.
And, there is no need to initialize fields with Java defaults (int and long are initialized implicitly w/ 0).

BTW do we really need two fields here? IMO having one field of type long would suffice too.

Comment on lines +1079 to +1081
int percentage = (int) Math.floor((value / requestCount) * 100);
// samples for chart data items
final int samples = Math.max(2, series.getItemCount() * percentage / 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be correct as it uses a percentage of values instead of a fixed amount. Maybe, I just don't get your intention here. But I'd expect something like the following

        final int samples = Math.max(2, value);

We might also have to verify that value is not greater than requestCount.

int percentage = (int) Math.floor((value / requestCount) * 100);
// samples for chart data items
final int samples = Math.max(2, series.getItemCount() * percentage / 100);
DecimalFormat decimalFormat = new DecimalFormat("0.##E0");
Copy link
Contributor

Choose a reason for hiding this comment

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

What about to made this a static field such it won't be created over and over again?

@Override
public List<MovingArerage> getAdditonalMovingAverages()
{
return Collections.emptyList();
Copy link
Contributor

Choose a reason for hiding this comment

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

Since Java 9, List interface provides method of that returns type-safe immutable collections including a stable reference to empty list. Thus, there is no need for Collections.emptyList() anymore.

Suggested change
return Collections.emptyList();
return List.of();

This is no CR, just FYI.

@@ -85,7 +86,9 @@
/**
* blue, ...
*/
public static final ColorSet AVERAGES = new ColorSet(COLOR_MOVING_AVERAGE, COLOR_MEDIAN, COLOR_MEAN);
public static final ColorSet AVERAGES = new ColorSet(COLOR_MOVING_AVERAGE, COLOR_MEDIAN, COLOR_MEAN, COLOR_MOVING_AVERAGE_ADD_1,
Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify: what if user configured more moving averages than colors available?

@h-arlt h-arlt self-assigned this Feb 13, 2023
@h-arlt h-arlt linked an issue Feb 13, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request report Change to report or reporting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable the average report to display more than one average
3 participants