davidhcoe commented on code in PR #3315:
URL: https://github.com/apache/arrow-adbc/pull/3315#discussion_r2285896305
##########
csharp/src/Drivers/BigQuery/BigQueryConnection.cs:
##########
@@ -85,6 +92,48 @@ public BigQueryConnection(IReadOnlyDictionary<string,
string> properties) : base
}
}
+ private void TryInitTracerProvider()
+ {
+ // Avoid locking if the tracer provider is already set.
+ if (s_tracerProvider != null)
+ {
+ return;
+ }
+ // Avoid locking if the exporter option would not activate.
+ this.properties.TryGetValue(ExportersOptions.Exporter, out string?
exporterOption);
+ ExportersBuilder exportersBuilder =
ExportersBuilder.Build(this.ActivitySourceName, addDefaultExporters:
true).Build();
+ if (!exportersBuilder.WouldActivate(exporterOption))
+ {
+ return;
+ }
+
+ // Will likely activate the exporter, so we need to lock to ensure
thread safety.
+ lock (s_tracerProviderLock)
+ {
+ // Due to race conditions, we need to check again if the
tracer provider is already set.
+ if (s_tracerProvider != null)
+ {
+ return;
+ }
+
+ // Activates the exporter specified in the connection property
(if exists) or environment variable (if is set).
+ if (exportersBuilder.TryActivate(exporterOption, out string?
exporterName, out TracerProvider? tracerProvider,
ExportersOptions.Environment.Exporter) && tracerProvider != null)
+ {
+ s_tracerProvider = tracerProvider;
+ s_isFileExporterEnabled =
ExportersOptions.Exporters.AdbcFile.Equals(exporterName);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Conditional used to determines if it is safe to trace
+ /// </summary>
+ /// <remarks>
+ /// It is safe to write to some output types (ie, files) but not
others (ie, a shared resource).
+ /// </remarks>
+ /// <returns></returns>
+ internal static bool IsSafeToTrace => s_isFileExporterEnabled;
Review Comment:
is this for PII-type of data?
--
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]