atc0005 / go-nagios

Shared Golang package for Nagios plugins
MIT License
8 stars 3 forks source link

Replace direct use of runtime.Stack with debug.Stack() #68

Closed atc0005 closed 3 years ago

atc0005 commented 3 years ago

While reviewing a recent error report sent via Nagios over Teams, I noticed that the stack trace details that I wanted were truncated. This is due to the current limit set here:

https://github.com/atc0005/go-nagios/blob/8007ac77bae39dcef015975e9d49b74d53aba92c/nagios.go#L144-L148

After some digging (see ref links), I learned that the debug.Stack() function wraps runtime.Stack() and automatically grows the slice as needed to capture the entire stack trace. This could be used to capture the entire trace, vs truncating it and potentially losing access to needed details.

refs: