Skip to content

feat(profiling): Introduce continuous profiling mode - #2830

Merged
sentrivana merged 47 commits into
masterfrom
txiao/feat/introduce-continuous-profiling-mode
Jun 11, 2024
Merged

sentrivana merged 47 commits into
masterfrom
txiao/feat/introduce-continuous-profiling-mode

Conversation

@Zylphrex

Copy link
Copy Markdown
Member

This is a new profiling mode that is mutually exclusive from the existing profiling modes. In the current profiling modes, a profile is always directly attached to a transaction. This new mode will continuously emit chunks of profiling data that will be connected to the span data.

This is a new profiling mode that is mutually exclusive from the existing
profiling modes. In the current profiling modes, a profile is always directly
attached to a transaction. This new mode will continuously emit chunks of
profiling data that will be connected to the span data.
Zylphrex added a commit that referenced this pull request Mar 18, 2024
As per getsentry/rfc#75, this adds the thread data to the spans. This will be
needed for the continuous profiling mode in #2830.
Zylphrex added a commit that referenced this pull request Mar 20, 2024
As per getsentry/rfc#75, this adds the thread data to the spans. This will be
needed for the continuous profiling mode in #2830.
@Zylphrex
Zylphrex marked this pull request as ready for review May 7, 2024 13:44
@Zylphrex
Zylphrex requested a review from sentrivana June 6, 2024 20:07
@antonpirker antonpirker added this to the Continuous Profiling milestone Jun 7, 2024
@sentrivana
sentrivana merged commit 852cdc7 into master Jun 11, 2024
@sentrivana
sentrivana deleted the txiao/feat/introduce-continuous-profiling-mode branch June 11, 2024 10:29
Zylphrex added a commit that referenced this pull request Jun 11, 2024
The thread data was added to the profile context in #2830. It should live in the
trace context to align with other SDKs.
sentrivana pushed a commit that referenced this pull request Jun 12, 2024
The thread data was added to the profile context in #2830. It should live in the
trace context to align with other SDKs.
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
This is a new profiling mode that is mutually exclusive from the existing
profiling modes. In the current profiling modes, a profile is always directly
attached to a transaction. This new mode will continuously emit chunks of
profiling data that will be connected to the span data.
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
The thread data was added to the profile context in getsentry#2830. It should live in the
trace context to align with other SDKs.
sentrivana pushed a commit that referenced this pull request Nov 9, 2026
### Description

Removes `ContinuousScheduler.pause()` from
`sentry_sdk/profiler/continuous_profiler.py` (3 lines). It's a stub that
only raises `NotImplementedError`, and nothing implements it or calls
it.

#2830 (Jun 2024, "Introduce continuous profiling mode") added it next to
`ensure_running()` and `teardown()`. Unlike those two, no subclass ever
overrode it, and the SDK never called it. The stub makes it look like
the continuous profiler can be paused, but it can't.

**Evidence**
- `git grep -nw pause` on `master` finds only the definition. Nothing in
`sentry_sdk/`, `tests/`, `scripts/` or `docs/` refers to it.
- `ThreadContinuousScheduler` and `GeventContinuousScheduler`, the only
subclasses, override `ensure_running()` and `teardown()` but not
`pause()`.
- `git log -S "def pause"` finds only #2830. `git log -S ".pause("`
across `sentry_sdk` and `tests` finds no commits, so it has never had a
caller.
- `ContinuousScheduler` isn't exported from `sentry_sdk.profiler`
(`__all__` lists only the transaction-profiler schedulers) and isn't
documented.
- No open PR or issue mentions it. #7275 also touches
`continuous_profiler.py`, but in different hunks
(`ThreadContinuousScheduler.__init__`).

**Why it's safe**
- `ContinuousScheduler` is an internal class. The method is unreachable,
so behavior doesn't change, and no public API or documented behavior is
affected.

**Checks**
- `uv run ruff check` / `ruff format --check` on `sentry_sdk/profiler`:
clean
- `uv run --group typing mypy sentry_sdk`: no issues
- `TESTPATH=tests/profiler uv run tox -e py3.14-common`: 106 passed, 69
skipped. The skipped tests are the gevent cases, which need gevent
installed.

#### Issues
None. Found by the weekly sentry-python removal scout.

<!-- junior-request-attribution:start -->
via [automation
`sched_65eed06cc199036c2b13411096f412d4`](https://junior-prod.sentry.dev/automations/sched_65eed06cc199036c2b13411096f412d4)
· Run ID `sched_65eed06cc199036c2b13411096f412d4:1794211200000`.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!--
junior-conversation-id:agent-dispatch%3Adispatch_0096be51ec4ca0f294d1b5786520632b
-->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_0096be51ec4ca0f294d1b5786520632b)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_0096be51ec4ca0f294d1b5786520632b/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
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.

3 participants