Skip to content

Commit

Permalink
feat: Forward SDK info for legacy profiles (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops authored Sep 23, 2024
1 parent 6e2c2aa commit cc149a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
- Add optional generation of metrics during flamegraph aggregation ([#494](https://github.com/getsentry/vroom/pull/494))
- Ingest function metrics from profile chunks ([#495](https://github.com/getsentry/vroom/pull/495))
- Annotate flamegraph with profile data ([#501](https://github.com/getsentry/vroom/pull/501)), ([#502](https://github.com/getsentry/vroom/pull/502)), ([#503](https://github.com/getsentry/vroom/pull/503))
- Forward SDK info to Kafka. ([#507](https://github.com/getsentry/vroom/pull/507))
- Forward SDK info for sample profiles to Kafka. ([#507](https://github.com/getsentry/vroom/pull/507))
- Forward SDK info for legacy profiles to Kafka. ([#515](https://github.com/getsentry/vroom/pull/515))

**Bug Fixes**:

Expand Down
14 changes: 9 additions & 5 deletions internal/profile/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"time"

"github.com/getsentry/vroom/internal/clientsdk"
"github.com/getsentry/vroom/internal/debugmeta"
"github.com/getsentry/vroom/internal/frame"
"github.com/getsentry/vroom/internal/measurements"
Expand Down Expand Up @@ -43,10 +44,10 @@ type (
}

RawProfile struct {
Sampled bool `json:"sampled"`
AndroidAPILevel uint32 `json:"android_api_level,omitempty"`
Architecture string `json:"architecture,omitempty"`
BuildID string `json:"build_id,omitempty"`
ClientSDK clientsdk.ClientSDK `json:"client_sdk"`
DebugMeta debugmeta.DebugMeta `json:"debug_meta,omitempty"`
DeviceClassification string `json:"device_classification"`
DeviceLocale string `json:"device_locale"`
Expand All @@ -57,16 +58,17 @@ type (
DeviceOSVersion string `json:"device_os_version"`
DurationNS uint64 `json:"duration_ns"`
Environment string `json:"environment,omitempty"`
JsProfile json.RawMessage `json:"js_profile,omitempty"`
Measurements map[string]measurements.Measurement `json:"measurements,omitempty"`
OrganizationID uint64 `json:"organization_id"`
Options utils.Options `json:"options,omitempty"`
OrganizationID uint64 `json:"organization_id"`
Platform platform.Platform `json:"platform"`
Profile json.RawMessage `json:"profile,omitempty"`
JsProfile json.RawMessage `json:"js_profile,omitempty"`
ProfileID string `json:"profile_id"`
ProjectID uint64 `json:"project_id"`
Received timeutil.Time `json:"received"`
RetentionDays int `json:"retention_days"`
Sampled bool `json:"sampled"`
Timestamp time.Time `json:"timestamp"`
TraceID string `json:"trace_id"`
TransactionID string `json:"transaction_id"`
Expand Down Expand Up @@ -248,6 +250,8 @@ func (p *LegacyProfile) Metadata() metadata.Metadata {
DeviceOSVersion: p.DeviceOSVersion,
ID: p.ProfileID,
ProjectID: strconv.FormatUint(p.GetProjectID(), 10),
SDKName: p.ClientSDK.Name,
SDKVersion: p.ClientSDK.Version,
Timestamp: p.Timestamp.Unix(),
TraceDurationMs: float64(p.DurationNS) / 1_000_000,
TransactionID: p.TransactionID,
Expand Down Expand Up @@ -364,10 +368,10 @@ func (p LegacyProfile) GetOptions() utils.Options {
// for ReactNative.
// See: https://github.com/facebook/react-native-website/blob/43bc708c784be56b68a4d74711dd8824851b38f9/website/architecture/threading-model.md
func sampleToAndroidFormat(p sample.Trace, offset uint64, usedTids map[uint64]void) Android {
//var Clock Clock
// var Clock Clock
var events []AndroidEvent
var methods []AndroidMethod
//var StartTime uint64
// var StartTime uint64
var threads []AndroidThread

var lastStack []int
Expand Down
14 changes: 8 additions & 6 deletions internal/speedscope/speedscope.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"time"

"github.com/getsentry/vroom/internal/clientsdk"
"github.com/getsentry/vroom/internal/debugmeta"
"github.com/getsentry/vroom/internal/measurements"
"github.com/getsentry/vroom/internal/platform"
Expand Down Expand Up @@ -110,10 +111,10 @@ type (
}

ProfileView struct {
Sampled bool `json:"sampled"` //nolint:unused
AndroidAPILevel uint32 `json:"androidAPILevel,omitempty"` //nolint:unused
Architecture string `json:"architecture,omitempty"` //nolint:unused
BuildID string `json:"-"` //nolint:unused
AndroidAPILevel uint32 `json:"androidAPILevel,omitempty"` //nolint:unused
Architecture string `json:"architecture,omitempty"` //nolint:unused
BuildID string `json:"-"` //nolint:unused
ClientSDK clientsdk.ClientSDK `json:"-"`
DebugMeta debugmeta.DebugMeta `json:"-"` //nolint:unused
DeviceClassification string `json:"deviceClassification"` //nolint:unused
DeviceLocale string `json:"deviceLocale"` //nolint:unused
Expand All @@ -124,16 +125,17 @@ type (
DeviceOSVersion string `json:"deviceOSVersion"` //nolint:unused
DurationNS uint64 `json:"durationNS"` //nolint:unused
Environment string `json:"environment,omitempty"` //nolint:unused
JsProfile json.RawMessage `json:"-"` //nolint:unused
Measurements map[string]measurements.Measurement `json:"-"` //nolint:unused
Options utils.Options `json:"-"` //nolint:unused
OrganizationID uint64 `json:"organizationID"`
Options utils.Options `json:"-"` //nolint:unused
Platform platform.Platform `json:"platform"` //nolint:unused
Profile json.RawMessage `json:"-"` //nolint:unused
JsProfile json.RawMessage `json:"-"` //nolint:unused
ProfileID string `json:"profileID"` //nolint:unused
ProjectID uint64 `json:"projectID"` //nolint:unused
Received timeutil.Time `json:"received"` //nolint:unused
RetentionDays int `json:"-"` //nolint:unused
Sampled bool `json:"sampled"` //nolint:unused
Timestamp time.Time `json:"timestamp,omitempty"` //nolint:unused
TraceID string `json:"traceID"` //nolint:unused
TransactionID string `json:"transactionID"` //nolint:unused
Expand Down

0 comments on commit cc149a0

Please sign in to comment.