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
{{ message }}
Repository navigation
add a mechanism to record db.response.status_code #377
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.
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.
Activity
XSAM commentedon Oct 21, 2024
@aereal Thanks for raising this issue!
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.signalcould bemetricortrace. What do you think?Please also notice that the
db.response.status_codeattribute is an experimental attribute. This attribute might be changed in the future.cristiangreco commentedon Jul 13, 2025
Hi @XSAM ! 👋 Now that
db.response.status_codeis stable, are you considering going ahead with your proposed changes?Add WithSpanErrorAttributesGetter to set error attributes on spans (#651