Skip to content

Commit 434e9f4

Browse files
committed
Extract StopActivitySlow as it's a rarely-called code path
1 parent cf9e70d commit 434e9f4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tracer/src/Datadog.Trace/Activity/Handlers/ActivityHandlerCommon.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,16 @@ public static void ActivityStopped<T>(string sourceName, T activity)
255255
}
256256
}
257257

258+
StopActivitySlow(sourceName, activity);
259+
}
260+
catch (Exception ex)
261+
{
262+
Log.Error(ex, "Error processing the DefaultActivityHandler.ActivityStopped callback");
263+
}
264+
265+
static void StopActivitySlow<TInner>(string sourceName, TInner activity)
266+
where TInner : IActivity
267+
{
258268
// The listener didn't send us the Activity or the scope instance was not found
259269
// In this case we are going go through the dictionary to check if we have an activity that
260270
// has been closed and then close the associated scope.
@@ -319,10 +329,6 @@ public static void ActivityStopped<T>(string sourceName, T activity)
319329
}
320330
}
321331
}
322-
catch (Exception ex)
323-
{
324-
Log.Error(ex, "Error processing the DefaultActivityHandler.ActivityStopped callback");
325-
}
326332

327333
static void CloseActivityScope<TInner>(string sourceName, TInner activity, Scope scope)
328334
where TInner : IActivity

0 commit comments

Comments
 (0)