This repository was archived by the owner on May 23, 2023. It is now read-only.

Description
Use Case
I am using open-tracing for all distributed tracing.
Problem
When I log an error with
errors.WithStack(err)
ext.Error.Set(span, true)
span.LogFields(log.Error(e))
It just gives the error string rather than stack trace or any supporting information.
Proposal
Treat errors as objects not strings
github.com/opentracing/opentracing-go/log/field.go
replace
case errorType:
if err, ok := lf.interfaceVal.(error); ok {
visitor.EmitString(lf.key, err.Error())
} else {
visitor.EmitString(lf.key, "<nil>")
}
with
case errorType:
if err, ok := lf.interfaceVal.(error); ok {
visitor.EmitObject(lf.key, err)
} else {
visitor.EmitString(lf.key, "<nil>")
}
the implementers are then free to use https://godoc.org/github.com/pkg/errors#hdr-Formatted_printing_of_errors just like is used in jaeger for EmitObject
func (ml fieldsAsMap) EmitObject(key string, value interface{}) {
ml[key] = fmt.Sprintf("%+v", value)
}
Which will give all the information
Questions to address (if any)