Skip to content

Commit

Permalink
Remove unnecessary casting
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanFeldman committed May 10, 2023
1 parent fcf99cb commit f788fcd
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Azure.Functions.Worker.Middleware;

namespace Sentry.AzureFunctions.Worker;
Expand All @@ -26,6 +25,8 @@ public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next
{
scope.Transaction = transaction;
// TODO: remove when SentryLogger supports filtering out tags option
// https://github.com/getsentry/sentry-dotnet/pull/2346#discussion_r1188143329
// AzureFunctions_FunctionName and AzureFunctions_InvocationId are already set by the time we get here.
// Clear those and replace with "function" scope context.
scope.UnsetTag("AzureFunctions_FunctionName");
Expand Down Expand Up @@ -65,9 +66,9 @@ public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next
var statusCode = context.GetHttpResponseData()?.StatusCode;

// For HTTP triggered function, finish transaction with the returned HTTP status code
if (statusCode != null)
if (statusCode is not null)
{
var status = SpanStatusConverter.FromHttpStatusCode((int)statusCode);
var status = SpanStatusConverter.FromHttpStatusCode(statusCode.Value);

transaction.Finish(status);
}
Expand Down

0 comments on commit f788fcd

Please sign in to comment.