Generates realistic-looking metrics data for use in system testing.
Determine the latest version of the commons in Maven Central.
Add a dependency to your pom:
<dependency>
<groupId>com.arpnetworking.metrics</groupId>
<artifactId>generator</artifactId>
<version>VERSION</version>
</dependency>
The Maven Central repository is included by default.
Add a dependency to your build.gradle:
compile group: 'com.arpnetworking.metrics', name: 'metrics', version: 'VERSION'
Add the Maven Central Repository into your build.gradle:
repositories {
mavenCentral()
}
Add a dependency to your project/Build.scala:
val appDependencies = Seq(
"com.arpnetworking.metrics" % "metrics" % "VERSION"
)
The Maven Central repository is included by default.
The following function generates the specified data. Specify:
- The number of units of work.
- The number of unique metrics (aka names).
- The number of samples per metric per unit of work.
public void generate(final int uowCount, final int metricsCount, final int samplesCount) {
final RandomGenerator random = new MersenneTwister(1298); // Just pick a number as the seed.
final Path path = Paths.get("build/tmp/perf/application-generated-sample.log");
final DateTime start = DateTime.now().hourOfDay().roundFloorCopy();
final DateTime stop = start.plusMinutes(10);
final TestFileGenerator generator = new TestFileGenerator.Builder()
.setRandom(random)
.setUnitOfWorkCount(uowCount)
.setNamesCount(metricsCount)
.setSamplesCount(samplesCount)
.setStartTime(start)
.setEndTime(stop)
.setFileName(path)
.setClusterName("application_cluster")
.setServiceName("application_service")
.build();
generator.generate();
}
The metrics-generator artifacts may be installed and executed as a stand-alone application. You can find the artifacts from the build in target/appassembler/ and these should be copied to an appropriate directory on your target host(s).
There are generated scripts in target/appassembler/bin/ to run the metrics-generator: metrics-generator (Linux) and metrics-generator.bat (Windows). One of these should be executed on system start with appropriate parameters; for example:
metrics-generator> ./target/appassembler/bin/metrics-generator --continuous
All configuration is provided on the command line.
- By default without any arguments the metrics generator will produce a set of test files in the current directory.
- Specifying the "--continuous" argument the generator will produce a continuous stream of metrics into a single file.
Prerequisites:
- None
Building:
metrics-generator> ./jdk-wrapper.sh ./mvnw verify
To use the local version you must first install it locally:
metrics-generator> ./jdk-wrapper.sh ./mvnw install
You can determine the version of the local build from the pom file. Using the local version is intended only for testing or development.
You may also need to add the local repository to your build in order to pick-up the local version:
- Maven - Included by default.
- Gradle - Add mavenLocal() to build.gradle in the repositories block.
- SBT - Add resolvers += Resolver.mavenLocal into project/plugins.sbt.
Published under Apache Software License 2.0, see LICENSE
© Groupon Inc., 2014