Skip to content

chore(profiling): Remove profile context from sdk #2013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions sentry_sdk/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,6 @@ def _set_initial_sampling_decision(self, sampling_context):
)
)

def get_profile_context(self):
# type: () -> ProfileContext
return {"profile_id": self.event_id}

def start(self):
# type: () -> None
if not self.sampled or self.active:
Expand Down
1 change: 0 additions & 1 deletion sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ def finish(self, hub=None, end_timestamp=None):

if self._profile is not None and self._profile.valid():
event["profile"] = self._profile
contexts.update({"profile": self._profile.get_profile_context()})
self._profile = None

event["measurements"] = self._measurements
Expand Down
31 changes: 0 additions & 31 deletions tests/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,37 +233,6 @@ def test_profiles_sampler(
assert len(items["profile"]) == profile_count


@mock.patch("sentry_sdk.profiler.PROFILE_MINIMUM_SAMPLES", 0)
def test_profile_context(
sentry_init,
capture_envelopes,
teardown_profiling,
):
sentry_init(
traces_sample_rate=1.0,
_experiments={"profiles_sample_rate": 1.0},
)

envelopes = capture_envelopes()

with start_transaction(name="profiling"):
pass

items = defaultdict(list)
for envelope in envelopes:
for item in envelope.items:
items[item.type].append(item)

assert len(items["transaction"]) == 1
assert len(items["profile"]) == 1

transaction = items["transaction"][0]
profile = items["profile"][0]
assert transaction.payload.json["contexts"]["profile"] == {
"profile_id": profile.payload.json["event_id"],
}


def test_minimum_unique_samples_required(
sentry_init,
capture_envelopes,
Expand Down