zeroshade commented on code in PR #2729: URL: https://github.com/apache/arrow-adbc/pull/2729#discussion_r2073721603
########## go/adbc/driver/internal/driverbase/database.go: ########## @@ -136,4 +200,113 @@ func (db *database) SetLogger(logger *slog.Logger) { } } +func (base *database) InitTracing(driverName string, driverVersion string) { + base.Base().InitTracing(driverName, driverVersion) +} + +func (base *DatabaseImplBase) InitTracing(driverName string, driverVersion string) { + var exporter sdktrace.SpanExporter = nil + var tracer trace.Tracer + + exporterName := os.Getenv("OTEL_TRACES_EXPORTER") + exporterType, _ := tryParseTraceExporterType(exporterName) + switch exporterType { + case TraceExporterConsole: + exporter, _ = newStdoutTraceExporter() + case TraceExporterOtlp: + exporter, _ = newOtlpTraceExporter(context.Background()) Review Comment: For now, having `Database.Close` use `context.Background()` is probably fine, I'm assuming it would require a change to `NewDatabase` because `InitTracing` is being called by it? Rather than changing the `NewDatabase` function, can we follow the common pattern of just adding a new method `NewDatabaseContext` which takes in a context, and have `NewDatabase` simply call that and pass in `context.Background()` so that callers have a choice/option? -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org