-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed as not planned
Closed as not planned
Copy link
Labels
area:tracePart of OpenTelemetry tracingPart of OpenTelemetry tracingenhancementNew feature or requestNew feature or request
Description
Problem Statement
The existing RecordError() method doesn't currently allow errors to propagate implementation-specific information back to the telemetry framework. Right now, the framework reflects the static typename of the error, but that's not enough to differentiate errors in many cases, for example:
- RPC/REST errors which share a uniform type struct for RPC errors such as grpc.Status
- Protocol errors such as MySQL Errors
Proposed Solution
Standardize on the definition of the type of an error (static) and the class of an error (runtime).
- The type of the error remains the same–the type as returned by the Golang reflect package
- The class of an error is implementation-defined and propagated to OpenTelemetry via interface implementation.
- The place an error is recorded is not necessarily the same place that an error was captured (such as middleware), errors should be able to propogate the stack trace via an interface.
- Errors should be able to propogate additional error-specific attributes.
Reference
- Define the following interfaces:
type (
// StackTracer propagates an error's class.
StackTracer interface {
OTStackTrace() []uintptr
}
// ErrorClasser propogates an error's class.
ErrorClasser interface {
OTErrorClass() string
}
// ErrorAttributer propogates an error's attributes.
ErrorAttributer interface {
OTErrorAttributes() []attribute.KeyValue
}
)Optionally, additionally provide the following interface to allow conversion from types that cannot implement the above.
type (
ErrorConverter interface {
OpenTelemetryError() error
}
)Alternatives
n/a
Prior Art
Additional Context
n/a
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:tracePart of OpenTelemetry tracingPart of OpenTelemetry tracingenhancementNew feature or requestNew feature or request