From a52c931f34585151bd858c6f690b040c85b345d5 Mon Sep 17 00:00:00 2001 From: viglia Date: Tue, 3 Dec 2024 06:54:04 +0100 Subject: [PATCH] ref: add android chunk calltree implementation (#536) * add android chunk calltree implementation --- CHANGELOG.md | 1 + internal/chunk/android.go | 11 +++++++++-- internal/chunk/chunk.go | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9ecfd..1c8c4dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ - Add utility to merge a list of android chunks and generate a speedscope result ([#531](https://github.com/getsentry/vroom/pull/531)) - Remove unused legacy flamegraph code path. ([#533](https://github.com/getsentry/vroom/pull/533)) - Remove generic metrics ingestion ([#534](https://github.com/getsentry/vroom/pull/534)) +- Add android chunk calltree implementation and signature definition to the chunk interface ([#536](https://github.com/getsentry/vroom/pull/536)) - Update sentry-go dependency to v0.29.1 ([#535](https://github.com/getsentry/vroom/pull/535)) - Lower number of concurrent reads ([#537](https://github.com/getsentry/vroom/pull/537)) - Remove unused metrics summary kafka writer ([#538](https://github.com/getsentry/vroom/pull/538)) diff --git a/internal/chunk/android.go b/internal/chunk/android.go index a2da10b..a001311 100644 --- a/internal/chunk/android.go +++ b/internal/chunk/android.go @@ -2,6 +2,7 @@ package chunk import ( "encoding/json" + "strconv" "time" "github.com/getsentry/vroom/internal/clientsdk" @@ -53,8 +54,14 @@ func (c AndroidChunk) DurationMS() uint64 { return uint64(time.Duration(c.DurationNS).Milliseconds()) } -func (c AndroidChunk) CallTrees() map[uint64][]*nodetree.Node { - return c.Profile.CallTrees() +func (c AndroidChunk) CallTrees(_ *string) (map[string][]*nodetree.Node, error) { + callTrees := c.Profile.CallTrees() + stringThreadCallTrees := make(map[string][]*nodetree.Node) + for tid, callTree := range callTrees { + threadID := strconv.FormatUint(tid, 10) + stringThreadCallTrees[threadID] = callTree + } + return stringThreadCallTrees, nil } func (c AndroidChunk) SDKName() string { diff --git a/internal/chunk/chunk.go b/internal/chunk/chunk.go index cc715c8..196fcd6 100644 --- a/internal/chunk/chunk.go +++ b/internal/chunk/chunk.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/getsentry/vroom/internal/frame" + "github.com/getsentry/vroom/internal/nodetree" "github.com/getsentry/vroom/internal/platform" "github.com/getsentry/vroom/internal/utils" ) @@ -21,6 +22,7 @@ type ( GetRetentionDays() int GetOptions() utils.Options GetFrameWithFingerprint(uint32) (frame.Frame, error) + CallTrees(activeThreadID *string) (map[string][]*nodetree.Node, error) DurationMS() uint64 EndTimestamp() float64