Move the adaptive sampler to a shared location.#2418
Conversation
The rate limiting sampler is not specific to exception profiling only so it should live in a more generic space.
| @@ -1,3 +1,7 @@ | |||
| ext { | |||
| enableJunitPlatform = true | |||
| compileTestJava { | ||
| sourceCompatibility = 8 | ||
| targetCompatibility = 8 | ||
| } |
There was a problem hiding this comment.
Does this mean we no longer test internal-api on JDK7?
There was a problem hiding this comment.
We can't stop compiling and testing internal-api on JDK7. Perhaps extract an interface and move the implementation into a JDK8 module under utils, with a stub implementation and a factory, then load the JDK8 implementation based on a version check.
| */ | ||
| StreamingSampler( | ||
| public AdaptiveSampler( | ||
| final Duration windowDuration, |
There was a problem hiding this comment.
(Stating the obvious) Java time was introduced in JDK8, so this implementation would need to be moved out of internal-api
|
Well, my intention was to have just the one source root to be compiled with Java 8 to avoid creating a new module just for this one class. Apparently, it is not that easy even with the gradle black magic :( BTW, with move to ASM 9 to support JDK 16 bytecode level the support for Java 7 will be gone as ASM itself is compiled to level 52 (Java 8) 🤷 |
|
The Since it is used in an already Java 8+ code in the bootstrap I would like to avoid jumping through several facade/reflection hoops in order to use it. The appropriate checks are done at the top level when the whole profiler subsystem is enabled for Java 8+. |
Yes, I agree, maintaining support for JDK7 is holding us back, but we have users on JDK7 and can't drop it until the product decision has been made. |
My (slightly offtopic) point was that with ASM 9 you don't have the choice any more :( Anyway, for this PR I pulled out the Java 8 specific code to a separate module to make it more explicit (also, it makes the build much simpler). |
I got it, and this will force the issue soon, as it presents a dichotomy between JDK7 and JDK17 |
| compileMain_java11Java.targetCompatibility = JavaVersion.VERSION_1_8 | ||
| dependencies { | ||
| main_java11CompileOnly project(':internal-api') | ||
| main_java11Compile project(':internal-api:internal-api-8') |
There was a problem hiding this comment.
Why compileOnly -> compile?
|
This looks problematic |
|
👋 All tests are finally passing 🎉 |
| } | ||
|
|
||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply plugin: "idea" |
There was a problem hiding this comment.
This is probably not needed.
| class StreamingSamplerTest { | ||
|
|
||
| class AdaptiveSamplerTest { | ||
| private static final Logger log = LoggerFactory.getLogger(AdaptiveSamplerTest.class); |
There was a problem hiding this comment.
Use @Slf4j on class instead.
The rate limiting sampler is not specific to exception profiling only so it should live in a more generic space.
The change is rather harmless - just moving the actual sampler implementation to
internal-apiproject. Since theagent-bootstrapalready depends oninternal-apino further changes are needed.