func()

in internal/sourcemap/processor.go [110:164]


func (p BatchProcessor) processStacktraceFrame(
	ctx context.Context,
	service *modelpb.Service,
	frame *modelpb.StacktraceFrame,
	prevFunction string,
) (bool, string) {
	if frame.Colno == nil || frame.Lineno == nil || frame.AbsPath == "" {
		return false, ""
	}

	path := maybeCleanURLPath(frame.AbsPath)
	mapper, err := p.Fetcher.Fetch(ctx, service.Name, service.Version, path)
	if err != nil {
		frame.SourcemapError = err.Error()
		p.Logger.Debugf("failed to fetch sourcemap with path (%s): %s", path, frame.SourcemapError)
		return false, ""
	}
	if mapper == nil {
		p.Logger.Debugf("returned empty mapper: %s", path)
		return false, ""
	}
	file, function, lineno, colno, ctxLine, preCtx, postCtx, err := Map(mapper, *frame.Lineno, *frame.Colno)
	if err != nil {
		p.Logger.Errorf("failed to map sourcemap %s: %v", path, err)
		return false, ""
	}

	if frame.Original == nil {
		frame.Original = &modelpb.Original{}
	}

	// Store original source information.
	frame.Original.Colno = frame.Colno
	frame.Original.AbsPath = frame.AbsPath
	frame.Original.Function = frame.Function
	frame.Original.Lineno = frame.Lineno
	frame.Original.Filename = frame.Filename
	frame.Original.Classname = frame.Classname

	if file != "" {
		frame.Filename = file
	}
	frame.Colno = &colno
	frame.Lineno = &lineno
	frame.AbsPath = path
	frame.SourcemapUpdated = true
	frame.Function = prevFunction
	frame.ContextLine = ctxLine
	frame.PreContext = preCtx
	frame.PostContext = postCtx
	if function == "" {
		function = "<unknown>"
	}
	return true, function
}