jeremytang-db commented on code in PR #3191: URL: https://github.com/apache/arrow-adbc/pull/3191#discussion_r2261674382
########## csharp/src/Drivers/Databricks/DatabricksConnection.cs: ########## @@ -281,6 +292,43 @@ private void ValidateProperties() { _identityFederationClientId = identityFederationClientId; } + + //Telemetry + var connectionParams = new DriverConnectionParameters(); + var hostDetails = new HostDetails(); + var clientContext = new ClientContext(); + string? token = null; + + if (Properties.TryGetValue(SparkParameters.AuthType, out string? authType)) + { + connectionParams.AuthMech = Util.StringToAuthMech(authType); + } + + if (Properties.TryGetValue(SparkParameters.HostName, out string? host)) + { + hostDetails.HostUrl = host; + } + if (Properties.TryGetValue(SparkParameters.Port, out string? port)) + { + hostDetails.Port = Int32.Parse(port); + } + connectionParams.HostInfo = hostDetails; + + if (Properties.TryGetValue(SparkParameters.UserAgentEntry, out string? userAgent)) + { + clientContext.UserAgent = userAgent; + } + + if(Properties.TryGetValue(SparkParameters.AccessToken, out string? accessToken)) + { + token = accessToken; + } + else if(Properties.TryGetValue(SparkParameters.Token, out string? accesstoken)) + { + token = accesstoken; + } + _telemetryHelper = new TelemetryHelper(hostDetails.HostUrl, token); + _telemetryHelper.SetParameters(connectionParams, clientContext); Review Comment: updated by adding a new method for telemetry ########## csharp/src/Drivers/Databricks/DatabricksConnection.cs: ########## @@ -76,15 +86,16 @@ internal class DatabricksConnection : SparkHttpConnection public DatabricksConnection(IReadOnlyDictionary<string, string> properties) : base(properties) { + _guid = Guid.NewGuid(); ValidateProperties(); + _databricksActivityListener = new DatabricksActivityListener(_telemetryHelper, this.AssemblyName, _guid); } public override IEnumerable<KeyValuePair<string, object?>>? GetActivitySourceTags(IReadOnlyDictionary<string, string> properties) { IEnumerable<KeyValuePair<string, object?>>? tags = base.GetActivitySourceTags(properties); - // TODO: Add any additional tags specific to Databricks connection - //tags ??= []; - //tags.Concat([new("key", "value")]); + tags ??= []; + tags.Concat([new("guid",_guid)]); Review Comment: updated -- 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