Skip to content

Conversation

@jackshirazi
Copy link
Contributor

@jackshirazi jackshirazi commented Oct 13, 2025

closes #730

@jackshirazi jackshirazi requested a review from a team as a code owner October 13, 2025 20:00

private static Sampler delegate = newSampler(DEFAULT_TRACEIDRATIO_SAMPLE_RATIO);
private static volatile double latestRatio;
private static volatile Sampler delegate = newSampler(DEFAULT_TRACEIDRATIO_SAMPLE_RATIO);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for reviewer - the ratio can be changed on the fly from any thread. The latestRatio is not functionally needed, it's purely for nice output from config logging

throw new IllegalStateException(
"expecting exactly one agent jar file in ../agent/build/libs");
}
return jar[0].getAbsolutePath();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for reviewer. As noted by Jonas, this is a cyclic dependency. But in almost all cases of CI testing the jar file is created first, and I think it's more maintainable to have the test here in the module rather than in a different module just for the odd case that would cause failure and is unlikely to ever be actually run (eg gradle clean check)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's possible to configure the test task to depend on the jar one. This doesn't seem to be a problem right now, so maybe it's not worth adding this config, though I mention it in case it helps in the future.

Copy link
Member

Choose a reason for hiding this comment

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

There is something like this in the contrib repository: https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/jmx-scraper/build.gradle.kts#L69, thus I would suggest to try reproducing it.

Unlike with Maven, where artifact packaging comes before after tests, with Gradle this might not be an issue as it will just ensure that the packaged jar is made available before running the tests. Also, doing it like this is cleaner as it prevents having to use relative paths which is brittle, even if we are unlikely to change folder structure soon.

LikeTheSalad
LikeTheSalad previously approved these changes Oct 14, 2025
throw new IllegalStateException(
"expecting exactly one agent jar file in ../agent/build/libs");
}
return jar[0].getAbsolutePath();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's possible to configure the test task to depend on the jar one. This doesn't seem to be a problem right now, so maybe it's not worth adding this config, though I mention it in case it helps in the future.

@jackshirazi
Copy link
Contributor Author

adjusted per feedback, gradle feeds in the path, thanks deffo better!

LikeTheSalad
LikeTheSalad previously approved these changes Oct 16, 2025
tasks.withType<Test>().configureEach {
val agentJarTask = project(":agent").tasks.named<Jar>("jar")
dependsOn(agentJarTask)
inputs.files(layout.files(agentJarTask))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this line is probably not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

SylvainJuge
SylvainJuge previously approved these changes Oct 16, 2025
@jackshirazi jackshirazi dismissed stale reviews from SylvainJuge and LikeTheSalad via 99fea7d October 16, 2025 08:29
@jackshirazi jackshirazi enabled auto-merge (squash) October 16, 2025 08:30
@jackshirazi jackshirazi merged commit d0df278 into elastic:main Oct 16, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log the configuration (at startup?)

3 participants