mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-04 01:25:43 -05:00
Formatter and PeekDefinition Telemetry (#245)
- Add telemetry point for format requests - Update PeekDefinition telemetry so that it captures whether the attempt succeeded and if it was connected. This will help us understand whether our current behavior of just notifying success/failure to the output window was useful or not. It will also help us understand whether we're doing a good job implementing this / if we need to improve reliability and preformance.
This commit is contained in:
@@ -312,7 +312,6 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
EventName = TelemetryEventNames.PeekDefinitionRequested
|
||||
}
|
||||
});
|
||||
DocumentStatusHelper.SendTelemetryEvent(requestContext, TelemetryEventNames.PeekDefinitionRequested);
|
||||
DocumentStatusHelper.SendStatusChange(requestContext, textDocumentPosition, DocumentStatusHelper.DefinitionRequested);
|
||||
|
||||
if (WorkspaceService<SqlToolsSettings>.Instance.CurrentSettings.IsIntelliSenseEnabled)
|
||||
@@ -320,7 +319,8 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
// Retrieve document and connection
|
||||
ConnectionInfo connInfo;
|
||||
var scriptFile = LanguageService.WorkspaceServiceInstance.Workspace.GetFile(textDocumentPosition.TextDocument.Uri);
|
||||
LanguageService.ConnectionServiceInstance.TryFindConnection(scriptFile.ClientFilePath, out connInfo);
|
||||
bool isConnected = LanguageService.ConnectionServiceInstance.TryFindConnection(scriptFile.ClientFilePath, out connInfo);
|
||||
bool succeeded = false;
|
||||
DefinitionResult definitionResult = LanguageService.Instance.GetDefinition(textDocumentPosition, scriptFile, connInfo);
|
||||
if (definitionResult != null)
|
||||
{
|
||||
@@ -331,12 +331,29 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
else
|
||||
{
|
||||
await requestContext.SendResult(definitionResult.Locations);
|
||||
succeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
DocumentStatusHelper.SendTelemetryEvent(requestContext, CreatePeekTelemetryProps(succeeded, isConnected));
|
||||
}
|
||||
|
||||
DocumentStatusHelper.SendStatusChange(requestContext, textDocumentPosition, DocumentStatusHelper.DefinitionRequestCompleted);
|
||||
}
|
||||
|
||||
private static TelemetryProperties CreatePeekTelemetryProps(bool succeeded, bool connected)
|
||||
{
|
||||
return new TelemetryProperties
|
||||
{
|
||||
Properties = new Dictionary<string, string>
|
||||
{
|
||||
{ TelemetryPropertyNames.Succeeded, succeeded.ToOneOrZeroString() },
|
||||
{ TelemetryPropertyNames.Connected, connected.ToOneOrZeroString() }
|
||||
},
|
||||
EventName = TelemetryEventNames.PeekDefinitionRequested
|
||||
};
|
||||
}
|
||||
|
||||
// turn off this code until needed (10/28/2016)
|
||||
#if false
|
||||
private static async Task HandleReferencesRequest(
|
||||
|
||||
Reference in New Issue
Block a user