Documentation
¶
Overview ¶
Package spanerror records errors and panics on spans without their text. Forge never puts an error message on a span: the status description is the error's class and the exception event carries exception.type only. It imports nothing from forge, so the router and the telemetry package can both use it.
Index ¶
Constants ¶
const PanicClass = "panic"
PanicClass is what a recovered panic is recorded as. The panic value never goes on the span.
Variables ¶
This section is empty.
Functions ¶
func AddException ¶
AddException adds an exception event whose only attribute is exception.type, plus exception.stacktrace when stack is true. It leaves the span's status alone.
func ErrorClass ¶
ErrorClass names err without its message: context.Canceled or context.DeadlineExceeded when err is or wraps one, otherwise the Go type of the innermost error in its Unwrap chain, so a wrapped driver error reports the driver's type rather than *fmt.wrapError. Error text can quote a DSN, a credential or a bound query value, so forge puts only this on a span.
func RecordError ¶
RecordError gives span an Error status described by err's class and adds an exception event that carries only exception.type. It does nothing for a nil err. Use it in place of span.RecordError, which copies err.Error() onto the span as exception.message.
func RecordPanic ¶
RecordPanic gives span an Error status described as PanicClass and adds an exception event of that type. With stack, the event also carries the goroutine's stack trace, which names code locations and holds no request data. Call it from the deferred function that recovered the panic, so the stack still includes the frames that panicked.
Types ¶
This section is empty.