mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
logging: report issues in rbdImage.DEKStore API with stacks
It helps to get a stack trace when debugging issues. Certain things are considered bugs in the code (like missing attributes in a struct), and might cause a panic in certain occasions. In this case, a missing string will not panic, but the behaviour will also not be correct (DEKs getting encrypted, but unable to decrypt). Clearly logging this as a BUG is probably better than calling panic(). Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
35d58a7d5a
commit
8b8480017b
@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -333,3 +334,12 @@ func getKeys(m map[string]interface{}) []string {
|
||||
|
||||
return keys
|
||||
}
|
||||
|
||||
// CallStack returns the stack of the calls in the current goroutine. Useful
|
||||
// for debugging or reporting errors. This is a friendly alternative to
|
||||
// assert() or panic().
|
||||
func CallStack() string {
|
||||
stack := make([]byte, 2048)
|
||||
_ = runtime.Stack(stack, false)
|
||||
return string(stack)
|
||||
}
|
||||
|
Reference in New Issue
Block a user