birschick-bq commented on code in PR #4655:
URL: https://github.com/apache/arrow-adbc/pull/4655#discussion_r3777947630


##########
go/adbc/driver/internal/shared_utils.go:
##########
@@ -781,12 +783,75 @@ func EndSpan(span trace.Span, err error, options 
...trace.SpanEndOption) {
 func EndSpanWithError(span trace.Span, err *error, options 
...trace.SpanEndOption) {
        if err != nil && *err != nil {
                span.RecordError(*err)
-               if adbcError, ok := (*err).(adbc.Error); ok {
+               setSpanStatus(span, *err)
+       } else {
+               setSpanStatus(span, nil)
+       }
+       span.End(options...)
+}
+
+type EndSpanHelper struct {
+       span          trace.Span
+       err           *error
+       errorRecorded bool
+       startTime     *time.Time
+       options       []trace.SpanEndOption
+}
+
+func NewEndSpanHelper(span trace.Span) *EndSpanHelper {
+       return &EndSpanHelper{
+               span:          span,
+               errorRecorded: false,
+               startTime:     nil,
+               err:           nil,
+       }
+}
+
+func (h *EndSpanHelper) WithError(err error) *EndSpanHelper {

Review Comment:
   @lidavidm - I will add docs for the helper and methods. Thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to