Skip to content

Commit

Permalink
Added missing conversion to json model
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKunz committed Jan 24, 2024
1 parent 3fb4835 commit b57fa2b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 31 deletions.
17 changes: 17 additions & 0 deletions model/modeljson/internal/marshal_fastjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 16 additions & 15 deletions model/modeljson/internal/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
package modeljson

type Transaction struct {

Check failure on line 20 in model/modeljson/internal/transaction.go

View workflow job for this annotation

GitHub Actions / lint

struct with 240 pointer bytes could be 208
SpanCount SpanCount `json:"span_count,omitempty"`
UserExperience *UserExperience `json:"experience,omitempty"`
Custom KeyValueSlice `json:"custom,omitempty"`
Marks map[string]map[string]float64 `json:"marks,omitempty"`
Message *Message `json:"message,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Result string `json:"result,omitempty"`
ID string `json:"id,omitempty"`
DurationHistogram Histogram `json:"duration.histogram,omitempty"`
DroppedSpansStats []DroppedSpanStats `json:"dropped_spans_stats,omitempty"`
DurationSummary SummaryMetric `json:"duration.summary,omitempty"`
RepresentativeCount float64 `json:"representative_count,omitempty"`
Sampled bool `json:"sampled,omitempty"`
Root bool `json:"root,omitempty"`
SpanCount SpanCount `json:"span_count,omitempty"`
UserExperience *UserExperience `json:"experience,omitempty"`
Custom KeyValueSlice `json:"custom,omitempty"`
Marks map[string]map[string]float64 `json:"marks,omitempty"`
Message *Message `json:"message,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Result string `json:"result,omitempty"`
ID string `json:"id,omitempty"`
DurationHistogram Histogram `json:"duration.histogram,omitempty"`
DroppedSpansStats []DroppedSpanStats `json:"dropped_spans_stats,omitempty"`
DurationSummary SummaryMetric `json:"duration.summary,omitempty"`
RepresentativeCount float64 `json:"representative_count,omitempty"`
Sampled bool `json:"sampled,omitempty"`
Root bool `json:"root,omitempty"`
ProfilerStackTraceIds []string `json:"profiler_stack_trace_ids,omitempty"`
}

type SpanCount struct {
Expand Down
15 changes: 8 additions & 7 deletions model/modeljson/transaction.pb.json.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ import (

func TransactionModelJSON(e *modelpb.Transaction, out *modeljson.Transaction, metricset bool) {
*out = modeljson.Transaction{
ID: e.Id,
Type: e.Type,
Name: e.Name,
Result: e.Result,
Sampled: e.Sampled,
Root: e.Root,
RepresentativeCount: e.RepresentativeCount,
ID: e.Id,
Type: e.Type,
Name: e.Name,
Result: e.Result,
Sampled: e.Sampled,
Root: e.Root,
RepresentativeCount: e.RepresentativeCount,
ProfilerStackTraceIds: e.ProfilerStackTraceIds,
}

if e.Custom != nil {
Expand Down
21 changes: 12 additions & 9 deletions model/modeljson/transaction.pb.json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ func TestTransactionToModelJSON(t *testing.T) {
Count: 6,
Sum: 7,
},
RepresentativeCount: 8,
Sampled: true,
Root: true,
RepresentativeCount: 8,
Sampled: true,
Root: true,
ProfilerStackTraceIds: []string{"foo", "foo", "bar"},
},
expectedNoMetricset: &modeljson.Transaction{
SpanCount: modeljson.SpanCount{
Expand All @@ -134,9 +135,10 @@ func TestTransactionToModelJSON(t *testing.T) {
Count: 6,
Sum: 7,
},
RepresentativeCount: 8,
Sampled: true,
Root: true,
RepresentativeCount: 8,
Sampled: true,
Root: true,
ProfilerStackTraceIds: []string{"foo", "foo", "bar"},
},
expectedMetricset: &modeljson.Transaction{
SpanCount: modeljson.SpanCount{
Expand Down Expand Up @@ -174,9 +176,10 @@ func TestTransactionToModelJSON(t *testing.T) {
Count: 6,
Sum: 7,
},
RepresentativeCount: 8,
Sampled: true,
Root: true,
RepresentativeCount: 8,
Sampled: true,
Root: true,
ProfilerStackTraceIds: []string{"foo", "foo", "bar"},
},
},
}
Expand Down

0 comments on commit b57fa2b

Please sign in to comment.