From 568e3ddc327046a2c41c0acd85f20be8b3d04c82 Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Thu, 17 Dec 2020 17:42:36 +0800 Subject: [PATCH] model: add "classname" to stacktrace frames This will be used by the OpenTelemetry exporter. We should probably be using this for named type methods in the Go Agent too, but that can come later. --- model/marshal_fastjson.go | 4 ++++ model/model.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/model/marshal_fastjson.go b/model/marshal_fastjson.go index 80a1e17e7..dc09df6be 100644 --- a/model/marshal_fastjson.go +++ b/model/marshal_fastjson.go @@ -1097,6 +1097,10 @@ func (v *StacktraceFrame) MarshalFastJSON(w *fastjson.Writer) error { w.RawString(",\"abs_path\":") w.String(v.AbsolutePath) } + if v.Classname != "" { + w.RawString(",\"classname\":") + w.String(v.Classname) + } if v.Column != nil { w.RawString(",\"colno\":") w.Int64(int64(*v.Column)) diff --git a/model/model.go b/model/model.go index 2a041bd57..ff64077bc 100644 --- a/model/model.go +++ b/model/model.go @@ -541,6 +541,9 @@ type StacktraceFrame struct { // use the package path (e.g. "net/http"). Module string `json:"module,omitempty"` + // Classname holds the name of the class to which the frame belongs. + Classname string `json:"classname,omitempty"` + // Function holds the name of the function to which the frame belongs. Function string `json:"function,omitempty"`