You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the library users can't extract the information from the error returned by the driver.
Proposed Solution
Add a new option like type ErrorEventAttributesGetter func(err error) []attribute.KeyValue and recordSpanError uses ErrorEventAttributesGetter's return values.
The users can pass the function that extracts the status information from the driver's concrete error type such as mysql.MySQLError.Number.
Alternatives
Add a new argument err error to AttributeGetter.
It is unreasonable because it breaks backward compatibilities.
Prior Art
No prior arts found.
Additional Context
The text was updated successfully, but these errors were encountered:
This is a good suggestion. I am considering creating an option to get attributes at the end of the operation for both traces and metrics. Something like type AttributeGetterOnEnd func(string signal, err error) []attribute.KeyValue. signal could be metric or trace. What do you think?
Please also notice that the db.response.status_code attribute is an experimental attribute. This attribute might be changed in the future.
Problem Statement
The latest semantic conventions has introduced
db.response.status_code
attribute that is the status code returned by the database.The latest otelsql provides AttributesGetter but it is called only when creating a span:
otelsql/utils.go
Line 101 in c335821
The
recordSpanError
internal function just callsRecordError
and has no mechanism to extract some information fromerr
.So the library users can't extract the information from the error returned by the driver.
Proposed Solution
Add a new option like
type ErrorEventAttributesGetter func(err error) []attribute.KeyValue
andrecordSpanError
usesErrorEventAttributesGetter
's return values.The users can pass the function that extracts the status information from the driver's concrete error type such as mysql.MySQLError.Number.
Alternatives
Add a new argument
err error
toAttributeGetter
.It is unreasonable because it breaks backward compatibilities.
Prior Art
No prior arts found.
Additional Context
The text was updated successfully, but these errors were encountered: