Fix: Container Names Missing from Uploaded Profile Data - #68
Open
artursarlo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Container Names Missing from Uploaded Profile Data
Problem
When the
--flamegraphflag is enabled, uploaded profiles were always reporting an emptycontainerslist in the profile metadata, causing container attribution to be lost on the backend.The root cause was a side effect in
_make_profile_metadata(merge.py): every time it is called with a non-Nonecontainer_names_client, it reads and then immediately clears the container name cache viacontainer_names_client.reset_cache().The pre-generation block in
_snapshot— which creates a temporary merged result solely to generate theflamegraph_html— was passing the realself._profiler_state.container_names_clientto bothconcatenate_profilesandmerge_profiles. This causedreset_cache()to be called during the temporary merge, draining the cache before the actualmerged_result(which is what gets uploaded) had a chance to consume it.Fix
Pass
container_names_client=Nonein both temporary merge calls (concatenate_profilesandmerge_profiles) inside the flamegraph pre-generation block.Container names are not needed by the temporary merge — its output is only used to extract stripped stack data for flamegraph rendering. Passing
Noneskips the cache read entirely, preserving the container names for the real merge that follows.Impact
metadata["containers"]was always[]in uploaded profiles when--flamegraphwas enabled.metadata["containers"]is correctly populated, matching the behavior when--flamegraphis disabled.