Skip to content

Commit

Permalink
Added "vs" tag for Visual Studio when reporting to Sentry:
Browse files Browse the repository at this point in the history
  - during initialization VS version is reported independently
  • Loading branch information
PiotrKarczmarz committed Jan 3, 2025
1 parent b52b944 commit f233727
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Cody.Core/Logging/SentryLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static void Initialize()
{
if (se.Exception?.Source?.StartsWith(CodyAssemblyPrefix) ?? false) return se;
if (se.Exception?.InnerException?.Source?.StartsWith(CodyAssemblyPrefix) ?? false) return se;
if (se.Message != null) return se;
if (se.SentryExceptions == null) return se;

foreach(var ex in se.SentryExceptions)
Expand Down
10 changes: 10 additions & 0 deletions src/Cody.VisualStudio/CodyPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke

InitializeAgent();

ReportSentryVsVersion();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -146,6 +147,15 @@ private void InitializeServices()
Logger.Info($"Visual Studio version: {VsVersionService.DisplayVersion} ({VsVersionService.EditionName})");
}

private void ReportSentryVsVersion()
{
SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("vs", VsVersionService.DisplayVersion);
SentrySdk.CaptureMessage("Initialized");
});
}

private static void InitializeTrace()
{
if (Configuration.Trace)
Expand Down

0 comments on commit f233727

Please sign in to comment.