mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-28 01:25:44 -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:
@@ -4,9 +4,9 @@
|
||||
//
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
@@ -43,6 +43,8 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
/// </summary>
|
||||
public static void SendTelemetryEvent<T>(RequestContext<T> requestContext, string telemetryEvent)
|
||||
{
|
||||
Validate.IsNotNull(nameof(requestContext), requestContext);
|
||||
Validate.IsNotNullOrWhitespaceString(nameof(telemetryEvent), telemetryEvent);
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
await requestContext.SendEvent(TelemetryNotification.Type, new TelemetryParams()
|
||||
@@ -54,5 +56,22 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a telemetry event for specific document using the existing request context
|
||||
/// </summary>
|
||||
public static void SendTelemetryEvent<T>(RequestContext<T> requestContext, TelemetryProperties telemetryProps)
|
||||
{
|
||||
Validate.IsNotNull(nameof(requestContext), requestContext);
|
||||
Validate.IsNotNull(nameof(telemetryProps), telemetryProps);
|
||||
Validate.IsNotNullOrWhitespaceString("telemetryProps.EventName", telemetryProps.EventName);
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
await requestContext.SendEvent(TelemetryNotification.Type, new TelemetryParams()
|
||||
{
|
||||
Params = telemetryProps
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user