From a01970df8028c7c061d86ad1eea641f31b2b19de Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Wed, 24 Jan 2024 11:28:42 -0500 Subject: [PATCH 1/2] ref(functions): Clean up Kafka message --- cmd/vroom/kafka.go | 62 +++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/cmd/vroom/kafka.go b/cmd/vroom/kafka.go index af36a5c..4d6b993 100644 --- a/cmd/vroom/kafka.go +++ b/cmd/vroom/kafka.go @@ -1,8 +1,6 @@ package main import ( - "strconv" - "github.com/getsentry/vroom/internal/nodetree" "github.com/getsentry/vroom/internal/platform" "github.com/getsentry/vroom/internal/profile" @@ -11,22 +9,16 @@ import ( type ( // FunctionsKafkaMessage is representing the struct we send to Kafka to insert functions in ClickHouse. FunctionsKafkaMessage struct { - Functions []nodetree.CallTreeFunction `json:"functions"` - Environment string `json:"environment,omitempty"` - ID string `json:"profile_id"` - Platform platform.Platform `json:"platform"` - ProjectID uint64 `json:"project_id"` - Received int64 `json:"received"` - Release string `json:"release,omitempty"` - Dist string `json:"dist,omitempty"` - RetentionDays int `json:"retention_days"` - Timestamp int64 `json:"timestamp"` - TransactionName string `json:"transaction_name"` - TransactionOp string `json:"transaction_op"` - TransactionStatus string `json:"transaction_status"` - HTTPMethod string `json:"http_method,omitempty"` - BrowserName string `json:"browser_name,omitempty"` - DeviceClass uint64 `json:"device_class,omitempty"` + Environment string `json:"environment,omitempty"` + Functions []nodetree.CallTreeFunction `json:"functions"` + ID string `json:"profile_id"` + Platform platform.Platform `json:"platform"` + ProjectID uint64 `json:"project_id"` + Received int64 `json:"received"` + Release string `json:"release,omitempty"` + RetentionDays int `json:"retention_days"` + Timestamp int64 `json:"timestamp"` + TransactionName string `json:"transaction_name"` } // ProfileKafkaMessage is representing the struct we send to Kafka to insert a profile in ClickHouse. @@ -57,31 +49,17 @@ type ( ) func buildFunctionsKafkaMessage(p profile.Profile, functions []nodetree.CallTreeFunction) FunctionsKafkaMessage { - tm := p.TransactionMetadata() - tt := p.TransactionTags() - - deviceClass, err := strconv.ParseUint(tt["device.class"], 10, 8) - if err != nil { - deviceClass = 0 - } - return FunctionsKafkaMessage{ - Functions: functions, - Environment: p.Environment(), - ID: p.ID(), - Platform: p.Platform(), - ProjectID: p.ProjectID(), - Received: p.Received().Unix(), - Release: p.Release(), - Dist: tm.Dist, - RetentionDays: p.RetentionDays(), - Timestamp: p.Timestamp().Unix(), - TransactionName: p.Transaction().Name, - TransactionOp: tm.TransactionOp, - TransactionStatus: tm.TransactionStatus, - HTTPMethod: tm.HTTPMethod, - BrowserName: tt["browser.name"], - DeviceClass: deviceClass, + Environment: p.Environment(), + Functions: functions, + ID: p.ID(), + Platform: p.Platform(), + ProjectID: p.ProjectID(), + Received: p.Received().Unix(), + Release: p.Release(), + RetentionDays: p.RetentionDays(), + Timestamp: p.Timestamp().Unix(), + TransactionName: p.Transaction().Name, } } From 4c5c1368e1a2c4c8eddb7558160485dc3bc8eccd Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Wed, 24 Jan 2024 11:31:12 -0500 Subject: [PATCH 2/2] Add a CHANGELOG entry --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a99c05f..7e6f869 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## Unreleased + **Features**: - Add support for speedscope rendering of Android reactnative profiles ([#386](https://github.com/getsentry/vroom/pull/386)) @@ -18,7 +20,7 @@ - Bump trufflesecurity/trufflehog from 3.63.8 to 3.63.9 ([#389](https://github.com/getsentry/vroom/pull/389)) - Bump trufflesecurity/trufflehog from 3.63.9 to 3.63.10 ([#391](https://github.com/getsentry/vroom/pull/391)) - Bump trufflesecurity/trufflehog from 3.63.10 to 3.63.11 ([#393](https://github.com/getsentry/vroom/pull/393)) - +- ref(functions): Clean up Kafka message ([#394](https://github.com/getsentry/vroom/pull/394)) ## 23.12.0