io.hyperfoil.tools.parse.factory.WrkFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parse Show documentation
Show all versions of parse Show documentation
Use regex patterns and rules to build json from text files
package io.hyperfoil.tools.parse.factory;
import io.hyperfoil.tools.parse.*;
/**
* Created by johara
* WrkFactory - creates a Parser for wrk/wrk2 logs
*/
public class WrkFactory implements ParseFactory {
public Exp connections() { return new Exp("connections", "\\s+(?\\d*)\\sthreads and\\s*(?\\d*)\\s+connections"); }
public Exp testConfig() { return new Exp("config", "Running (?\\d*)(?\\w*)\\stest @ (?.*)"); }
public Exp reqSec() {
return new Exp("reqSec", "Requests/sec:\\s+(?\\d*\\.\\d*)");
}
public Exp latency() { return new Exp("latency", "\\s*Latency\\s*(?\\d*\\.\\d*)(?\\w*)\\s*(?\\d*\\.\\d*)(?\\w*)\\s*(?\\d*\\.\\d*)(?\\w*)\\s*(?\\d*\\.\\d*)"); }
public Exp latencyDistribution() { return new Exp("latencyDistribution", "^\\s*(?\\d*\\.\\d*)%\\s*(?\\d*\\.\\d*)(?\\w*)\\s*.*"); }
@Override
public Parser newParser() {
Parser p = new Parser();
addToParser(p);
return p;
}
@Override
public void addToParser(Parser p) {
p.add(testConfig().addRule(ExpRule.PreClose));
p.add(connections());
p.add(latency());
p.add(reqSec());
p.add(latencyDistribution().nest("latencyDistribution").setMerge(ExpMerge.AsEntry));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy