diff --git a/internal/profile/android.go b/internal/profile/android.go index e437805..719ed5a 100644 --- a/internal/profile/android.go +++ b/internal/profile/android.go @@ -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) // "" refers to the constructor in which case it's more readable to omit the method name. Note the method name diff --git a/internal/profile/legacy.go b/internal/profile/legacy.go index 6b76d84..2139ee3 100644 --- a/internal/profile/legacy.go +++ b/internal/profile/legacy.go @@ -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 @@ -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 @@ -494,8 +494,13 @@ func getEventTimeFromElapsedNanoseconds(ns uint64) EventTime { } func unmarshalSampleProfile(p json.RawMessage) (sample.Trace, error) { + var objmap map[string]json.RawMessage + err := json.Unmarshal(p, &objmap) + if err != nil { + return sample.Trace{}, err + } var st sample.Trace - err := json.Unmarshal(p, &st) + err = json.Unmarshal(objmap["profile"], &st) if err != nil { return sample.Trace{}, err }