birschick-bq commented on code in PR #4659:
URL: https://github.com/apache/arrow-adbc/pull/4659#discussion_r3817782230
##########
go/adbc/driver/flightsql/flightsql_database.go:
##########
@@ -369,35 +371,52 @@ func (d *databaseImpl) SetOptionDouble(key string, value
float64) error {
return d.DatabaseImplBase.SetOptionDouble(key, value)
}
-func (d *databaseImpl) Close() error {
- if d.Logger != nil {
- d.Logger.Info("FlightSQL database closed",
- "target", d.uri.String(),
- )
- }
- return d.DatabaseImplBase.Close()
+func (d *databaseImpl) Close() (err error) {
+ const spanName = "FlightSQL.Database.Close"
+ startTime := time.Now()
+ var span trace.Span
+ _, span = internal.StartSpan(context.Background(), spanName, d)
+
+ span.AddEvent("closing",
trace.WithAttributes(attribute.String("target", d.uri.String())))
+ return closeTracing(context.Background(), &d.DatabaseImplBase,
func(flushErr error) {
+ internal.NewEndSpanHelper(span).
+ WithError(flushErr).
+ WithStartTime(startTime).
+ EndSpan()
+ })
}
-func getFlightClient(ctx context.Context, loc string, d *databaseImpl,
authMiddle *bearerAuthMiddleware, cookies flight.CookieMiddleware)
(*flightsql.Client, error) {
+type tracingLifecycle interface {
+ ForceFlushTracing(context.Context) error
+ Close() error
+}
+
+func closeTracing(ctx context.Context, lifecycle tracingLifecycle, finishSpan
func(error)) error {
+ flushErr := lifecycle.ForceFlushTracing(ctx)
+ finishSpan(flushErr)
+ shutdownErr := lifecycle.Close()
+ return errors.Join(flushErr, shutdownErr)
+}
+
+func getFlightClient(ctx context.Context, loc string, d *databaseImpl,
authMiddle *bearerAuthMiddleware, cookies flight.CookieMiddleware, span
trace.Span) (client *flightsql.Client, err error) {
middleware := []flight.ClientMiddleware{
- {
- Unary: makeUnaryLoggingInterceptor(d.Logger),
- Stream: makeStreamLoggingInterceptor(d.Logger),
- },
flight.CreateClientMiddleware(authMiddle),
{
Unary: unaryTimeoutInterceptor,
Stream: streamTimeoutInterceptor,
},
+ {Stream: responseMetadataStreamInterceptor},
Review Comment:
WIP
--
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]