-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from argon-chat/feature/sentry-orleans
add sentry filter for orleans, add sentry open telemetry
- Loading branch information
Showing
4 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Argon.Api.Features.Sentry; | ||
|
||
public class SentryGrainCallFilter : IIncomingGrainCallFilter | ||
{ | ||
public async Task Invoke(IIncomingGrainCallContext context) | ||
{ | ||
try | ||
{ | ||
await context.Invoke(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
SentrySdk.ConfigureScope(scope => | ||
{ | ||
var grainId = context.TargetId.ToString(); | ||
var calleGrain = context.SourceId?.ToString(); | ||
var grainType = context.Grain.GetType().FullName; | ||
|
||
var methodName = context.ImplementationMethod.Name; | ||
|
||
if (!string.IsNullOrEmpty(calleGrain)) | ||
scope.SetTag("ActivatorGrainId", calleGrain); | ||
scope.SetTag("GrainId", grainId); | ||
scope.SetTag("GrainType", grainType ?? "unk"); | ||
scope.SetTag("MethodName", methodName); | ||
}); | ||
|
||
SentrySdk.CaptureException(ex); | ||
throw; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters