Skip to content
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

fix react-native (android) rendering issue #397

Merged
merged 3 commits into from
Jan 30, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
**Bug Fixes**:

- Label all node frames as system ([#392](https://github.com/getsentry/vroom/pull/392))
- Fix react-native (android) rendering issue ([#397](https://github.com/getsentry/vroom/pull/397))

**Internal**:

Expand Down
5 changes: 5 additions & 0 deletions internal/profile/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func (m AndroidMethod) ExtractPackageNameAndSimpleMethodNameFromAndroidMethod()
}

func (m AndroidMethod) FullMethodNameFromAndroidMethod() (string, error) {
// when we we're dealing with js frame that were "converted"
// to android methods (react-native) we don't have class name
if m.ClassName == "" {
return m.Name, nil
}
var builder strings.Builder
builder.WriteString(m.ClassName)
// "<init>" refers to the constructor in which case it's more readable to omit the method name. Note the method name
Expand Down
15 changes: 9 additions & 6 deletions internal/profile/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (p LegacyProfile) CallTrees() (map[uint64][]*nodetree.Node, error) {
if p.Trace == nil {
return nil, ErrProfileHasNoTrace
}
_, ok := p.Trace.(Android)
_, ok := p.Trace.(*Android)
// this is to handle only the Reactnative (android + js)
// use case. If it's an Android profile but there is no
// js profile, we'll skip this entirely
Expand Down Expand Up @@ -176,7 +176,7 @@ func (p LegacyProfile) IsSampleFormat() bool {
}

func (p *LegacyProfile) Speedscope() (speedscope.Output, error) {
t, ok := p.Trace.(Android)
t, ok := p.Trace.(*Android)
// this is to handle only the Reactnative (android + js)
// use case. If it's an Android profile but there is no
// js profile, we'll skip this entirely
Expand Down Expand Up @@ -493,14 +493,17 @@ func getEventTimeFromElapsedNanoseconds(ns uint64) EventTime {
}
}

type NestedProfile struct {
Profile sample.Trace `json:"profile"`
}

func unmarshalSampleProfile(p json.RawMessage) (sample.Trace, error) {
var st sample.Trace
err := json.Unmarshal(p, &st)
var np NestedProfile
err := json.Unmarshal(p, &np)
if err != nil {
return sample.Trace{}, err
}

return st, nil
return np.Profile, nil
}

// CallTree generation expect activeThreadID to be set in
Expand Down
Loading