Skip to content

Commit e6f3a76

Browse files
committed
diag: profile slow consistent-sampling tests on Java 26 [skip ci]
1 parent b992287 commit e6f3a76

2 files changed

Lines changed: 100 additions & 1 deletion

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# TEMPORARY diagnostic workflow to reproduce and profile the slow
2+
# consistent-sampling tests on Windows / Java 26. Remove before merging upstream.
3+
#
4+
# Triggers only via workflow_dispatch. Runs ONLY the two slow legacy tests with
5+
# JFR profiling enabled (-PdiagProfiling) across a small matrix to triangulate
6+
# whether the slowdown is Windows-specific, Java-26-specific, or the combination.
7+
name: Diag - Consistent Sampling Slow
8+
9+
on:
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
diag:
17+
name: ${{ matrix.os }} ${{ matrix.distribution }}-${{ matrix.test-java-version }}
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 120
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
# CI's exact failing config (build-common uses zulu)
25+
- os: windows-latest
26+
distribution: zulu
27+
test-java-version: 26
28+
# vendor hypothesis: temurin 26 runs fast locally on Windows
29+
- os: windows-latest
30+
distribution: temurin
31+
test-java-version: 26
32+
# version baseline: zulu 25 runs fast
33+
- os: windows-latest
34+
distribution: zulu
35+
test-java-version: 25
36+
# OS dimension: zulu 26 on linux
37+
- os: ubuntu-latest
38+
distribution: zulu
39+
test-java-version: 26
40+
steps:
41+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
42+
with:
43+
persist-credentials: false
44+
45+
- id: setup-java-test
46+
name: Set up Java ${{ matrix.test-java-version }} for tests
47+
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
48+
with:
49+
distribution: ${{ matrix.distribution }}
50+
java-version: ${{ matrix.test-java-version }}
51+
52+
- id: setup-java
53+
name: Set up Java for build
54+
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
55+
with:
56+
distribution: temurin
57+
java-version: 21
58+
59+
- name: Set up Gradle
60+
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
61+
62+
- name: Run slow consistent-sampling tests with profiling
63+
run: >
64+
./gradlew :consistent-sampling:test -PdiagProfiling
65+
"-PtestJavaVersion=${{ matrix.test-java-version }}"
66+
"-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }}"
67+
"-Porg.gradle.java.installations.auto-download=false"
68+
--tests "*.consistent.ConsistentProbabilityBasedSamplerTest"
69+
--tests "*.consistent.ConsistentRateLimitingSamplerTest"
70+
env:
71+
GITHUB_TOKEN: ${{ github.token }}
72+
73+
- name: Upload diagnostics
74+
if: ${{ !cancelled() }}
75+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
76+
with:
77+
name: diag-${{ matrix.os }}-${{ matrix.distribution }}${{ matrix.test-java-version }}
78+
path: |
79+
consistent-sampling/build/diag/**
80+
consistent-sampling/build/reports/tests/**
81+
consistent-sampling/build/test-results/**
82+
if-no-files-found: warn

consistent-sampling/build.gradle.kts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,26 @@ tasks {
1717
withType<Test>().configureEach {
1818
develocity.testRetry {
1919
// TODO (trask) fix flaky tests and remove this workaround
20-
if (System.getenv().containsKey("CI")) {
20+
// -PdiagProfiling disables retries to get clean single-run timing
21+
if (System.getenv().containsKey("CI") && !project.hasProperty("diagProfiling")) {
2122
maxRetries.set(5)
2223
}
2324
}
25+
26+
// TEMPORARY diagnostic instrumentation for slow Windows/Java 26 tests.
27+
// Enable with -PdiagProfiling. Remove before merging.
28+
// Uses relative paths (working dir = project dir) to stay Windows-safe
29+
// (absolute Windows paths contain a ':' which breaks -Xlog parsing).
30+
if (project.hasProperty("diagProfiling")) {
31+
val diagDir = layout.buildDirectory.dir("diag").get().asFile
32+
doFirst {
33+
diagDir.mkdirs()
34+
}
35+
jvmArgs(
36+
"-XX:StartFlightRecording=filename=build/diag/consistent-sampling.jfr," +
37+
"settings=profile,dumponexit=true,maxsize=250m",
38+
"-Xlog:gc*:file=build/diag/gc.log",
39+
)
40+
}
2441
}
2542
}

0 commit comments

Comments
 (0)