-
-
Notifications
You must be signed in to change notification settings - Fork 226
Add non allocating ConfigureScope overload #4244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2ded092
3c74a66
c53044e
96c41ee
2456363
ab18778
ee4ce7d
fad5a1d
8649122
91914d4
aad5e0b
dc5c853
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,14 +56,11 @@ public static ITransactionTracer StartTransaction( | |
| /// </summary> | ||
| public static ISpan StartSpan(this IHub hub, string operation, string description) | ||
| { | ||
| ITransactionTracer? currentTransaction = null; | ||
| hub.ConfigureScope(s => currentTransaction = s.Transaction); | ||
| return currentTransaction is { } transaction | ||
| return hub.GetTransaction() is { } transaction | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test: Should we have a test for To be fair, these method was recently moved and made @KnapSac, only if you feel like adding a test for this method. |
||
| ? transaction.StartChild(operation, description) | ||
| : hub.StartTransaction(operation, description); // this is actually in the wrong order but changing it may break other things | ||
| } | ||
|
|
||
|
|
||
| /// <summary> | ||
| /// Adds a breadcrumb to the current scope. | ||
| /// </summary> | ||
|
|
@@ -158,8 +155,8 @@ public static void AddBreadcrumb( | |
| } | ||
|
|
||
| hub.ConfigureScope( | ||
| s => s.AddBreadcrumb(breadcrumb, hint ?? new SentryHint()) | ||
| ); | ||
| static (s, arg) => s.AddBreadcrumb(arg.breadcrumb, arg.hint ?? new SentryHint()), | ||
| (breadcrumb, hint)); | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -175,13 +172,13 @@ public static void AddBreadcrumb( | |
| /// like Loggers which guarantee log messages are not lost. | ||
| /// </remarks> | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public static void LockScope(this IHub hub) => hub.ConfigureScope(c => c.Locked = true); | ||
| public static void LockScope(this IHub hub) => hub.ConfigureScope(static s => s.Locked = true); | ||
|
|
||
| /// <summary> | ||
| /// Unlocks the current scope to allow subsequent calls to <see cref="ISentryScopeManager.PushScope"/> create new scopes. | ||
| /// </summary> | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public static void UnlockScope(this IHub hub) => hub.ConfigureScope(c => c.Locked = false); | ||
| public static void UnlockScope(this IHub hub) => hub.ConfigureScope(static s => s.Locked = false); | ||
|
|
||
| private sealed class LockedScope : IDisposable | ||
| { | ||
|
|
@@ -247,6 +244,11 @@ internal static ITransactionTracer StartTransaction( | |
|
|
||
| internal static ITransactionTracer? GetTransaction(this IHub hub) | ||
| { | ||
| if (hub is Hub fullHub) | ||
Flash0ver marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| return fullHub.ScopeManager.GetCurrent().Key.Transaction; | ||
| } | ||
|
|
||
| ITransactionTracer? transaction = null; | ||
| hub.ConfigureScope(scope => transaction = scope.Transaction); | ||
| return transaction; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.