Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Cody.Core/Agent/NotificationHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Cody.Core.Trace;
using Cody.Core.Workspace;
using Newtonsoft.Json.Linq;
using Sentry;
using System;
using System.Threading.Tasks;

Expand Down Expand Up @@ -64,6 +65,7 @@ public void Debug(string channel, string message, string level)
{
//_logger.Debug($"[{channel} {message}]");
trace.TraceEvent("AgentDebug", message);
SentrySdk.AddBreadcrumb(message, "DebugFromAgent", "debug");
}

[AgentCallback("webview/registerWebview")]
Expand Down
14 changes: 5 additions & 9 deletions src/Cody.Core/Logging/SentryLog.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Cody.Core.Common;
using Sentry;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -29,14 +30,9 @@ public void Error(string message, Exception ex, [CallerMemberName] string caller

public void Error(string message, [CallerMemberName] string callerName = "")
{
SentrySdk.CaptureMessage(message, scope =>
{
scope.Contexts[ErrorData] = new
{
Message = message,
CallerName = callerName,
};
});
SentrySdk.AddBreadcrumb(message,
data: new Dictionary<string, string> { ["callerName"] = callerName },
level: BreadcrumbLevel.Error);
}

private static DateTime GetLinkerBuildTime(Assembly assembly)
Expand Down Expand Up @@ -83,7 +79,7 @@ public static void Initialize()
{
options.Dsn = "https://d129345ba8e1848a01435eb2596ca899@o19358.ingest.us.sentry.io/4508375896752129";
options.IsGlobalModeEnabled = true;
options.MaxBreadcrumbs = 10;
options.MaxBreadcrumbs = 50;
options.Environment = env;
options.Release = "cody-vs@" + version.ToString();
options.SetBeforeSend(se =>
Expand Down
2 changes: 2 additions & 0 deletions src/Cody.VisualStudio/Client/AgentClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Cody.Core.Trace;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Sentry;
using StreamJsonRpc;
using System;
using System.Threading.Tasks;
Expand Down Expand Up @@ -97,6 +98,7 @@ private void OnErrorReceived(object sender, string error)
{
//agentLog.Debug(error);
trace.TraceEvent("AgentErrorOutput", error);
SentrySdk.AddBreadcrumb(error, "AgentErrorOutput");
}

private IAgentConnector CreateConnector()
Expand Down
12 changes: 12 additions & 0 deletions src/Cody.VisualStudio/Client/TraceJsonRpc.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cody.Core.Trace;
using Sentry;
using StreamJsonRpc;
using StreamJsonRpc.Protocol;
using StreamJsonRpc.Reflection;
Expand All @@ -14,11 +15,22 @@ public TraceJsonRpc(IJsonRpcMessageHandler messageHandler) : base(messageHandler
void IJsonRpcTracingCallbacks.OnMessageSerialized(JsonRpcMessage message, object encodedMessage)
{
trace.TraceEvent("ToAgent", encodedMessage);
if (message is JsonRpcRequest request)
{
SentrySdk.AddBreadcrumb(request.Method, "ToAgent");
}
}

void IJsonRpcTracingCallbacks.OnMessageDeserialized(JsonRpcMessage message, object encodedMessage)
{
trace.TraceEvent("FromAgent", encodedMessage);
if (message is JsonRpcRequest request)
{
if (request.Method == "debug/message") return;
SentrySdk.AddBreadcrumb(request.Method, "FromAgent");
}
}


}
}
2 changes: 1 addition & 1 deletion src/Cody.VisualStudio/CodyPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void ReportSentryVsVersion()
scope.SetTag("agent", VersionService.Agent);
});

VsShellUtilities.ShutdownToken.Register(() => SentrySdk.ConfigureScope(s => s.SetTag("isShuttingDown", "true")));
VsShellUtilities.ShutdownToken.Register(() => SentrySdk.AddBreadcrumb("VS is shutting down"));
}

private static void InitializeTrace()
Expand Down