jadewang-db commented on code in PR #3191:
URL: https://github.com/apache/arrow-adbc/pull/3191#discussion_r2237552832


##########
csharp/src/Drivers/Databricks/Telemetry/DatabricksActivityListener.cs:
##########
@@ -0,0 +1,73 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more

Review Comment:
   please add a readme file in this folder, on how is the file generated. 



##########
csharp/src/Drivers/Databricks/Telemetry/TelemetryHelper.cs:
##########
@@ -0,0 +1,170 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Reflection;
+using System.Diagnostics;
+using System.Collections.Concurrent;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Threading.Tasks;
+using Apache.Arrow.Adbc.Drivers.Databricks.Telemetry.Model;
+using Apache.Arrow.Adbc.Drivers.Databricks.Telemetry.Enums;
+using Apache.Arrow.Adbc.Drivers.Apache.Spark;
+using System.Text.Json;
+
+namespace Apache.Arrow.Adbc.Drivers.Databricks.Telemetry
+{
+    public class TelemetryHelper
+    {
+        private static List<TelemetryFrontendLog> _eventsBatch = new 
List<TelemetryFrontendLog>();
+        private static readonly object _eventsBatchLock = new object();
+        private static readonly int _maxBatchSize = 5;

Review Comment:
   please add config



##########
csharp/src/Drivers/Databricks/Telemetry/DatabricksActivityListener.cs:
##########
@@ -0,0 +1,73 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+using System.Diagnostics;
+using Apache.Arrow.Adbc.Tracing;
+using Apache.Arrow.Adbc.Drivers.Databricks.Telemetry.Model;
+using Apache.Arrow.Adbc.Drivers.Databricks.Telemetry.Enums;
+using System.IO;
+using System;
+
+namespace Apache.Arrow.Adbc.Drivers.Databricks.Telemetry
+{
+    public class DatabricksActivityListener : IDisposable
+    {
+
+        private ActivityListener _activityListener;
+
+        public DatabricksActivityListener()
+        {
+            this._activityListener = new ActivityListener
+            {
+                //ShouldListenTo = (activitySource) => activitySource.Name == 
sourceName,
+                ShouldListenTo = _ => true,

Review Comment:
   make these passed in or configurable?



##########
csharp/src/Drivers/Databricks/DatabricksConnection.cs:
##########
@@ -66,13 +71,22 @@ internal class DatabricksConnection : SparkHttpConnection
         private string _traceParentHeaderName = "traceparent";
         private bool _traceStateEnabled = false;
 
+        private DatabricksActivityListener _listener;
+        private DriverConnectionParameters _connectionParams;
+        private HostDetails _hostDetails;
+        private ClientContext _clientContext;
+
         // Default namespace
         private TNamespace? _defaultNamespace;
 
         private HttpClient? _authHttpClient;
 
         public DatabricksConnection(IReadOnlyDictionary<string, string> 
properties) : base(properties)
         {
+            _listener = new DatabricksActivityListener();

Review Comment:
   will this cause duplicate report ?  



##########
csharp/src/Drivers/Databricks/Telemetry/TelemetryClient.cs:
##########
@@ -0,0 +1,124 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text.Json;
+using System.Threading.Tasks;
+using Apache.Arrow.Adbc.Drivers.Databricks.Telemetry.Model;
+
+namespace Apache.Arrow.Adbc.Drivers.Databricks.Telemetry
+{
+    public class TelemetryClient
+    {
+        private readonly HttpClient _httpClient;
+        private readonly string? _telemetryUrl;
+        private readonly string? _accessToken;
+
+        public TelemetryClient(string? hostUrl, string? accessToken)
+        {
+            _httpClient = new HttpClient();

Review Comment:
   should we have this passed in?



-- 
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