← 输入框|github.com|刷新
Skip to content

[python] test_samply_profile: skip when the host blocks perf events - #7989

Open
blp wants to merge 2 commits into
mainfrom
samply-test-perf-skip
Open

blp wants to merge 2 commits into
mainfrom
samply-test-perf-skip

Conversation

@blp

@blp blp commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

samply needs perf events. A host whose kernel.perf_event_paranoid is too high (Ubuntu's default is 4) blocks them, even with the PERFMON capability that the Helm chart gives the pipeline pod. The test then fails with a 500, mostly on local installs.

The new helper _skip_if_perf_events_blocked() skips the test when the error code is SamplyProfilingFailure and the details name perf_event_paranoid. samply prints that name in this case, and the pipeline returns samply's stderr in details. The test calls the helper when the start request fails, and on a 500 while it polls for the profile. Any other samply error still fails the test. In CI (when CI is set) the test never skips, so a CI host that blocks perf events fails the test instead of skipping it on every run without notice.

Testing:

Case Result
Fake 500 reply with samply's perf_event_paranoid message Skip
Fake 500 reply with another samply error No skip, the error is raised
ruff check and ruff format Pass

Not tested on a real host with perf_event_paranoid=4.

This is independent of #7977, which changes the poll timeout in the same test.

Fixes https://github.com/feldera/cloud/issues/1453.

samply needs perf events.  A host whose kernel.perf_event_paranoid is
too high (Ubuntu's default is 4) blocks them even with the PERFMON
capability, so the test failed with a 500 on local installs.  Skip the
test when samply's error names perf_event_paranoid; fail on any other
error as before.

Fixes feldera/cloud#1453.
@blp blp added python Pull requests that update python code QA Testing and quality assurance profiler Issues related to the profiler and its APIs labels Nov 16, 2026
@blp blp self-assigned this Nov 16, 2026
@mythical-fred-oss

Copy link
Copy Markdown
Contributor

LGTM. Test-only change; no feldera-pr-checks gate fails.

What I ran

Check Result
ruff check / ruff format --check on the changed file pass
Pulled _skip_if_perf_events_blocked out and ran it against fake errors: matching samply message / other samply error / error_code=None, details=None / wrong code with matching text skip / no-op / no-op / no-op ✅
Server path: on Linux, async_samply_profile uses bail! and puts samply's stderr in the top-level message, and complete_profiling stores error.to_string() in details, so the perf_event_paranoid text does reach the client verified by reading the code

pitfall (medium): the skip applies everywhere, CI included. If a CI runner image ever ships with perf_event_paranoid > 2, this test turns into a permanent silent skip and samply loses its only end-to-end coverage, with nothing red to tell anyone. Consider skipping only outside CI (for example, re-raise when CI is set), or at least make sure skip counts show up in the CI summary.

A CI host that blocks perf events would otherwise skip this test on
every run without notice, and samply would lose its only end-to-end
test.  Skip only when CI is not set.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

profiler Issues related to the profiler and its APIs python Pull requests that update python code QA Testing and quality assurance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants