mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 09:35:36 -05:00
adding a new event for when definition is requested (#167)
* sending telemetry events for intellisense usage
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
OwnerUri = ownerUri;
|
||||
ConnectionDetails = details;
|
||||
ConnectionId = Guid.NewGuid();
|
||||
IntellisenseMetrics = new InteractionMetrics<double>(new int[] { 50, 100, 200, 500, 1000, 2000 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,5 +50,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
/// The connection to the SQL database that commands will be run against.
|
||||
/// </summary>
|
||||
public DbConnection SqlConnection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Intellisense Metrics
|
||||
/// </summary>
|
||||
public InteractionMetrics<double> IntellisenseMetrics { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true is the db connection is to a SQL db
|
||||
/// </summary>
|
||||
public bool IsAzure { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
@@ -290,6 +291,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
AzureVersion = serverInfo.AzureVersion,
|
||||
OsVersion = serverInfo.OsVersion
|
||||
};
|
||||
connectionInfo.IsAzure = serverInfo.IsCloud;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@@ -356,6 +358,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send a telemetry notification for intellisense performance metrics
|
||||
ServiceHost.SendEvent(TelemetryNotification.Type, new TelemetryParams()
|
||||
{
|
||||
Params = new TelemetryProperties
|
||||
{
|
||||
Properties = new Dictionary<string, string>
|
||||
{
|
||||
{ "IsAzure", info.IsAzure ? "1" : "0" }
|
||||
},
|
||||
EventName = TelemetryEventNames.IntellisenseQuantile,
|
||||
Measures = info.IntellisenseMetrics.Quantile
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Close the connection
|
||||
info.SqlConnection.Close();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user