DataDog / dd-trace-go

Datadog Go Library including APM tracing, profiling, and security monitoring.
https://docs.datadoghq.com/tracing/
Other
640 stars 432 forks source link

More precise span error in gin middleware #2815

Open theo303 opened 1 month ago

theo303 commented 1 month ago

Hello ! First of all, excuse me if I'm using the wrong tool/place to ask a question, I'm not used to this.

I'm wondering if I can improve how errors are displayed in datadog for my http requests (I'm using gin). Now I have this:

image

I would like ideally to have a full go error displayed here.

I guess it's the default behavior because the gin middleware calls FinishRequestSpan(). Since this function is deferred after all handlers have finished, it will override the error in the span if I try to set it before ?

Is this the desired behavior ? Should I make my own middleware and stop using the one in contrib/gin-gonic ?

Thanks !

darccio commented 1 month ago

@theo303 Thanks for reaching out! This is something we've found in other contribs. Allow us to review it internally and we'll come back to you.