From 2a41c48c2185d910be95bbe850b8979a1a3c571b Mon Sep 17 00:00:00 2001 From: Stefan Jandl Date: Thu, 11 Jan 2024 18:38:04 +0100 Subject: [PATCH] feat: Renamed `Sentry.Transaction` to `Sentry.SentryTransaction` (#3023) --- CHANGELOG.md | 1 + .../Sentry.Benchmarks/ProfilingBenchmarks.cs | 4 +- .../OpenTelemetryTransactionProcessor.cs | 2 +- .../SamplingTransactionProfiler.cs | 6 +- src/Sentry/Extensibility/DisabledHub.cs | 4 +- src/Sentry/Extensibility/HubAdapter.cs | 4 +- .../ISentryTransactionProcessor.cs | 8 +- .../ISentryTransactionProcessorWithHint.cs | 6 +- src/Sentry/ISentryClient.cs | 4 +- .../Internal/DelegateTransactionProcessor.cs | 6 +- src/Sentry/Internal/Hub.cs | 4 +- src/Sentry/Internal/ITransactionProfiler.cs | 2 +- src/Sentry/Platforms/Cocoa/CocoaProfiler.cs | 2 +- src/Sentry/Protocol/Envelopes/Envelope.cs | 2 +- src/Sentry/Protocol/Envelopes/EnvelopeItem.cs | 4 +- src/Sentry/Protocol/ProfileInfo.cs | 2 +- src/Sentry/ScopeExtensions.cs | 8 +- src/Sentry/SentryClient.cs | 6 +- src/Sentry/SentryOptions.cs | 8 +- src/Sentry/SentryOptionsExtensions.cs | 6 +- src/Sentry/SentrySdk.cs | 4 +- .../{Transaction.cs => SentryTransaction.cs} | 20 +-- src/Sentry/TransactionTracer.cs | 4 +- .../SentryTracingMiddlewareTests.cs | 20 +-- .../SentryFunctionsWorkerMiddlewareTests.cs | 6 +- .../OpenTelemetryTransactionProcessorTests.cs | 4 +- .../SamplingTransactionProfilerTests.cs | 6 +- .../TraceLogProcessorTests.verify.cs | 2 +- test/Sentry.Testing/VerifyExtensions.cs | 2 +- ...piApprovalTests.Run.DotNet6_0.verified.txt | 122 +++++++++--------- ...piApprovalTests.Run.DotNet7_0.verified.txt | 122 +++++++++--------- ...piApprovalTests.Run.DotNet8_0.verified.txt | 122 +++++++++--------- .../ApiApprovalTests.Run.Net4_8.verified.txt | 122 +++++++++--------- test/Sentry.Tests/HubTests.cs | 12 +- test/Sentry.Tests/ProfilerTests.cs | 2 +- .../Sentry.Tests/Protocol/MeasurementTests.cs | 16 +-- .../Protocol/MeasurementTests.verify.cs | 2 +- ...tionTests.cs => SentryTransactionTests.cs} | 16 +-- ...Throws_ErrorToEventBreadcrumb.verified.txt | 2 +- test/Sentry.Tests/SentryClientTests.cs | 54 ++++---- test/Sentry.Tests/SentryClientTests.verify.cs | 2 +- .../Sentry.Tests/TransactionProcessorTests.cs | 8 +- 42 files changed, 380 insertions(+), 379 deletions(-) rename src/Sentry/{Transaction.cs => SentryTransaction.cs} (95%) rename test/Sentry.Tests/Protocol/{TransactionTests.cs => SentryTransactionTests.cs} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c80ea65d..5550466090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Class renamed `Sentry.User` to `Sentry.SentryUser` ([#3015](https://github.com/getsentry/sentry-dotnet/pull/3015)) - Class renamed `Sentry.Runtime` to `Sentry.SentryRuntime` ([#3016](https://github.com/getsentry/sentry-dotnet/pull/3016)) - Class renamed `Sentry.Span` to `Sentry.SentrySpan` ([#3021](https://github.com/getsentry/sentry-dotnet/pull/3021)) +- Class renamed `Sentry.Transaction` to `Sentry.SentryTransaction` ([#3023](https://github.com/getsentry/sentry-dotnet/pull/3023)) ### Dependencies diff --git a/benchmarks/Sentry.Benchmarks/ProfilingBenchmarks.cs b/benchmarks/Sentry.Benchmarks/ProfilingBenchmarks.cs index bbbab67ef2..5bd63cfa97 100644 --- a/benchmarks/Sentry.Benchmarks/ProfilingBenchmarks.cs +++ b/benchmarks/Sentry.Benchmarks/ProfilingBenchmarks.cs @@ -25,7 +25,7 @@ public void StartProfiler() public void StopProfiler() { _profiler?.Finish(); - (_profiler as SamplingTransactionProfiler)?.CollectAsync(new Transaction("", "")).Wait(); + (_profiler as SamplingTransactionProfiler)?.CollectAsync(new SentryTransaction("", "")).Wait(); _profiler = null; _factory.Dispose(); _factory = null; @@ -52,7 +52,7 @@ public long Transaction(int runtimeMs, bool collect) tt.TransactionProfiler = _factory.Start(tt, CancellationToken.None); var result = RunForMs(runtimeMs); tt.TransactionProfiler.Finish(); - var transaction = new Transaction(tt); + var transaction = new SentryTransaction(tt); if (collect) { var collectTask = (tt.TransactionProfiler as SamplingTransactionProfiler).CollectAsync(transaction); diff --git a/src/Sentry.OpenTelemetry/OpenTelemetryTransactionProcessor.cs b/src/Sentry.OpenTelemetry/OpenTelemetryTransactionProcessor.cs index 0e057f1d89..4ab485dde1 100644 --- a/src/Sentry.OpenTelemetry/OpenTelemetryTransactionProcessor.cs +++ b/src/Sentry.OpenTelemetry/OpenTelemetryTransactionProcessor.cs @@ -4,7 +4,7 @@ namespace Sentry.OpenTelemetry; internal class OpenTelemetryTransactionProcessor : ISentryTransactionProcessor { - public Transaction Process(Transaction transaction) + public SentryTransaction Process(SentryTransaction transaction) { var activity = Activity.Current; if (activity != null) diff --git a/src/Sentry.Profiling/SamplingTransactionProfiler.cs b/src/Sentry.Profiling/SamplingTransactionProfiler.cs index 628f44b691..3d4d696e2d 100644 --- a/src/Sentry.Profiling/SamplingTransactionProfiler.cs +++ b/src/Sentry.Profiling/SamplingTransactionProfiler.cs @@ -97,10 +97,10 @@ public void Finish() } /// - public Protocol.Envelopes.ISerializable? Collect(Transaction transaction) + public Protocol.Envelopes.ISerializable? Collect(SentryTransaction transaction) => Protocol.Envelopes.AsyncJsonSerializable.CreateFrom(CollectAsync(transaction)); - internal async Task CollectAsync(Transaction transaction) + internal async Task CollectAsync(SentryTransaction transaction) { if (!_stopped) { @@ -118,7 +118,7 @@ internal async Task CollectAsync(Transaction transaction) return CreateProfileInfo(transaction, _processor.Profile); } - internal static ProfileInfo CreateProfileInfo(Transaction transaction, SampleProfile profile) + internal static ProfileInfo CreateProfileInfo(SentryTransaction transaction, SampleProfile profile) { return new() { diff --git a/src/Sentry/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs index 3ce135f59a..bd12084c72 100644 --- a/src/Sentry/Extensibility/DisabledHub.cs +++ b/src/Sentry/Extensibility/DisabledHub.cs @@ -151,14 +151,14 @@ public void BindClient(ISentryClient client) /// /// No-Op. /// - public void CaptureTransaction(Transaction transaction) + public void CaptureTransaction(SentryTransaction transaction) { } /// /// No-Op. /// - public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) { } diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index 072a6af077..6797fef9bd 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -244,7 +244,7 @@ public SentryId CaptureException(Exception exception) /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public void CaptureTransaction(Transaction transaction) + public void CaptureTransaction(SentryTransaction transaction) => SentrySdk.CaptureTransaction(transaction); /// @@ -252,7 +252,7 @@ public void CaptureTransaction(Transaction transaction) /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) => SentrySdk.CaptureTransaction(transaction, scope, hint); /// diff --git a/src/Sentry/Extensibility/ISentryTransactionProcessor.cs b/src/Sentry/Extensibility/ISentryTransactionProcessor.cs index 62607ac1c6..74f9be1d91 100644 --- a/src/Sentry/Extensibility/ISentryTransactionProcessor.cs +++ b/src/Sentry/Extensibility/ISentryTransactionProcessor.cs @@ -1,12 +1,12 @@ namespace Sentry.Extensibility; /// -/// Process a during the prepare phase. +/// Process a during the prepare phase. /// public interface ISentryTransactionProcessor { /// - /// Process the + /// Process the /// /// The Transaction to process /// @@ -14,12 +14,12 @@ public interface ISentryTransactionProcessor /// Returning null will stop the processing pipeline. /// Meaning the transaction should no longer be processed nor send. /// - Transaction? Process(Transaction transaction); + SentryTransaction? Process(SentryTransaction transaction); } internal static class ISentryTransactionProcessorExtensions { - internal static Transaction? DoProcessTransaction(this ISentryTransactionProcessor processor, Transaction transaction, Hint hint) + internal static SentryTransaction? DoProcessTransaction(this ISentryTransactionProcessor processor, SentryTransaction transaction, Hint hint) { return (processor is ISentryTransactionProcessorWithHint contextualProcessor) ? contextualProcessor.Process(transaction, hint) diff --git a/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs b/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs index 91b867e116..417cbaa170 100644 --- a/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs +++ b/src/Sentry/Extensibility/ISentryTransactionProcessorWithHint.cs @@ -1,12 +1,12 @@ namespace Sentry.Extensibility; /// -/// Process a during the prepare phase. +/// Process a during the prepare phase. /// public interface ISentryTransactionProcessorWithHint: ISentryTransactionProcessor { /// - /// Process the + /// Process the /// /// The Transaction to process /// A with context that may be useful prior to sending the transaction @@ -15,5 +15,5 @@ public interface ISentryTransactionProcessorWithHint: ISentryTransactionProcesso /// Returning null will stop the processing pipeline. /// Meaning the transaction should no longer be processed nor send. /// - Transaction? Process(Transaction transaction, Hint hint); + SentryTransaction? Process(SentryTransaction transaction, Hint hint); } diff --git a/src/Sentry/ISentryClient.cs b/src/Sentry/ISentryClient.cs index 237f3e04ff..d676448a1a 100644 --- a/src/Sentry/ISentryClient.cs +++ b/src/Sentry/ISentryClient.cs @@ -34,7 +34,7 @@ public interface ISentryClient /// /// The transaction. [EditorBrowsable(EditorBrowsableState.Never)] - void CaptureTransaction(Transaction transaction); + void CaptureTransaction(SentryTransaction transaction); /// /// Captures a transaction. @@ -50,7 +50,7 @@ public interface ISentryClient /// This will be available in callbacks prior to processing the transaction. /// [EditorBrowsable(EditorBrowsableState.Never)] - void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint); + void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint); /// /// Captures a session update. diff --git a/src/Sentry/Internal/DelegateTransactionProcessor.cs b/src/Sentry/Internal/DelegateTransactionProcessor.cs index cbfd8355aa..ac89fc1493 100644 --- a/src/Sentry/Internal/DelegateTransactionProcessor.cs +++ b/src/Sentry/Internal/DelegateTransactionProcessor.cs @@ -4,14 +4,14 @@ namespace Sentry.Internal; internal class DelegateTransactionProcessor : ISentryTransactionProcessor { - private readonly Func _func; + private readonly Func _func; - public DelegateTransactionProcessor(Func func) + public DelegateTransactionProcessor(Func func) { _func = func; } - public Transaction? Process(Transaction transaction) + public SentryTransaction? Process(SentryTransaction transaction) { return _func(transaction); } diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index 9dd0f78250..a047c0eaaf 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -460,9 +460,9 @@ public void CaptureUserFeedback(UserFeedback userFeedback) } } - public void CaptureTransaction(Transaction transaction) => CaptureTransaction(transaction, null, null); + public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null); - public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) { // Note: The hub should capture transactions even if it is disabled. // This allows transactions to be reported as failed when they encountered an unhandled exception, diff --git a/src/Sentry/Internal/ITransactionProfiler.cs b/src/Sentry/Internal/ITransactionProfiler.cs index 14e90fdd23..e8a2a67758 100644 --- a/src/Sentry/Internal/ITransactionProfiler.cs +++ b/src/Sentry/Internal/ITransactionProfiler.cs @@ -25,5 +25,5 @@ internal interface ITransactionProfiler /// Process and collect the profile. /// The collected profile. - ISerializable? Collect(Transaction transaction); + ISerializable? Collect(SentryTransaction transaction); } diff --git a/src/Sentry/Platforms/Cocoa/CocoaProfiler.cs b/src/Sentry/Platforms/Cocoa/CocoaProfiler.cs index 7192918ea0..935f1838b7 100644 --- a/src/Sentry/Platforms/Cocoa/CocoaProfiler.cs +++ b/src/Sentry/Platforms/Cocoa/CocoaProfiler.cs @@ -34,7 +34,7 @@ public void Finish() } } - public ISerializable? Collect(Transaction transaction) + public ISerializable? Collect(SentryTransaction transaction) { var payload = SentryCocoaHybridSdk.CollectProfileBetween(_startTimeNs, _endTimeNs, _cocoaTraceId); if (payload is null) diff --git a/src/Sentry/Protocol/Envelopes/Envelope.cs b/src/Sentry/Protocol/Envelopes/Envelope.cs index 35aac2f4d7..c6bc156eca 100644 --- a/src/Sentry/Protocol/Envelopes/Envelope.cs +++ b/src/Sentry/Protocol/Envelopes/Envelope.cs @@ -302,7 +302,7 @@ public static Envelope FromUserFeedback(UserFeedback sentryUserFeedback) /// /// Creates an envelope that contains a single transaction. /// - public static Envelope FromTransaction(Transaction transaction) + public static Envelope FromTransaction(SentryTransaction transaction) { var eventId = transaction.EventId; var header = CreateHeader(eventId, transaction.DynamicSamplingContext); diff --git a/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs b/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs index fc02034331..9202f0b025 100644 --- a/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs +++ b/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs @@ -214,7 +214,7 @@ public static EnvelopeItem FromUserFeedback(UserFeedback sentryUserFeedback) /// /// Creates an from . /// - public static EnvelopeItem FromTransaction(Transaction transaction) + public static EnvelopeItem FromTransaction(SentryTransaction transaction) { var header = new Dictionary(1, StringComparer.Ordinal) { @@ -373,7 +373,7 @@ private static async Task DeserializePayloadAsync( { var bufferLength = (int)(payloadLength ?? stream.Length); var buffer = await stream.ReadByteChunkAsync(bufferLength, cancellationToken).ConfigureAwait(false); - var transaction = Json.Parse(buffer, Transaction.FromJson); + var transaction = Json.Parse(buffer, SentryTransaction.FromJson); return new JsonSerializable(transaction); } diff --git a/src/Sentry/Protocol/ProfileInfo.cs b/src/Sentry/Protocol/ProfileInfo.cs index 340588f9be..48fb29e88b 100644 --- a/src/Sentry/Protocol/ProfileInfo.cs +++ b/src/Sentry/Protocol/ProfileInfo.cs @@ -35,7 +35,7 @@ public Contexts Contexts public string? Release { get; set; } - public Transaction? Transaction { get; set; } + public SentryTransaction? Transaction { get; set; } public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) diff --git a/src/Sentry/ScopeExtensions.cs b/src/Sentry/ScopeExtensions.cs index e36b2b240b..454aeb4610 100644 --- a/src/Sentry/ScopeExtensions.cs +++ b/src/Sentry/ScopeExtensions.cs @@ -112,7 +112,7 @@ public static void AddEventProcessors(this Scope scope, IEnumerable - /// Adds an transaction processor which is invoked when creating a . + /// Adds an transaction processor which is invoked when creating a . /// /// The Scope to hold the processor. /// The transaction processor. @@ -120,15 +120,15 @@ public static void AddTransactionProcessor(this Scope scope, ISentryTransactionP => scope.TransactionProcessors.Add(processor); /// - /// Adds an transaction processor which is invoked when creating a . + /// Adds an transaction processor which is invoked when creating a . /// /// The Scope to hold the processor. /// The transaction processor. - public static void AddTransactionProcessor(this Scope scope, Func processor) + public static void AddTransactionProcessor(this Scope scope, Func processor) => scope.AddTransactionProcessor(new DelegateTransactionProcessor(processor)); /// - /// Adds transaction processors which are invoked when creating a . + /// Adds transaction processors which are invoked when creating a . /// /// The Scope to hold the processor. /// The transaction processors. diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs index c5035edfc0..4c1d52e07e 100644 --- a/src/Sentry/SentryClient.cs +++ b/src/Sentry/SentryClient.cs @@ -121,10 +121,10 @@ public void CaptureUserFeedback(UserFeedback userFeedback) } /// - public void CaptureTransaction(Transaction transaction) => CaptureTransaction(transaction, null, null); + public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null); /// - public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint) + public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) { if (transaction.SpanId.Equals(SpanId.Empty)) { @@ -198,7 +198,7 @@ public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint CaptureEnvelope(Envelope.FromTransaction(processedTransaction)); } - private Transaction? BeforeSendTransaction(Transaction transaction, Hint hint) + private SentryTransaction? BeforeSendTransaction(SentryTransaction transaction, Hint hint) { if (_options.BeforeSendTransactionInternal is null) { diff --git a/src/Sentry/SentryOptions.cs b/src/Sentry/SentryOptions.cs index 53af99daa8..6191aa0a87 100644 --- a/src/Sentry/SentryOptions.cs +++ b/src/Sentry/SentryOptions.cs @@ -445,15 +445,15 @@ public void SetBeforeSend(Func beforeSend) _beforeSend = (@event, _) => beforeSend(@event); } - private Func? _beforeSendTransaction; + private Func? _beforeSendTransaction; - internal Func? BeforeSendTransactionInternal => _beforeSendTransaction; + internal Func? BeforeSendTransactionInternal => _beforeSendTransaction; /// /// Configures a callback to invoke before sending a transaction to Sentry /// /// The callback - public void SetBeforeSendTransaction(Func beforeSendTransaction) + public void SetBeforeSendTransaction(Func beforeSendTransaction) { _beforeSendTransaction = beforeSendTransaction; } @@ -462,7 +462,7 @@ public void SetBeforeSendTransaction(Func befor /// Configures a callback to invoke before sending a transaction to Sentry /// /// The callback - public void SetBeforeSendTransaction(Func beforeSendTransaction) + public void SetBeforeSendTransaction(Func beforeSendTransaction) { _beforeSendTransaction = (transaction, _) => beforeSendTransaction(transaction); } diff --git a/src/Sentry/SentryOptionsExtensions.cs b/src/Sentry/SentryOptionsExtensions.cs index 586aaacd2c..bc53ad8b5b 100644 --- a/src/Sentry/SentryOptionsExtensions.cs +++ b/src/Sentry/SentryOptionsExtensions.cs @@ -252,7 +252,7 @@ public static void AddEventProcessorProvider(this SentryOptions options, Func - /// Adds an transaction processor which is invoked when creating a . + /// Adds an transaction processor which is invoked when creating a . /// /// The SentryOptions to hold the processor. /// The transaction processor. @@ -269,7 +269,7 @@ public static void AddTransactionProcessor(this SentryOptions options, ISentryTr } /// - /// Adds transaction processors which are invoked when creating a . + /// Adds transaction processors which are invoked when creating a . /// /// The SentryOptions to hold the processor. /// The transaction processors. @@ -295,7 +295,7 @@ public static void RemoveTransactionProcessor(this SentryOptions opt => options.TransactionProcessors?.RemoveAll(processor => processor is TProcessor); /// - /// Adds an transaction processor provider which is invoked when creating a . + /// Adds an transaction processor provider which is invoked when creating a . /// /// The SentryOptions to hold the processor provider. /// The transaction processor provider. diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index 43a8ec5f8c..0d2916405e 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -490,7 +490,7 @@ public static void CaptureUserFeedback(SentryId eventId, string email, string co /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public static void CaptureTransaction(Transaction transaction) + public static void CaptureTransaction(SentryTransaction transaction) => CurrentHub.CaptureTransaction(transaction); /// @@ -502,7 +502,7 @@ public static void CaptureTransaction(Transaction transaction) /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] - public static void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint) + public static void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint) => CurrentHub.CaptureTransaction(transaction, scope, hint); /// diff --git a/src/Sentry/Transaction.cs b/src/Sentry/SentryTransaction.cs similarity index 95% rename from src/Sentry/Transaction.cs rename to src/Sentry/SentryTransaction.cs index b88d09ca81..7b5502a1a9 100644 --- a/src/Sentry/Transaction.cs +++ b/src/Sentry/SentryTransaction.cs @@ -9,7 +9,7 @@ namespace Sentry; /// /// Sentry performance transaction. /// -public class Transaction : ITransactionData, IJsonSerializable +public class SentryTransaction : ITransactionData, IJsonSerializable { /// /// Transaction's event ID. @@ -204,7 +204,7 @@ public IReadOnlyList Fingerprint // instead just parse the trace context and resolve them later. // Hence why we need a constructor that doesn't take the operation to avoid // overwriting it. - private Transaction(string name, TransactionNameSource nameSource) + private SentryTransaction(string name, TransactionNameSource nameSource) { EventId = SentryId.Create(); Name = name; @@ -212,9 +212,9 @@ private Transaction(string name, TransactionNameSource nameSource) } /// - /// Initializes an instance of . + /// Initializes an instance of . /// - public Transaction(string name, string operation) + public SentryTransaction(string name, string operation) : this(name, TransactionNameSource.Custom) { SpanId = SpanId.Create(); @@ -223,9 +223,9 @@ public Transaction(string name, string operation) } /// - /// Initializes an instance of . + /// Initializes an instance of . /// - public Transaction(string name, string operation, TransactionNameSource nameSource) + public SentryTransaction(string name, string operation, TransactionNameSource nameSource) : this(name, nameSource) { SpanId = SpanId.Create(); @@ -234,9 +234,9 @@ public Transaction(string name, string operation, TransactionNameSource nameSour } /// - /// Initializes an instance of . + /// Initializes an instance of . /// - public Transaction(ITransactionTracer tracer) + public SentryTransaction(ITransactionTracer tracer) : this(tracer.Name, tracer.NameSource) { // Contexts have to be set first because other fields use that @@ -355,7 +355,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) /// /// Parses transaction from JSON. /// - public static Transaction FromJson(JsonElement json) + public static SentryTransaction FromJson(JsonElement json) { var eventId = json.GetPropertyOrNull("event_id")?.Pipe(SentryId.FromJson) ?? SentryId.Empty; var name = json.GetProperty("transaction").GetStringOrThrow(); @@ -385,7 +385,7 @@ public static Transaction FromJson(JsonElement json) var spans = json.GetPropertyOrNull("spans")? .EnumerateArray().Select(SentrySpan.FromJson).ToArray() ?? Array.Empty(); - return new Transaction(name, nameSource) + return new SentryTransaction(name, nameSource) { EventId = eventId, StartTimestamp = startTimestamp, diff --git a/src/Sentry/TransactionTracer.cs b/src/Sentry/TransactionTracer.cs index 8202933529..6899f3f628 100644 --- a/src/Sentry/TransactionTracer.cs +++ b/src/Sentry/TransactionTracer.cs @@ -198,7 +198,7 @@ public TransactionTracer(IHub hub, ITransactionContext context) : this(hub, cont } /// - /// Initializes an instance of . + /// Initializes an instance of . /// internal TransactionTracer(IHub hub, string name, string operation, TransactionNameSource nameSource = TransactionNameSource.Custom) { @@ -374,7 +374,7 @@ public void Finish() _hub.ConfigureScope(scope => scope.ResetTransaction(this)); // Client decides whether to discard this transaction based on sampling - _hub.CaptureTransaction(new Transaction(this)); + _hub.CaptureTransaction(new SentryTransaction(this)); } /// diff --git a/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs b/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs index 1151a6bd03..d4619766de 100644 --- a/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs +++ b/test/Sentry.AspNetCore.Tests/SentryTracingMiddlewareTests.cs @@ -53,7 +53,7 @@ public async Task Transactions_are_grouped_by_route() // Assert sentryClient.Received(2).CaptureTransaction( - Arg.Is(transaction => + Arg.Is(transaction => transaction.Name == "GET /person/{id}" && transaction.NameSource == TransactionNameSource.Route), Arg.Any(), @@ -145,7 +145,7 @@ public async Task Transaction_is_started_automatically_from_incoming_trace_heade await client.SendAsync(request); // Assert - sentryClient.Received(1).CaptureTransaction(Arg.Is(t => + sentryClient.Received(1).CaptureTransaction(Arg.Is(t => t.Name == "GET /person/{id}" && t.NameSource == TransactionNameSource.Route && t.TraceId == SentryId.Parse("75302ac48a024bde9a3b3734a82e36c8") && @@ -183,9 +183,9 @@ public async Task Transaction_name_includes_slash_prefix() })); var client = server.CreateClient(); - Transaction transaction = null; + SentryTransaction transaction = null; sentryClient.CaptureTransaction( - Arg.Do(t => transaction = t), + Arg.Do(t => transaction = t), Arg.Any(), Arg.Any() ); @@ -594,13 +594,13 @@ public async Task Transaction_binds_exception_thrown() public async Task Transaction_TransactionNameProviderSetSet_TransactionNameSet() { // Arrange - Transaction transaction = null; + SentryTransaction transaction = null; var expectedName = "My custom name"; var sentryClient = Substitute.For(); - sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) - .Do(callback => transaction = callback.Arg()); + sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(callback => transaction = callback.Arg()); var options = new SentryAspNetCoreOptions { Dsn = ValidDsn, @@ -638,11 +638,11 @@ public async Task Transaction_TransactionNameProviderSetSet_TransactionNameSet() public async Task Transaction_TransactionNameProviderSetUnset_TransactionNameSetToUrlPath() { // Arrange - Transaction transaction = null; + SentryTransaction transaction = null; var sentryClient = Substitute.For(); - sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) - .Do(callback => transaction = callback.Arg()); + sentryClient.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(callback => transaction = callback.Arg()); var options = new SentryAspNetCoreOptions { Dsn = ValidDsn, diff --git a/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs b/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs index b0aac44fa1..2abec83d8d 100644 --- a/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs +++ b/test/Sentry.Azure.Functions.Worker.Tests/SentryFunctionsWorkerMiddlewareTests.cs @@ -9,7 +9,7 @@ private class Fixture { public IHub Hub { get; set; } public IInternalScopeManager ScopeManager { get; } - public Transaction Transaction { get; set; } + public SentryTransaction Transaction { get; set; } public Fixture() { @@ -22,8 +22,8 @@ public Fixture() var client = Substitute.For(); var sessionManager = Substitute.For(); - client.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) - .Do(callback => Transaction = callback.Arg()); + client.When(x => x.CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(callback => Transaction = callback.Arg()); ScopeManager = new SentryScopeManager(options, client); Hub = new Hub(options, client, sessionManager, new MockClock(), ScopeManager); diff --git a/test/Sentry.OpenTelemetry.Tests/OpenTelemetryTransactionProcessorTests.cs b/test/Sentry.OpenTelemetry.Tests/OpenTelemetryTransactionProcessorTests.cs index f7287d49e9..714caf1cb7 100644 --- a/test/Sentry.OpenTelemetry.Tests/OpenTelemetryTransactionProcessorTests.cs +++ b/test/Sentry.OpenTelemetry.Tests/OpenTelemetryTransactionProcessorTests.cs @@ -7,7 +7,7 @@ public void Process_WithActivity_SetsTraceAndSpanIds() { // Arrange using var activity = Tracer.StartActivity("Parent"); - var transaction = new Transaction("name", "operation"); + var transaction = new SentryTransaction("name", "operation"); var processor = new OpenTelemetryTransactionProcessor(); // Act @@ -22,7 +22,7 @@ public void Process_WithActivity_SetsTraceAndSpanIds() public void Process_WithoutActivity_DoesNotModifyTransaction() { // Arrange - var transaction = new Transaction("name", "operation"); + var transaction = new SentryTransaction("name", "operation"); var previousTraceId = transaction.Contexts.Trace.TraceId; var previousSpanId = transaction.Contexts.Trace.SpanId; var processor = new OpenTelemetryTransactionProcessor(); diff --git a/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs b/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs index 6764077874..5b46d09901 100644 --- a/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs +++ b/test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs @@ -105,7 +105,7 @@ private SampleProfile CaptureAndValidate(ITransactionProfilerFactory factory) sut!.Finish(); var elapsedNanoseconds = (ulong)((clock.CurrentDateTimeOffset - clock.StartDateTimeOffset).TotalMilliseconds * 1_000_000); - var transaction = new Transaction(transactionTracer); + var transaction = new SentryTransaction(transactionTracer); var collectTask = sut.CollectAsync(transaction); collectTask.Wait(); var profileInfo = collectTask.Result; @@ -169,7 +169,7 @@ public async Task Profiler_AfterTimeout_Stops() RunForMs(limitMs * 10); sut.Finish(); - var collectTask = sut.CollectAsync(new Transaction("foo", "bar")); + var collectTask = sut.CollectAsync(new SentryTransaction("foo", "bar")); collectTask.Wait(); var profileInfo = collectTask.Result; @@ -257,7 +257,7 @@ async Task VerifyAsync(HttpRequestMessage message) envelopeLines[1].Should().StartWith("{\"type\":\"transaction\""); envelopeLines[3].Should().StartWith("{\"type\":\"profile\""); - var transaction = Json.Parse(envelopeLines[2], Transaction.FromJson); + var transaction = Json.Parse(envelopeLines[2], SentryTransaction.FromJson); // TODO do we want to bother with JSON parsing just to do this? Doing at least simple checks for now... // var profileInfo = Json.Parse(envelopeLines[4], ProfileInfo.FromJson); diff --git a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs index cac77b2821..bf3404381e 100644 --- a/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs +++ b/test/Sentry.Profiling.Tests/TraceLogProcessorTests.verify.cs @@ -78,7 +78,7 @@ public Task Profile_Serialization_Works() [Fact] public Task ProfileInfo_Serialization_Works() { - var transaction = new Transaction("name", "op"); + var transaction = new SentryTransaction("name", "op"); transaction.Contexts.Device.Architecture = "arch"; transaction.Contexts.Device.Model = "device model"; transaction.Contexts.Device.Manufacturer = "device make"; diff --git a/test/Sentry.Testing/VerifyExtensions.cs b/test/Sentry.Testing/VerifyExtensions.cs index e4f0d2cddc..0fc87d9513 100644 --- a/test/Sentry.Testing/VerifyExtensions.cs +++ b/test/Sentry.Testing/VerifyExtensions.cs @@ -32,7 +32,7 @@ public static SettingsTask IgnoreStandardSentryMembers(this SettingsTask setting _ => _.Headers) .IgnoreMembers( _ => _.Duration) - .IgnoreMembers( + .IgnoreMembers( _ => _.Release) .IgnoreMembers( _ => _.Module, diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 46d98fd264..5aeb3cded7 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -265,8 +265,8 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); void CaptureSession(Sentry.SessionUpdate sessionUpdate); - void CaptureTransaction(Sentry.Transaction transaction); - void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } @@ -469,7 +469,7 @@ namespace Sentry public static void AddExceptionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryEventExceptionProcessor processor) { } public static void AddExceptionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static void AddTransactionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryTransactionProcessor processor) { } - public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } + public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } public static void AddTransactionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } @@ -493,8 +493,8 @@ namespace Sentry public Sentry.IMetricAggregator Metrics { get; } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -678,8 +678,8 @@ namespace Sentry public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -736,8 +736,8 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public static void CaptureTransaction(Sentry.Transaction transaction) { } - public static void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + @@ -850,6 +850,50 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + public SentryTransaction(Sentry.ITransactionTracer tracer) { } + public SentryTransaction(string name, string operation) { } + public SentryTransaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } + public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } + public Sentry.Contexts Contexts { get; set; } + public string? Description { get; set; } + public string? Distribution { get; set; } + public System.DateTimeOffset? EndTimestamp { get; } + public string? Environment { get; set; } + public Sentry.SentryId EventId { get; } + public System.Collections.Generic.IReadOnlyDictionary Extra { get; } + public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } + public bool IsFinished { get; } + public bool? IsParentSampled { get; set; } + public bool? IsSampled { get; } + public Sentry.SentryLevel? Level { get; set; } + public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + public string Name { get; } + public Sentry.TransactionNameSource NameSource { get; } + public string Operation { get; } + public Sentry.SpanId? ParentSpanId { get; } + public string? Platform { get; set; } + public string? Release { get; set; } + public Sentry.Request Request { get; set; } + public double? SampleRate { get; } + public Sentry.SdkVersion Sdk { get; } + public Sentry.SpanId SpanId { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.DateTimeOffset StartTimestamp { get; } + public Sentry.SpanStatus? Status { get; } + public System.Collections.Generic.IReadOnlyDictionary Tags { get; } + public Sentry.SentryId TraceId { get; } + public Sentry.SentryUser User { get; set; } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } + public Sentry.SentryTraceHeader GetTraceHeader() { } + public void SetExtra(string key, object? value) { } + public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } + public void SetTag(string key, string value) { } + public void UnsetTag(string key) { } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } + } public sealed class SentryUser : Sentry.IJsonSerializable { public SentryUser() { } @@ -1025,50 +1069,6 @@ namespace Sentry public Timing(Sentry.IHub hub, string key, Sentry.MeasurementUnit.Duration unit = 3, System.Collections.Generic.IDictionary? tags = null) { } public void Dispose() { } } - public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext - { - public Transaction(Sentry.ITransactionTracer tracer) { } - public Transaction(string name, string operation) { } - public Transaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } - public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } - public Sentry.Contexts Contexts { get; set; } - public string? Description { get; set; } - public string? Distribution { get; set; } - public System.DateTimeOffset? EndTimestamp { get; } - public string? Environment { get; set; } - public Sentry.SentryId EventId { get; } - public System.Collections.Generic.IReadOnlyDictionary Extra { get; } - public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } - public bool IsFinished { get; } - public bool? IsParentSampled { get; set; } - public bool? IsSampled { get; } - public Sentry.SentryLevel? Level { get; set; } - public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - public string Name { get; } - public Sentry.TransactionNameSource NameSource { get; } - public string Operation { get; } - public Sentry.SpanId? ParentSpanId { get; } - public string? Platform { get; set; } - public string? Release { get; set; } - public Sentry.Request Request { get; set; } - public double? SampleRate { get; } - public Sentry.SdkVersion Sdk { get; } - public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } - public System.DateTimeOffset StartTimestamp { get; } - public Sentry.SpanStatus? Status { get; } - public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.SentryId TraceId { get; } - public Sentry.SentryUser User { get; set; } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public Sentry.SentryTraceHeader GetTraceHeader() { } - public void SetExtra(string key, object? value) { } - public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } - public void SetTag(string key, string value) { } - public void UnsetTag(string key) { } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.Transaction FromJson(System.Text.Json.JsonElement json) { } - } public class TransactionContext : Sentry.SpanContext, Sentry.ITransactionContext, Sentry.Protocol.ITraceContext { public TransactionContext(string name, string operation, Sentry.SpanId? spanId = default, Sentry.SpanId? parentSpanId = default, Sentry.SentryId? traceId = default, string? description = "", Sentry.SpanStatus? status = default, bool? isSampled = default, bool? isParentSampled = default, Sentry.TransactionNameSource nameSource = 0) { } @@ -1215,8 +1215,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1258,8 +1258,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } public Sentry.SentryId CaptureException(System.Exception exception) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1326,11 +1326,11 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction); } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); } public interface ITransport { @@ -1692,7 +1692,7 @@ namespace Sentry.Protocol.Envelopes public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable @@ -1710,7 +1710,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 46d98fd264..5aeb3cded7 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -265,8 +265,8 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); void CaptureSession(Sentry.SessionUpdate sessionUpdate); - void CaptureTransaction(Sentry.Transaction transaction); - void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } @@ -469,7 +469,7 @@ namespace Sentry public static void AddExceptionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryEventExceptionProcessor processor) { } public static void AddExceptionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static void AddTransactionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryTransactionProcessor processor) { } - public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } + public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } public static void AddTransactionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } @@ -493,8 +493,8 @@ namespace Sentry public Sentry.IMetricAggregator Metrics { get; } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -678,8 +678,8 @@ namespace Sentry public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -736,8 +736,8 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public static void CaptureTransaction(Sentry.Transaction transaction) { } - public static void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + @@ -850,6 +850,50 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + public SentryTransaction(Sentry.ITransactionTracer tracer) { } + public SentryTransaction(string name, string operation) { } + public SentryTransaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } + public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } + public Sentry.Contexts Contexts { get; set; } + public string? Description { get; set; } + public string? Distribution { get; set; } + public System.DateTimeOffset? EndTimestamp { get; } + public string? Environment { get; set; } + public Sentry.SentryId EventId { get; } + public System.Collections.Generic.IReadOnlyDictionary Extra { get; } + public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } + public bool IsFinished { get; } + public bool? IsParentSampled { get; set; } + public bool? IsSampled { get; } + public Sentry.SentryLevel? Level { get; set; } + public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + public string Name { get; } + public Sentry.TransactionNameSource NameSource { get; } + public string Operation { get; } + public Sentry.SpanId? ParentSpanId { get; } + public string? Platform { get; set; } + public string? Release { get; set; } + public Sentry.Request Request { get; set; } + public double? SampleRate { get; } + public Sentry.SdkVersion Sdk { get; } + public Sentry.SpanId SpanId { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.DateTimeOffset StartTimestamp { get; } + public Sentry.SpanStatus? Status { get; } + public System.Collections.Generic.IReadOnlyDictionary Tags { get; } + public Sentry.SentryId TraceId { get; } + public Sentry.SentryUser User { get; set; } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } + public Sentry.SentryTraceHeader GetTraceHeader() { } + public void SetExtra(string key, object? value) { } + public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } + public void SetTag(string key, string value) { } + public void UnsetTag(string key) { } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } + } public sealed class SentryUser : Sentry.IJsonSerializable { public SentryUser() { } @@ -1025,50 +1069,6 @@ namespace Sentry public Timing(Sentry.IHub hub, string key, Sentry.MeasurementUnit.Duration unit = 3, System.Collections.Generic.IDictionary? tags = null) { } public void Dispose() { } } - public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext - { - public Transaction(Sentry.ITransactionTracer tracer) { } - public Transaction(string name, string operation) { } - public Transaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } - public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } - public Sentry.Contexts Contexts { get; set; } - public string? Description { get; set; } - public string? Distribution { get; set; } - public System.DateTimeOffset? EndTimestamp { get; } - public string? Environment { get; set; } - public Sentry.SentryId EventId { get; } - public System.Collections.Generic.IReadOnlyDictionary Extra { get; } - public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } - public bool IsFinished { get; } - public bool? IsParentSampled { get; set; } - public bool? IsSampled { get; } - public Sentry.SentryLevel? Level { get; set; } - public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - public string Name { get; } - public Sentry.TransactionNameSource NameSource { get; } - public string Operation { get; } - public Sentry.SpanId? ParentSpanId { get; } - public string? Platform { get; set; } - public string? Release { get; set; } - public Sentry.Request Request { get; set; } - public double? SampleRate { get; } - public Sentry.SdkVersion Sdk { get; } - public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } - public System.DateTimeOffset StartTimestamp { get; } - public Sentry.SpanStatus? Status { get; } - public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.SentryId TraceId { get; } - public Sentry.SentryUser User { get; set; } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public Sentry.SentryTraceHeader GetTraceHeader() { } - public void SetExtra(string key, object? value) { } - public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } - public void SetTag(string key, string value) { } - public void UnsetTag(string key) { } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.Transaction FromJson(System.Text.Json.JsonElement json) { } - } public class TransactionContext : Sentry.SpanContext, Sentry.ITransactionContext, Sentry.Protocol.ITraceContext { public TransactionContext(string name, string operation, Sentry.SpanId? spanId = default, Sentry.SpanId? parentSpanId = default, Sentry.SentryId? traceId = default, string? description = "", Sentry.SpanStatus? status = default, bool? isSampled = default, bool? isParentSampled = default, Sentry.TransactionNameSource nameSource = 0) { } @@ -1215,8 +1215,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1258,8 +1258,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } public Sentry.SentryId CaptureException(System.Exception exception) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1326,11 +1326,11 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction); } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); } public interface ITransport { @@ -1692,7 +1692,7 @@ namespace Sentry.Protocol.Envelopes public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable @@ -1710,7 +1710,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 74ffac9493..78ff7adc7b 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -266,8 +266,8 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); void CaptureSession(Sentry.SessionUpdate sessionUpdate); - void CaptureTransaction(Sentry.Transaction transaction); - void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } @@ -470,7 +470,7 @@ namespace Sentry public static void AddExceptionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryEventExceptionProcessor processor) { } public static void AddExceptionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static void AddTransactionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryTransactionProcessor processor) { } - public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } + public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } public static void AddTransactionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } @@ -494,8 +494,8 @@ namespace Sentry public Sentry.IMetricAggregator Metrics { get; } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -679,8 +679,8 @@ namespace Sentry public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -737,8 +737,8 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public static void CaptureTransaction(Sentry.Transaction transaction) { } - public static void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + @@ -851,6 +851,50 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + public SentryTransaction(Sentry.ITransactionTracer tracer) { } + public SentryTransaction(string name, string operation) { } + public SentryTransaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } + public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } + public Sentry.Contexts Contexts { get; set; } + public string? Description { get; set; } + public string? Distribution { get; set; } + public System.DateTimeOffset? EndTimestamp { get; } + public string? Environment { get; set; } + public Sentry.SentryId EventId { get; } + public System.Collections.Generic.IReadOnlyDictionary Extra { get; } + public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } + public bool IsFinished { get; } + public bool? IsParentSampled { get; set; } + public bool? IsSampled { get; } + public Sentry.SentryLevel? Level { get; set; } + public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + public string Name { get; } + public Sentry.TransactionNameSource NameSource { get; } + public string Operation { get; } + public Sentry.SpanId? ParentSpanId { get; } + public string? Platform { get; set; } + public string? Release { get; set; } + public Sentry.Request Request { get; set; } + public double? SampleRate { get; } + public Sentry.SdkVersion Sdk { get; } + public Sentry.SpanId SpanId { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.DateTimeOffset StartTimestamp { get; } + public Sentry.SpanStatus? Status { get; } + public System.Collections.Generic.IReadOnlyDictionary Tags { get; } + public Sentry.SentryId TraceId { get; } + public Sentry.SentryUser User { get; set; } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } + public Sentry.SentryTraceHeader GetTraceHeader() { } + public void SetExtra(string key, object? value) { } + public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } + public void SetTag(string key, string value) { } + public void UnsetTag(string key) { } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } + } public sealed class SentryUser : Sentry.IJsonSerializable { public SentryUser() { } @@ -1026,50 +1070,6 @@ namespace Sentry public Timing(Sentry.IHub hub, string key, Sentry.MeasurementUnit.Duration unit = 3, System.Collections.Generic.IDictionary? tags = null) { } public void Dispose() { } } - public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext - { - public Transaction(Sentry.ITransactionTracer tracer) { } - public Transaction(string name, string operation) { } - public Transaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } - public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } - public Sentry.Contexts Contexts { get; set; } - public string? Description { get; set; } - public string? Distribution { get; set; } - public System.DateTimeOffset? EndTimestamp { get; } - public string? Environment { get; set; } - public Sentry.SentryId EventId { get; } - public System.Collections.Generic.IReadOnlyDictionary Extra { get; } - public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } - public bool IsFinished { get; } - public bool? IsParentSampled { get; set; } - public bool? IsSampled { get; } - public Sentry.SentryLevel? Level { get; set; } - public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - public string Name { get; } - public Sentry.TransactionNameSource NameSource { get; } - public string Operation { get; } - public Sentry.SpanId? ParentSpanId { get; } - public string? Platform { get; set; } - public string? Release { get; set; } - public Sentry.Request Request { get; set; } - public double? SampleRate { get; } - public Sentry.SdkVersion Sdk { get; } - public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } - public System.DateTimeOffset StartTimestamp { get; } - public Sentry.SpanStatus? Status { get; } - public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.SentryId TraceId { get; } - public Sentry.SentryUser User { get; set; } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public Sentry.SentryTraceHeader GetTraceHeader() { } - public void SetExtra(string key, object? value) { } - public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } - public void SetTag(string key, string value) { } - public void UnsetTag(string key) { } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.Transaction FromJson(System.Text.Json.JsonElement json) { } - } public class TransactionContext : Sentry.SpanContext, Sentry.ITransactionContext, Sentry.Protocol.ITraceContext { public TransactionContext(string name, string operation, Sentry.SpanId? spanId = default, Sentry.SpanId? parentSpanId = default, Sentry.SentryId? traceId = default, string? description = "", Sentry.SpanStatus? status = default, bool? isSampled = default, bool? isParentSampled = default, Sentry.TransactionNameSource nameSource = 0) { } @@ -1216,8 +1216,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1259,8 +1259,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } public Sentry.SentryId CaptureException(System.Exception exception) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1327,11 +1327,11 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction); } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); } public interface ITransport { @@ -1693,7 +1693,7 @@ namespace Sentry.Protocol.Envelopes public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable @@ -1711,7 +1711,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 85970158d3..83e7cfd213 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -264,8 +264,8 @@ namespace Sentry Sentry.IMetricAggregator Metrics { get; } Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null); void CaptureSession(Sentry.SessionUpdate sessionUpdate); - void CaptureTransaction(Sentry.Transaction transaction); - void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); + void CaptureTransaction(Sentry.SentryTransaction transaction); + void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint); void CaptureUserFeedback(Sentry.UserFeedback userFeedback); System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout); } @@ -468,7 +468,7 @@ namespace Sentry public static void AddExceptionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryEventExceptionProcessor processor) { } public static void AddExceptionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static void AddTransactionProcessor(this Sentry.Scope scope, Sentry.Extensibility.ISentryTransactionProcessor processor) { } - public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } + public static void AddTransactionProcessor(this Sentry.Scope scope, System.Func processor) { } public static void AddTransactionProcessors(this Sentry.Scope scope, System.Collections.Generic.IEnumerable processors) { } public static System.Collections.Generic.IEnumerable GetAllEventProcessors(this Sentry.Scope scope) { } public static System.Collections.Generic.IEnumerable GetAllExceptionProcessors(this Sentry.Scope scope) { } @@ -492,8 +492,8 @@ namespace Sentry public Sentry.IMetricAggregator Metrics { get; } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent? @event, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void Dispose() { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } @@ -676,8 +676,8 @@ namespace Sentry public void SetBeforeBreadcrumb(System.Func beforeBreadcrumb) { } public void SetBeforeSend(System.Func beforeSend) { } public void SetBeforeSend(System.Func beforeSend) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } - public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } + public void SetBeforeSendTransaction(System.Func beforeSendTransaction) { } } public static class SentryOptionsExtensions { @@ -733,8 +733,8 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(string message, Sentry.SentryLevel level = 1) { } public static Sentry.SentryId CaptureMessage(string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public static void CaptureTransaction(Sentry.Transaction transaction) { } - public static void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public static void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public static void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public static void CaptureUserFeedback(Sentry.SentryId eventId, string email, string comments, string? name = null) { } [System.Obsolete("WARNING: This method deliberately causes a crash, and should not be used in a rea" + @@ -847,6 +847,50 @@ namespace Sentry public override string ToString() { } public static Sentry.SentryTraceHeader Parse(string value) { } } + public class SentryTransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + public SentryTransaction(Sentry.ITransactionTracer tracer) { } + public SentryTransaction(string name, string operation) { } + public SentryTransaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } + public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } + public Sentry.Contexts Contexts { get; set; } + public string? Description { get; set; } + public string? Distribution { get; set; } + public System.DateTimeOffset? EndTimestamp { get; } + public string? Environment { get; set; } + public Sentry.SentryId EventId { get; } + public System.Collections.Generic.IReadOnlyDictionary Extra { get; } + public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } + public bool IsFinished { get; } + public bool? IsParentSampled { get; set; } + public bool? IsSampled { get; } + public Sentry.SentryLevel? Level { get; set; } + public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + public string Name { get; } + public Sentry.TransactionNameSource NameSource { get; } + public string Operation { get; } + public Sentry.SpanId? ParentSpanId { get; } + public string? Platform { get; set; } + public string? Release { get; set; } + public Sentry.Request Request { get; set; } + public double? SampleRate { get; } + public Sentry.SdkVersion Sdk { get; } + public Sentry.SpanId SpanId { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.DateTimeOffset StartTimestamp { get; } + public Sentry.SpanStatus? Status { get; } + public System.Collections.Generic.IReadOnlyDictionary Tags { get; } + public Sentry.SentryId TraceId { get; } + public Sentry.SentryUser User { get; set; } + public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } + public Sentry.SentryTraceHeader GetTraceHeader() { } + public void SetExtra(string key, object? value) { } + public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } + public void SetTag(string key, string value) { } + public void UnsetTag(string key) { } + public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } + public static Sentry.SentryTransaction FromJson(System.Text.Json.JsonElement json) { } + } public sealed class SentryUser : Sentry.IJsonSerializable { public SentryUser() { } @@ -1022,50 +1066,6 @@ namespace Sentry public Timing(Sentry.IHub hub, string key, Sentry.MeasurementUnit.Duration unit = 3, System.Collections.Generic.IDictionary? tags = null) { } public void Dispose() { } } - public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext - { - public Transaction(Sentry.ITransactionTracer tracer) { } - public Transaction(string name, string operation) { } - public Transaction(string name, string operation, Sentry.TransactionNameSource nameSource) { } - public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } - public Sentry.Contexts Contexts { get; set; } - public string? Description { get; set; } - public string? Distribution { get; set; } - public System.DateTimeOffset? EndTimestamp { get; } - public string? Environment { get; set; } - public Sentry.SentryId EventId { get; } - public System.Collections.Generic.IReadOnlyDictionary Extra { get; } - public System.Collections.Generic.IReadOnlyList Fingerprint { get; set; } - public bool IsFinished { get; } - public bool? IsParentSampled { get; set; } - public bool? IsSampled { get; } - public Sentry.SentryLevel? Level { get; set; } - public System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - public string Name { get; } - public Sentry.TransactionNameSource NameSource { get; } - public string Operation { get; } - public Sentry.SpanId? ParentSpanId { get; } - public string? Platform { get; set; } - public string? Release { get; set; } - public Sentry.Request Request { get; set; } - public double? SampleRate { get; } - public Sentry.SdkVersion Sdk { get; } - public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } - public System.DateTimeOffset StartTimestamp { get; } - public Sentry.SpanStatus? Status { get; } - public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.SentryId TraceId { get; } - public Sentry.SentryUser User { get; set; } - public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { } - public Sentry.SentryTraceHeader GetTraceHeader() { } - public void SetExtra(string key, object? value) { } - public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } - public void SetTag(string key, string value) { } - public void UnsetTag(string key) { } - public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { } - public static Sentry.Transaction FromJson(System.Text.Json.JsonElement json) { } - } public class TransactionContext : Sentry.SpanContext, Sentry.ITransactionContext, Sentry.Protocol.ITraceContext { public TransactionContext(string name, string operation, Sentry.SpanId? spanId = default, Sentry.SpanId? parentSpanId = default, Sentry.SentryId? traceId = default, string? description = "", Sentry.SpanStatus? status = default, bool? isSampled = default, bool? isParentSampled = default, Sentry.TransactionNameSource nameSource = 0) { } @@ -1212,8 +1212,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback userFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1255,8 +1255,8 @@ namespace Sentry.Extensibility public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope, Sentry.Hint? hint = null) { } public Sentry.SentryId CaptureException(System.Exception exception) { } public void CaptureSession(Sentry.SessionUpdate sessionUpdate) { } - public void CaptureTransaction(Sentry.Transaction transaction) { } - public void CaptureTransaction(Sentry.Transaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction) { } + public void CaptureTransaction(Sentry.SentryTransaction transaction, Sentry.Scope? scope, Sentry.Hint? hint) { } public void CaptureUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } public void ConfigureScope(System.Action configureScope) { } public System.Threading.Tasks.Task ConfigureScopeAsync(System.Func configureScope) { } @@ -1323,11 +1323,11 @@ namespace Sentry.Extensibility } public interface ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction); } public interface ISentryTransactionProcessorWithHint : Sentry.Extensibility.ISentryTransactionProcessor { - Sentry.Transaction? Process(Sentry.Transaction transaction, Sentry.Hint hint); + Sentry.SentryTransaction? Process(Sentry.SentryTransaction transaction, Sentry.Hint hint); } public interface ITransport { @@ -1690,7 +1690,7 @@ namespace Sentry.Protocol.Envelopes public static System.Threading.Tasks.Task DeserializeAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) { } public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.Envelope FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable @@ -1708,7 +1708,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.EnvelopeItem FromAttachment(Sentry.Attachment attachment) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromEvent(Sentry.SentryEvent @event) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.Transaction transaction) { } + public static Sentry.Protocol.Envelopes.EnvelopeItem FromTransaction(Sentry.SentryTransaction transaction) { } public static Sentry.Protocol.Envelopes.EnvelopeItem FromUserFeedback(Sentry.UserFeedback sentryUserFeedback) { } } public interface ISerializable diff --git a/test/Sentry.Tests/HubTests.cs b/test/Sentry.Tests/HubTests.cs index dba7eba7dc..d38f180c95 100644 --- a/test/Sentry.Tests/HubTests.cs +++ b/test/Sentry.Tests/HubTests.cs @@ -993,7 +993,7 @@ internal class ThrowingProfiler : ITransactionProfiler { public void Finish() { } - public Sentry.Protocol.Envelopes.ISerializable Collect(Transaction _) => throw new Exception("test"); + public Sentry.Protocol.Envelopes.ISerializable Collect(SentryTransaction _) => throw new Exception("test"); } private class AsyncThrowingProfilerFactory : ITransactionProfilerFactory @@ -1005,10 +1005,10 @@ internal class AsyncThrowingProfiler : ITransactionProfiler { public void Finish() { } - public Sentry.Protocol.Envelopes.ISerializable Collect(Transaction transaction) + public Sentry.Protocol.Envelopes.ISerializable Collect(SentryTransaction transaction) => AsyncJsonSerializable.CreateFrom(CollectAsync(transaction)); - private async Task CollectAsync(Transaction transaction) + private async Task CollectAsync(SentryTransaction transaction) { await Task.Delay(1); throw new Exception("test"); @@ -1023,7 +1023,7 @@ internal class TestProfiler : ITransactionProfiler { public void Finish() { } - public Sentry.Protocol.Envelopes.ISerializable Collect(Transaction _) => new JsonSerializable(new ProfileInfo()); + public Sentry.Protocol.Envelopes.ISerializable Collect(SentryTransaction _) => new JsonSerializable(new ProfileInfo()); } #nullable disable @@ -1453,7 +1453,7 @@ public void CaptureTransaction_HubEnabled(bool enabled) transaction.Finish(); // Assert - _fixture.Client.Received().CaptureTransaction(Arg.Is(t => t.IsSampled == enabled), Arg.Any(), Arg.Any()); + _fixture.Client.Received().CaptureTransaction(Arg.Is(t => t.IsSampled == enabled), Arg.Any(), Arg.Any()); } [Fact] @@ -1467,7 +1467,7 @@ public void CaptureTransaction_Client_Gets_Hint() transaction.Finish(); // Assert - _fixture.Client.Received().CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); + _fixture.Client.Received().CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); } [Theory] diff --git a/test/Sentry.Tests/ProfilerTests.cs b/test/Sentry.Tests/ProfilerTests.cs index 7f1d81c7c1..853754bc57 100644 --- a/test/Sentry.Tests/ProfilerTests.cs +++ b/test/Sentry.Tests/ProfilerTests.cs @@ -62,7 +62,7 @@ async Task VerifyAsync(HttpRequestMessage message) envelopeLines[1].Should().StartWith("{\"type\":\"transaction\""); envelopeLines[3].Should().StartWith("{\"type\":\"profile\""); - var transaction = Json.Parse(envelopeLines[2], Transaction.FromJson); + var transaction = Json.Parse(envelopeLines[2], SentryTransaction.FromJson); // TODO do we want to bother with JSON parsing just to do this? Doing at least simple checks for now... // var profileInfo = Json.Parse(envelopeLines[4], ProfileInfo.FromJson); diff --git a/test/Sentry.Tests/Protocol/MeasurementTests.cs b/test/Sentry.Tests/Protocol/MeasurementTests.cs index bfeca3312a..b84f3f2768 100644 --- a/test/Sentry.Tests/Protocol/MeasurementTests.cs +++ b/test/Sentry.Tests/Protocol/MeasurementTests.cs @@ -183,7 +183,7 @@ public void Transaction_SetMeasurement_IntValue() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && t.Measurements["foo"].Value.As() == int.MaxValue && t.Measurements["foo"].Unit == EmptyUnit), @@ -211,7 +211,7 @@ public void Transaction_SetMeasurement_LongValue() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && t.Measurements["foo"].Value.As() == long.MaxValue && t.Measurements["foo"].Unit == EmptyUnit), @@ -239,7 +239,7 @@ public void Transaction_SetMeasurement_ULongValue() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && t.Measurements["foo"].Value.As() == ulong.MaxValue && t.Measurements["foo"].Unit == EmptyUnit), @@ -267,7 +267,7 @@ public void Transaction_SetMeasurement_DoubleValue() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && Math.Abs(t.Measurements["foo"].Value.As() - double.MaxValue) < double.Epsilon && t.Measurements["foo"].Unit == EmptyUnit), @@ -295,7 +295,7 @@ public void Transaction_SetMeasurement_IntValue_WithUnit() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && t.Measurements["foo"].Value.As() == int.MaxValue && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), @@ -323,7 +323,7 @@ public void Transaction_SetMeasurement_LongValue_WithUnit() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && t.Measurements["foo"].Value.As() == long.MaxValue && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), @@ -351,7 +351,7 @@ public void Transaction_SetMeasurement_ULongValue_WithUnit() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && t.Measurements["foo"].Value.As() == ulong.MaxValue && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), @@ -379,7 +379,7 @@ public void Transaction_SetMeasurement_DoubleValue_WithUnit() // Assert client.Received(1).CaptureTransaction( - Arg.Is(t => + Arg.Is(t => t.Measurements.Count == 1 && Math.Abs(t.Measurements["foo"].Value.As() - double.MaxValue) < double.Epsilon && t.Measurements["foo"].Unit == MeasurementUnit.Duration.Nanosecond), diff --git a/test/Sentry.Tests/Protocol/MeasurementTests.verify.cs b/test/Sentry.Tests/Protocol/MeasurementTests.verify.cs index 84fab0a02b..fa21ad1b4e 100644 --- a/test/Sentry.Tests/Protocol/MeasurementTests.verify.cs +++ b/test/Sentry.Tests/Protocol/MeasurementTests.verify.cs @@ -6,7 +6,7 @@ public partial class MeasurementTests [Fact] public Task Transaction_Serializes_Measurements() { - var transaction = new Transaction("name", "operation"); + var transaction = new SentryTransaction("name", "operation"); transaction.Contexts.Trace.SpanId = SpanId.Empty; transaction.SetMeasurement("_", 0, MeasurementUnit.None); diff --git a/test/Sentry.Tests/Protocol/TransactionTests.cs b/test/Sentry.Tests/Protocol/SentryTransactionTests.cs similarity index 97% rename from test/Sentry.Tests/Protocol/TransactionTests.cs rename to test/Sentry.Tests/Protocol/SentryTransactionTests.cs index 652ddbd402..ac24254c36 100644 --- a/test/Sentry.Tests/Protocol/TransactionTests.cs +++ b/test/Sentry.Tests/Protocol/SentryTransactionTests.cs @@ -1,10 +1,10 @@ namespace Sentry.Tests.Protocol; -public class TransactionTests +public class SentryTransactionTests { private readonly IDiagnosticLogger _testOutputLogger; - public TransactionTests(ITestOutputHelper output) + public SentryTransactionTests(ITestOutputHelper output) { _testOutputLogger = new TestOutputDiagnosticLogger(output); } @@ -133,7 +133,7 @@ public void Redact_Redacts_Urls() txTracer.Finish(SpanStatus.Aborted); // Act - var transaction = new Transaction(txTracer); + var transaction = new SentryTransaction(txTracer); transaction.Redact(); // Assert @@ -228,9 +228,9 @@ public void SerializeObject_AllPropertiesSetToNonDefault_SerializesValidObject() transaction.Finish(SpanStatus.Aborted); // Act - var finalTransaction = new Transaction(transaction); + var finalTransaction = new SentryTransaction(transaction); var actualString = finalTransaction.ToJsonString(_testOutputLogger); - var actual = Json.Parse(actualString, Transaction.FromJson); + var actual = Json.Parse(actualString, SentryTransaction.FromJson); // Assert actual.Should().BeEquivalentTo(finalTransaction, o => @@ -390,8 +390,8 @@ public void Finish_SentryRequestSpansGetIgnored() var sentryRequest = (SpanTracer)transactionTracer.StartChild("sentryRequest"); sentryRequest.IsSentryRequest = true; - Transaction transaction = null; - hub.CaptureTransaction(Arg.Do(t => transaction = t)); + SentryTransaction transaction = null; + hub.CaptureTransaction(Arg.Do(t => transaction = t)); // Act transactionTracer.Finish(); @@ -449,7 +449,7 @@ public void Finish_CapturesTransaction() transaction.Finish(); // Assert - client.Received(1).CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); + client.Received(1).CaptureTransaction(Arg.Any(), Arg.Any(), Arg.Any()); } [Fact] diff --git a/test/Sentry.Tests/SentryClientTests.CaptureTransaction_BeforeSendTransactionThrows_ErrorToEventBreadcrumb.verified.txt b/test/Sentry.Tests/SentryClientTests.CaptureTransaction_BeforeSendTransactionThrows_ErrorToEventBreadcrumb.verified.txt index c7abf6c24c..c6f3a16345 100644 --- a/test/Sentry.Tests/SentryClientTests.CaptureTransaction_BeforeSendTransactionThrows_ErrorToEventBreadcrumb.verified.txt +++ b/test/Sentry.Tests/SentryClientTests.CaptureTransaction_BeforeSendTransactionThrows_ErrorToEventBreadcrumb.verified.txt @@ -6,7 +6,7 @@ message: Exception message!, stackTrace: at Task Sentry.Tests.SentryClientTests.CaptureTransaction_BeforeSendTransactionThrows_ErrorToEventBreadcrumb() -at Transaction Sentry.SentryClient.BeforeSendTransaction(...) +at SentryTransaction Sentry.SentryClient.BeforeSendTransaction(...) }, Category: SentryClient, Level: error diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index c13f2475b7..cf66d296ac 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -843,7 +843,7 @@ public void CaptureTransaction_SampledOut_Dropped() var client = _fixture.GetSut(); // Act - client.CaptureTransaction(new Transaction( + client.CaptureTransaction(new SentryTransaction( "test name", "test operation" ) @@ -864,7 +864,7 @@ public void CaptureTransaction_ValidTransaction_Sent() // Act client.CaptureTransaction( - new Transaction( + new SentryTransaction( "test name", "test operation" ) @@ -883,7 +883,7 @@ public void CaptureTransaction_NoSpanId_Ignored() // Arrange var client = _fixture.GetSut(); - var transaction = new Transaction( + var transaction = new SentryTransaction( "test name", "test operation" ) @@ -909,7 +909,7 @@ public void CaptureTransaction_NoName_Ignored() // Act client.CaptureTransaction( - new Transaction( + new SentryTransaction( null!, "test operation" ) @@ -930,7 +930,7 @@ public void CaptureTransaction_NoOperation_Ignored() // Act client.CaptureTransaction( - new Transaction( + new SentryTransaction( "test name", null! ) @@ -951,7 +951,7 @@ public void CaptureTransaction_NotFinished_Sent() // Act client.CaptureTransaction( - new Transaction( + new SentryTransaction( "test name", "test operation" ) @@ -970,7 +970,7 @@ public void CaptureTransaction_DisposedClient_DoesNotThrow() var sut = _fixture.GetSut(); sut.Dispose(); sut.CaptureTransaction( - new Transaction( + new SentryTransaction( "test name", "test operation") { @@ -985,7 +985,7 @@ public void CaptureTransaction_Redact_Description() // Arrange _fixture.SentryOptions.SendDefaultPii = false; var client = _fixture.GetSut(); - var original = new Transaction( + var original = new SentryTransaction( "test name", "test operation" ) @@ -1003,7 +1003,7 @@ public void CaptureTransaction_Redact_Description() // Assert envelope.Should().NotBeNull(); envelope.Items.Count.Should().Be(1); - var actual = (envelope.Items[0].Payload as JsonSerializable)?.Source as Transaction; + var actual = (envelope.Items[0].Payload as JsonSerializable)?.Source as SentryTransaction; actual?.Name.Should().Be(original.Name); actual?.Operation.Should().Be(original.Operation); actual?.Description.Should().Be(original.Description.RedactUrl()); // Should be redacted @@ -1016,7 +1016,7 @@ public void CaptureTransaction_BeforeSendTransaction_RejectEvent() var sut = _fixture.GetSut(); sut.CaptureTransaction( - new Transaction("test name", "test operation") + new SentryTransaction("test name", "test operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1029,7 +1029,7 @@ public void CaptureTransaction_BeforeSendTransaction_RejectEvent() public void CaptureTransaction_ScopeContainsAttachments_GetAppliedToHint() { // Arrange - var transaction = new Transaction("name", "operation") + var transaction = new SentryTransaction("name", "operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1061,10 +1061,10 @@ public void CaptureTransaction_AddedTransactionProcessor_ReceivesHint() { // Arrange var processor = Substitute.For(); - processor.Process(Arg.Any(), Arg.Any()).Returns(new Transaction("name", "operation")); + processor.Process(Arg.Any(), Arg.Any()).Returns(new SentryTransaction("name", "operation")); _fixture.SentryOptions.AddTransactionProcessor(processor); - var transaction = new Transaction("name", "operation") + var transaction = new SentryTransaction("name", "operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1074,14 +1074,14 @@ public void CaptureTransaction_AddedTransactionProcessor_ReceivesHint() _fixture.GetSut().CaptureTransaction(transaction); // Assert - processor.Received(1).Process(Arg.Any(), Arg.Any()); + processor.Received(1).Process(Arg.Any(), Arg.Any()); } [Fact] public void CaptureTransaction_TransactionProcessor_ReceivesScopeAttachments() { // Arrange - var transaction = new Transaction("name", "operation") + var transaction = new SentryTransaction("name", "operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1090,9 +1090,9 @@ public void CaptureTransaction_TransactionProcessor_ReceivesScopeAttachments() var processor = Substitute.For(); Hint hint = null; processor.Process( - Arg.Any(), + Arg.Any(), Arg.Do(h => hint = h)) - .Returns(new Transaction("name", "operation")); + .Returns(new SentryTransaction("name", "operation")); _fixture.SentryOptions.AddTransactionProcessor(processor); var attachments = new List { AttachmentHelper.FakeAttachment("foo.txt") }; @@ -1118,7 +1118,7 @@ public void CaptureTransaction_BeforeSendTransaction_GetsHint() return tx; }); - var transaction = new Transaction("test name", "test operation") + var transaction = new SentryTransaction("test name", "test operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1134,10 +1134,10 @@ public void CaptureTransaction_BeforeSendTransaction_GetsHint() [Fact] public void CaptureTransaction_BeforeSendTransaction_ModifyEvent() { - Transaction received = null; + SentryTransaction received = null; _fixture.SentryOptions.SetBeforeSendTransaction((tx, _) => received = tx); - var transaction = new Transaction("test name", "test operation") + var transaction = new SentryTransaction("test name", "test operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1152,10 +1152,10 @@ public void CaptureTransaction_BeforeSendTransaction_ModifyEvent() [Fact] public void CaptureTransaction_BeforeSendTransaction_replaced_transaction_captured() { - Transaction received = null; + SentryTransaction received = null; _fixture.SentryOptions.SetBeforeSendTransaction((_, _) => { - received = new Transaction("name2", "operation2") + received = new SentryTransaction("name2", "operation2") { IsSampled = true, EndTimestamp = DateTimeOffset.Now, @@ -1165,7 +1165,7 @@ public void CaptureTransaction_BeforeSendTransaction_replaced_transaction_captur return received; }); - var transaction = new Transaction("name", "operation") + var transaction = new SentryTransaction("name", "operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1179,7 +1179,7 @@ public void CaptureTransaction_BeforeSendTransaction_replaced_transaction_captur Assert.NotSame(transaction, received); - var capturedEnvelopedTransaction = captured.Items[0].Payload.As().Source.As(); + var capturedEnvelopedTransaction = captured.Items[0].Payload.As().Source.As(); Assert.Same(received.Description, capturedEnvelopedTransaction.Description); } @@ -1188,10 +1188,10 @@ public void CaptureTransaction_BeforeSendTransaction_SamplingNull_DropsEvent() { _fixture.SentryOptions.SampleRate = null; - Transaction received = null; + SentryTransaction received = null; _fixture.SentryOptions.SetBeforeSendTransaction((e, _) => received = e); - var transaction = new Transaction("test name", "test operation") + var transaction = new SentryTransaction("test name", "test operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished @@ -1210,7 +1210,7 @@ public void CaptureTransaction_BeforeSendTransaction_RejectEvent_RecordsDiscard( _fixture.SentryOptions.SetBeforeSendTransaction((_, _) => null); var sut = _fixture.GetSut(); - sut.CaptureTransaction( new Transaction("test name", "test operation") + sut.CaptureTransaction( new SentryTransaction("test name", "test operation") { IsSampled = true, EndTimestamp = DateTimeOffset.Now // finished diff --git a/test/Sentry.Tests/SentryClientTests.verify.cs b/test/Sentry.Tests/SentryClientTests.verify.cs index 47c3d0a2bb..e98900dc44 100644 --- a/test/Sentry.Tests/SentryClientTests.verify.cs +++ b/test/Sentry.Tests/SentryClientTests.verify.cs @@ -23,7 +23,7 @@ public Task CaptureTransaction_BeforeSendTransactionThrows_ErrorToEventBreadcrum var error = new Exception("Exception message!"); _fixture.SentryOptions.SetBeforeSendTransaction((_, _) => throw error); - var transaction = new Transaction("name", "operation") + var transaction = new SentryTransaction("name", "operation") { IsSampled = true }; diff --git a/test/Sentry.Tests/TransactionProcessorTests.cs b/test/Sentry.Tests/TransactionProcessorTests.cs index 044beba7bb..e8d6f5cc13 100644 --- a/test/Sentry.Tests/TransactionProcessorTests.cs +++ b/test/Sentry.Tests/TransactionProcessorTests.cs @@ -16,7 +16,7 @@ public void SampledOut() var options = Options(transport); var processor = new TrackingProcessor(); options.AddTransactionProcessor(processor); - var transaction = new Transaction("name", "operation") + var transaction = new SentryTransaction("name", "operation") { IsSampled = false }; @@ -29,7 +29,7 @@ public void SampledOut() public class TheProcessor : ISentryTransactionProcessor { - public Transaction Process(Transaction transaction) + public SentryTransaction Process(SentryTransaction transaction) { transaction.Contexts["key"] = "value"; return transaction; @@ -40,7 +40,7 @@ public class TrackingProcessor : ISentryTransactionProcessor { public bool Called { get; private set; } - public Transaction Process(Transaction transaction) + public SentryTransaction Process(SentryTransaction transaction) { Called = true; return transaction; @@ -49,7 +49,7 @@ public Transaction Process(Transaction transaction) public class DiscardProcessor : ISentryTransactionProcessor { - public Transaction Process(Transaction transaction) => + public SentryTransaction Process(SentryTransaction transaction) => null; }