-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: Instantiating
_tags
for Spans lazily (#2636)
- Loading branch information
1 parent
e6bb733
commit a667e7c
Showing
4 changed files
with
38 additions
and
1 deletion.
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,34 @@ | ||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Sentry.Benchmarks; | ||
|
||
public class TransactionBenchmarks | ||
{ | ||
private const string Operation = "Operation"; | ||
private const string Name = "Name"; | ||
|
||
[Params(1, 10, 100, 1000)] | ||
public int SpanCount; | ||
|
||
private IDisposable _sdk; | ||
|
||
[GlobalSetup(Target = nameof(CreateTransaction))] | ||
public void EnabledSdk() => _sdk = SentrySdk.Init(Constants.ValidDsn); | ||
|
||
[GlobalCleanup(Target = nameof(CreateTransaction))] | ||
public void DisableDsk() => _sdk.Dispose(); | ||
|
||
[Benchmark(Description = "Creates a Transaction")] | ||
public void CreateTransaction() | ||
{ | ||
var transaction = SentrySdk.StartTransaction(Name, Operation); | ||
|
||
for (var i = 0; i < SpanCount; i++) | ||
{ | ||
var span = transaction.StartChild(Operation); | ||
span.Finish(); | ||
} | ||
|
||
transaction.Finish(); | ||
} | ||
} |
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