Skip to content

Commit

Permalink
Make spotless work
Browse files Browse the repository at this point in the history
In this commit, we are making spotless work, as I found out that
spotless is not being run in the upstream for benchmark-overhead. To
achive this, I've added a license file to `scripts` and updated
build.gradle.kts to reference it. Then I ran spotlessApply to bring the
code up to expectations. In future commits, we will automatically run
spotless to ensure code is up to standards on every commit.
  • Loading branch information
thpierce committed Feb 26, 2024
1 parent 1f158d5 commit 9b5d68f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion performance-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
spotless {
java {
googleJavaFormat()
licenseHeaderFile(rootProject.file("../buildscripts/spotless.license.java"), "(package|import|public)")
licenseHeaderFile(rootProject.file("../scripts/spotless.license.java"), "(package|import|public)")
target("src/**/*.java")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,27 @@ private void startRecording(Agent agent, GenericContainer<?> petclinic) throws E
petclinic.execInContainer(command);
}

private void doWarmupPhase(TestConfig testConfig, GenericContainer<?> petclinic) throws IOException, InterruptedException {
System.out.println("Performing startup warming phase for " + testConfig.getWarmupSeconds() + " seconds...");
private void doWarmupPhase(TestConfig testConfig, GenericContainer<?> petclinic)
throws IOException, InterruptedException {
System.out.println(
"Performing startup warming phase for " + testConfig.getWarmupSeconds() + " seconds...");

// excluding the JFR recording from the warmup causes strange inconsistencies in the results
System.out.println("Starting disposable JFR warmup recording...");
String[] startCommand = {"jcmd", "1", "JFR.start", "settings=/app/overhead.jfc", "dumponexit=true", "name=warmup", "filename=warmup.jfr"};
String[] startCommand = {
"jcmd",
"1",
"JFR.start",
"settings=/app/overhead.jfc",
"dumponexit=true",
"name=warmup",
"filename=warmup.jfr"
};
petclinic.execInContainer(startCommand);

long deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(testConfig.getWarmupSeconds());
while(System.currentTimeMillis() < deadline) {
long deadline =
System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(testConfig.getWarmupSeconds());
while (System.currentTimeMillis() < deadline) {
GenericContainer<?> k6 =
new GenericContainer<>(DockerImageName.parse("loadimpact/k6"))
.withNetwork(NETWORK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ public class NamingConventions {
public final NamingConvention container = new NamingConvention("/results");
public final NamingConvention local = new NamingConvention(".");

/** @return Root path for the local naming convention (where results are output) */
/**
* @return Root path for the local naming convention (where results are output)
*/
public String localResults() {
return local.root();
}

/** @return Root path for the container naming convention (where results are output) */
/**
* @return Root path for the container naming convention (where results are output)
*/
public String containerResults() {
return container.root();
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/spotless.license.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

0 comments on commit 9b5d68f

Please sign in to comment.