Frontend logging: Remove Sentry javascript agent support (#67493)

* remove Sentry

* fix sourcemap resolve
This commit is contained in:
Domas
2023-05-02 12:10:56 +03:00
committed by GitHub
parent 9614dc2446
commit 15d4169813
38 changed files with 47 additions and 1288 deletions

View File

@ -1,33 +1,5 @@
package frontendlogging
// ResolveSourceLocation resolves minified source location to original source location
func ResolveSourceLocation(store *SourceMapStore, frame *Frame) (*Frame, error) {
smap, err := store.getSourceMap(frame.Filename)
if err != nil {
return nil, err
}
if smap == nil {
return nil, nil
}
file, function, line, col, ok := smap.consumer.Source(frame.Lineno, frame.Colno)
if !ok {
return nil, nil
}
// unfortunately in many cases go-sourcemap fails to determine the original function name.
// not a big issue as long as file, line and column are correct
if len(function) == 0 {
function = "?"
}
return &Frame{
Filename: file,
Lineno: line,
Colno: col,
Function: function,
}, nil
}
// TransformException will attempt to resolved all monified source locations in the stacktrace with original source locations
func TransformException(ex *Exception, store *SourceMapStore) *Exception {
if ex.Stacktrace == nil {
@ -37,7 +9,7 @@ func TransformException(ex *Exception, store *SourceMapStore) *Exception {
for _, frame := range ex.Stacktrace.Frames {
frame := frame
mappedFrame, err := ResolveSourceLocation(store, &frame)
mappedFrame, err := store.resolveSourceLocation(frame)
if err != nil {
frames = append(frames, frame)
} else if mappedFrame != nil {