Search in sources :

Example 1 with ApdexSummaryConsumer

use of org.apache.jmeter.report.processor.ApdexSummaryConsumer in project jmeter by apache.

the class ReportGenerator method createApdexSummaryConsumer.

private ApdexSummaryConsumer createApdexSummaryConsumer() {
    ApdexSummaryConsumer apdexSummaryConsumer = new ApdexSummaryConsumer();
    apdexSummaryConsumer.setName(APDEX_SUMMARY_CONSUMER_NAME);
    apdexSummaryConsumer.setHasOverallResult(true);
    apdexSummaryConsumer.setThresholdSelector(sampleName -> {
        ApdexThresholdsInfo info = new ApdexThresholdsInfo();
        info.setSatisfiedThreshold(configuration.getApdexSatisfiedThreshold());
        info.setToleratedThreshold(configuration.getApdexToleratedThreshold());
        for (Map.Entry<String, Long[]> entry : configuration.getApdexPerTransaction().entrySet()) {
            org.apache.oro.text.regex.Pattern regex = JMeterUtils.getPatternCache().getPattern(entry.getKey());
            PatternMatcher matcher = JMeterUtils.getMatcher();
            if (matcher.matches(sampleName, regex)) {
                Long satisfied = entry.getValue()[0];
                Long tolerated = entry.getValue()[1];
                if (log.isDebugEnabled()) {
                    log.debug("Found match for sampleName:{}, Regex:{}, satisfied value:{}, tolerated value:{}", entry.getKey(), satisfied, tolerated);
                }
                info.setSatisfiedThreshold(satisfied);
                info.setToleratedThreshold(tolerated);
                break;
            }
        }
        return info;
    });
    return apdexSummaryConsumer;
}
Also used : ApdexThresholdsInfo(org.apache.jmeter.report.processor.ApdexThresholdsInfo) ApdexSummaryConsumer(org.apache.jmeter.report.processor.ApdexSummaryConsumer) Map(java.util.Map) PatternMatcher(org.apache.oro.text.regex.PatternMatcher)

Aggregations

Map (java.util.Map)1 ApdexSummaryConsumer (org.apache.jmeter.report.processor.ApdexSummaryConsumer)1 ApdexThresholdsInfo (org.apache.jmeter.report.processor.ApdexThresholdsInfo)1 PatternMatcher (org.apache.oro.text.regex.PatternMatcher)1