diff --git a/CHANGELOG.md b/CHANGELOG.md index fd42ecb4ee..4cdcdbe99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ API Changes: - Reordered parameters for ther TransactionContext and SpanContext constructors. If you're constructing instances of these classes, you will need to adjust the order in which you pass parameters to these. ([#2696](https://github.com/getsentry/sentry-dotnet/pull/2696)) - The `DiagnosticLogger` signature for `LogError` and `LogFatal` changed to take the `exception` as the first parameter. That way it does no longer get mixed up with the TArgs. The `DiagnosticLogger` now also received an overload for `LogError` and `LogFatal` that accepts a message only. ([#2715](https://github.com/getsentry/sentry-dotnet/pull/2715)) - Integrate `sentry-native` as a static library in Native AOT builds to enable symbolication. ([2704](https://github.com/getsentry/sentry-dotnet/pull/2704)) +- `ISpan` and `ITransaction` have been renamed to `ISpanTracer` and `ITransactionTracer`. You will need to update any references to these interfaces in your code to use the new interface names ([#2731](https://github.com/getsentry/sentry-dotnet/pull/2731)) ## Unreleased diff --git a/benchmarks/Sentry.Benchmarks/StackFrameBenchmarks.cs b/benchmarks/Sentry.Benchmarks/StackFrameBenchmarks.cs index 840ac42b99..6797013c45 100644 --- a/benchmarks/Sentry.Benchmarks/StackFrameBenchmarks.cs +++ b/benchmarks/Sentry.Benchmarks/StackFrameBenchmarks.cs @@ -145,7 +145,7 @@ public void ConfigureAppFrame() Module ="Sentry.Extensions.Profiling" }, new SentryStackFrame() { - Function ="SamplingTransactionProfiler.Start(class Sentry.ITransaction) {QuickJitted}", + Function ="SamplingTransactionProfiler.Start(class Sentry.ITransactionTracer) {QuickJitted}", Module ="Sentry.Extensions.Profiling" }, new SentryStackFrame() { diff --git a/src/Sentry.AspNet/HttpContextExtensions.cs b/src/Sentry.AspNet/HttpContextExtensions.cs index c3e642cffd..aa266ba2b5 100644 --- a/src/Sentry.AspNet/HttpContextExtensions.cs +++ b/src/Sentry.AspNet/HttpContextExtensions.cs @@ -77,7 +77,7 @@ public static void StartOrContinueTrace(this HttpContext httpContext) /// /// Starts a new Sentry transaction that encompasses the currently executing HTTP request. /// - public static ITransaction StartSentryTransaction(this HttpContext httpContext) + public static ITransactionTracer StartSentryTransaction(this HttpContext httpContext) { var method = httpContext.Request.HttpMethod; var path = httpContext.Request.Path; @@ -136,7 +136,7 @@ public static void FinishSentryTransaction(this HttpContext httpContext) return; } - if (httpContext.Items[HttpContextTransactionItemName] is not ISpan transaction) + if (httpContext.Items[HttpContextTransactionItemName] is not ISpanTracer transaction) { return; } diff --git a/src/Sentry.AspNetCore/SentryTracingMiddleware.cs b/src/Sentry.AspNetCore/SentryTracingMiddleware.cs index be5a15bdcc..7cefd8af55 100644 --- a/src/Sentry.AspNetCore/SentryTracingMiddleware.cs +++ b/src/Sentry.AspNetCore/SentryTracingMiddleware.cs @@ -27,7 +27,7 @@ public SentryTracingMiddleware( _options = options.Value; } - private ITransaction? TryStartTransaction(HttpContext context) + private ITransactionTracer? TryStartTransaction(HttpContext context) { if (context.Request.Method == HttpMethod.Options.Method) { diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFCommandDiagnosticSourceHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFCommandDiagnosticSourceHelper.cs index 1d600b7365..e807cfda7a 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFCommandDiagnosticSourceHelper.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFCommandDiagnosticSourceHelper.cs @@ -15,16 +15,16 @@ internal EFCommandDiagnosticSourceHelper(IHub hub, SentryOptions options) : base private static Guid? GetCommandId(object? diagnosticSourceValue) => diagnosticSourceValue?.GetGuidProperty("CommandId"); - private static void SetCommandId(ISpan span, Guid? commandId) + private static void SetCommandId(ISpanTracer span, Guid? commandId) { Debug.Assert(commandId != Guid.Empty); span.SetExtra(EFKeys.DbCommandId, commandId); } - private static Guid? TryGetCommandId(ISpan span) => span.Extra.TryGetValue(EFKeys.DbCommandId); + private static Guid? TryGetCommandId(ISpanTracer span) => span.Extra.TryGetValue(EFKeys.DbCommandId); - protected override ISpan? GetSpanReference(ITransaction transaction, object? diagnosticSourceValue) + protected override ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) { if (GetCommandId(diagnosticSourceValue) is { } commandId) { @@ -38,7 +38,7 @@ private static void SetCommandId(ISpan span, Guid? commandId) return null; } - protected override void SetSpanReference(ISpan span, object? diagnosticSourceValue) + protected override void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue) { if (GetCommandId(diagnosticSourceValue) is { } commandId) { diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFConnectionDiagnosticSourceHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFConnectionDiagnosticSourceHelper.cs index 61bff526d9..822f94c066 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFConnectionDiagnosticSourceHelper.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFConnectionDiagnosticSourceHelper.cs @@ -13,7 +13,7 @@ internal EFConnectionDiagnosticSourceHelper(IHub hub, SentryOptions options) : b protected override string? GetDescription(object? diagnosticSourceValue) => GetDatabaseName(diagnosticSourceValue); - protected override ISpan? GetSpanReference(ITransaction transaction, object? diagnosticSourceValue) + protected override ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) { if (GetConnectionId(diagnosticSourceValue) is { } connectionId) { @@ -27,7 +27,7 @@ internal EFConnectionDiagnosticSourceHelper(IHub hub, SentryOptions options) : b return null; } - protected override void SetSpanReference(ISpan span, object? diagnosticSourceValue) + protected override void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue) { if (GetConnectionId(diagnosticSourceValue) is { } connectionId) { diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFDiagnosticSourceHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFDiagnosticSourceHelper.cs index 48dcfc2eef..e283ae1c35 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFDiagnosticSourceHelper.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFDiagnosticSourceHelper.cs @@ -6,7 +6,7 @@ namespace Sentry.Internal.DiagnosticSource; internal abstract class EFDiagnosticSourceHelper { protected SentryOptions Options { get; } - protected ITransaction? Transaction { get; } + protected ITransactionTracer? Transaction { get; } protected abstract string Operation { get; } protected abstract string? GetDescription(object? diagnosticSourceValue); @@ -39,11 +39,11 @@ internal EFDiagnosticSourceHelper(IHub hub, SentryOptions options) Transaction = hub.GetTransactionIfSampled(); } - protected static Guid? TryGetConnectionId(ISpan span) => span.Extra.TryGetValue(EFKeys.DbConnectionId); + protected static Guid? TryGetConnectionId(ISpanTracer span) => span.Extra.TryGetValue(EFKeys.DbConnectionId); protected static Guid? GetConnectionId(object? diagnosticSourceValue) => diagnosticSourceValue?.GetGuidProperty("ConnectionId"); - protected static void SetConnectionId(ISpan span, Guid? connectionId) + protected static void SetConnectionId(ISpanTracer span, Guid? connectionId) { Debug.Assert(connectionId != Guid.Empty); @@ -89,7 +89,7 @@ internal void FinishSpan(object? diagnosticSourceValue, SpanStatus status) sourceSpan.Finish(status); } - protected void SetDbData(ISpan span, object? diagnosticSourceValue) + protected void SetDbData(ISpanTracer span, object? diagnosticSourceValue) { if (GetDatabaseName(diagnosticSourceValue) is { } dataBaseName) { @@ -140,7 +140,7 @@ protected void LogTransactionSpans() return str?[(str.IndexOf('\n') + 1)..]; } - protected abstract ISpan? GetSpanReference(ITransaction transaction, object? diagnosticSourceValue); + protected abstract ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue); - protected abstract void SetSpanReference(ISpan span, object? diagnosticSourceValue); + protected abstract void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue); } diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFQueryCompilerDiagnosticSourceHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFQueryCompilerDiagnosticSourceHelper.cs index c056ab0da0..78f71bcbf1 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFQueryCompilerDiagnosticSourceHelper.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFQueryCompilerDiagnosticSourceHelper.cs @@ -13,10 +13,10 @@ internal EFQueryCompilerDiagnosticSourceHelper(IHub hub, SentryOptions options) /// /// We don't have a correlation id for compiled query events. We just return the first unfinished query compile span. /// - protected override ISpan? GetSpanReference(ITransaction transaction, object? diagnosticSourceValue) => + protected override ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) => transaction.Spans .FirstOrDefault(span => !span.IsFinished && span.Operation == Operation); - protected override void SetSpanReference(ISpan span, object? diagnosticSourceValue) + protected override void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue) { // We don't have a correlation id for compiled query events. } diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/SentrySqlListener.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/SentrySqlListener.cs index d2e0acf5fe..76d381deae 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/SentrySqlListener.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/SentrySqlListener.cs @@ -38,37 +38,37 @@ public SentrySqlListener(IHub hub, SentryOptions options) _options = options; } - private static void SetDatabaseName(ISpan span, string databaseName) + private static void SetDatabaseName(ISpanTracer span, string databaseName) { Debug.Assert(databaseName != string.Empty); span.SetExtra(OTelKeys.DbName, databaseName); } - private static void SetDatabaseAddress(ISpan span, string databaseAddress) + private static void SetDatabaseAddress(ISpanTracer span, string databaseAddress) { Debug.Assert(databaseAddress != string.Empty); span.SetExtra(OTelKeys.DbServer, databaseAddress); } - private static void SetConnectionId(ISpan span, Guid? connectionId) + private static void SetConnectionId(ISpanTracer span, Guid? connectionId) { Debug.Assert(connectionId != Guid.Empty); span.SetExtra(SqlKeys.DbConnectionId, connectionId); } - private static void SetOperationId(ISpan span, Guid? operationId) + private static void SetOperationId(ISpanTracer span, Guid? operationId) { Debug.Assert(operationId != Guid.Empty); span.SetExtra(SqlKeys.DbOperationId, operationId); } - private static Guid? TryGetOperationId(ISpan span) => span.Extra.TryGetValue(SqlKeys.DbOperationId); + private static Guid? TryGetOperationId(ISpanTracer span) => span.Extra.TryGetValue(SqlKeys.DbOperationId); - private static Guid? TryGetConnectionId(ISpan span) => span.Extra.TryGetValue(SqlKeys.DbConnectionId); + private static Guid? TryGetConnectionId(ISpanTracer span) => span.Extra.TryGetValue(SqlKeys.DbConnectionId); private void AddSpan(string operation, object? value) { @@ -85,7 +85,7 @@ private void AddSpan(string operation, object? value) SetConnectionId(span, value?.GetGuidProperty("ConnectionId")); } - private ISpan? GetSpan(SentrySqlSpanType type, object? value) + private ISpanTracer? GetSpan(SentrySqlSpanType type, object? value) { var transaction = _hub.GetTransactionIfSampled(); if (transaction == null) @@ -124,7 +124,7 @@ private void AddSpan(string operation, object? value) } } - private static ISpan? TryGetConnectionSpan(ITransaction transaction, Guid? connectionId) => + private static ISpanTracer? TryGetConnectionSpan(ITransactionTracer transaction, Guid? connectionId) => connectionId == null ? null : transaction.Spans @@ -132,7 +132,7 @@ private void AddSpan(string operation, object? value) span is {IsFinished: false, Operation: "db.connection"} && TryGetConnectionId(span) == connectionId); - private static ISpan? TryGetQuerySpan(ITransaction transaction, Guid? operationId) => + private static ISpanTracer? TryGetQuerySpan(ITransactionTracer transaction, Guid? operationId) => operationId == null ? null : transaction.Spans.FirstOrDefault(span => TryGetOperationId(span) == operationId); @@ -248,7 +248,7 @@ when GetSpan(SentrySqlSpanType.Connection, kvp.Value) is { } closeSpan: } } - private static void TrySetConnectionStatistics(ISpan span, object? value) + private static void TrySetConnectionStatistics(ISpanTracer span, object? value) { if (value?.GetProperty("Statistics") is not Dictionary statistics) { diff --git a/src/Sentry.EntityFramework/DbCommandInterceptionContextExtensions.cs b/src/Sentry.EntityFramework/DbCommandInterceptionContextExtensions.cs index 8c4975535e..8106789bac 100644 --- a/src/Sentry.EntityFramework/DbCommandInterceptionContextExtensions.cs +++ b/src/Sentry.EntityFramework/DbCommandInterceptionContextExtensions.cs @@ -2,9 +2,9 @@ namespace Sentry.EntityFramework; internal static class DbCommandInterceptionContextExtensions { - internal static ISpan? GetSpanFromContext(this DbCommandInterceptionContext interceptionContext) - => interceptionContext.FindUserState(SentryQueryPerformanceListener.SentryUserStateKey) as ISpan; + internal static ISpanTracer? GetSpanFromContext(this DbCommandInterceptionContext interceptionContext) + => interceptionContext.FindUserState(SentryQueryPerformanceListener.SentryUserStateKey) as ISpanTracer; - internal static void AttachSpan(this DbCommandInterceptionContext interceptionContext, ISpan span) + internal static void AttachSpan(this DbCommandInterceptionContext interceptionContext, ISpanTracer span) => interceptionContext.SetUserState(SentryQueryPerformanceListener.SentryUserStateKey, span); } diff --git a/src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs b/src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs index dd0fb833a5..934811857d 100644 --- a/src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs +++ b/src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs @@ -6,7 +6,7 @@ internal class AspNetCoreEnricher : IOpenTelemetryEnricher internal AspNetCoreEnricher(ISentryUserFactory userFactory) => _userFactory = userFactory; - public void Enrich(ISpan span, Activity activity, IHub hub, SentryOptions? options) + public void Enrich(ISpanTracer span, Activity activity, IHub hub, SentryOptions? options) { if (options?.SendDefaultPii is true) { diff --git a/src/Sentry.OpenTelemetry/IOpenTelemetryEnricher.cs b/src/Sentry.OpenTelemetry/IOpenTelemetryEnricher.cs index 2fa72949f0..4452c8db7e 100644 --- a/src/Sentry.OpenTelemetry/IOpenTelemetryEnricher.cs +++ b/src/Sentry.OpenTelemetry/IOpenTelemetryEnricher.cs @@ -2,5 +2,5 @@ namespace Sentry.OpenTelemetry; internal interface IOpenTelemetryEnricher { - void Enrich(ISpan span, Activity activity, IHub hub, SentryOptions? options); + void Enrich(ISpanTracer span, Activity activity, IHub hub, SentryOptions? options); } diff --git a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs index 2dbabe1210..8b54ebe64f 100644 --- a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs +++ b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs @@ -15,7 +15,7 @@ public class SentrySpanProcessor : BaseProcessor private readonly IEnumerable _enrichers; // ReSharper disable once MemberCanBePrivate.Global - Used by tests - internal readonly ConcurrentDictionary _map = new(); + internal readonly ConcurrentDictionary _map = new(); private readonly SentryOptions? _options; private readonly Lazy> _resourceAttributes; diff --git a/src/Sentry.Profiling/SamplingTransactionProfilerFactory.cs b/src/Sentry.Profiling/SamplingTransactionProfilerFactory.cs index b00faa543e..569b19b29f 100644 --- a/src/Sentry.Profiling/SamplingTransactionProfilerFactory.cs +++ b/src/Sentry.Profiling/SamplingTransactionProfilerFactory.cs @@ -36,7 +36,7 @@ private SamplingTransactionProfilerFactory(SentryOptions options, SampleProfiler } /// - public ITransactionProfiler? Start(ITransaction _, CancellationToken cancellationToken) + public ITransactionProfiler? Start(ITransactionTracer _, CancellationToken cancellationToken) { // Start a profiler if one wasn't running yet. if (Interlocked.Exchange(ref _inProgress, TRUE) == FALSE) diff --git a/src/Sentry/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs index 6d7d5c1339..69695cdda7 100644 --- a/src/Sentry/Extensibility/DisabledHub.cs +++ b/src/Sentry/Extensibility/DisabledHub.cs @@ -51,7 +51,7 @@ public void WithScope(Action scopeCallback) /// /// Returns a dummy transaction. /// - public ITransaction StartTransaction( + public ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext) => // Transactions from DisabledHub are always sampled out @@ -60,14 +60,14 @@ public ITransaction StartTransaction( /// /// No-Op. /// - public void BindException(Exception exception, ISpan span) + public void BindException(Exception exception, ISpanTracer span) { } /// /// Returns null. /// - public ISpan? GetSpan() => null; + public ISpanTracer? GetSpan() => null; /// /// Returns null. diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index 0869c7bdda..c842f14122 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -72,7 +72,7 @@ public void WithScope(Action scopeCallback) /// Forwards the call to . /// [DebuggerStepThrough] - public ITransaction StartTransaction( + public ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext) => SentrySdk.StartTransaction(context, customSamplingContext); @@ -81,7 +81,7 @@ public ITransaction StartTransaction( /// Forwards the call to . /// [DebuggerStepThrough] - internal ITransaction StartTransaction( + internal ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext, DynamicSamplingContext? dynamicSamplingContext) @@ -91,14 +91,14 @@ internal ITransaction StartTransaction( /// Forwards the call to . /// [DebuggerStepThrough] - public void BindException(Exception exception, ISpan span) => + public void BindException(Exception exception, ISpanTracer span) => SentrySdk.BindException(exception, span); /// /// Forwards the call to . /// [DebuggerStepThrough] - public ISpan? GetSpan() + public ISpanTracer? GetSpan() => SentrySdk.GetSpan(); /// diff --git a/src/Sentry/HubExtensions.cs b/src/Sentry/HubExtensions.cs index 7364544d93..94e6a8c7ba 100644 --- a/src/Sentry/HubExtensions.cs +++ b/src/Sentry/HubExtensions.cs @@ -14,13 +14,13 @@ public static class HubExtensions /// /// Starts a transaction. /// - public static ITransaction StartTransaction(this IHub hub, ITransactionContext context) => + public static ITransactionTracer StartTransaction(this IHub hub, ITransactionContext context) => hub.StartTransaction(context, new Dictionary()); /// /// Starts a transaction. /// - public static ITransaction StartTransaction( + public static ITransactionTracer StartTransaction( this IHub hub, string name, string operation) => @@ -29,7 +29,7 @@ public static ITransaction StartTransaction( /// /// Starts a transaction. /// - public static ITransaction StartTransaction( + public static ITransactionTracer StartTransaction( this IHub hub, string name, string operation, @@ -44,7 +44,7 @@ public static ITransaction StartTransaction( /// /// Starts a transaction from the specified trace header. /// - public static ITransaction StartTransaction( + public static ITransactionTracer StartTransaction( this IHub hub, string name, string operation, @@ -224,7 +224,7 @@ public static SentryId CaptureMessage(this IHub hub, string message, Action customSamplingContext, @@ -235,14 +235,14 @@ internal static ITransaction StartTransaction( _ => hub.StartTransaction(context, customSamplingContext) }; - internal static ITransaction? GetTransaction(this IHub hub) + internal static ITransactionTracer? GetTransaction(this IHub hub) { - ITransaction? transaction = null; + ITransactionTracer? transaction = null; hub.ConfigureScope(scope => transaction = scope.Transaction); return transaction; } - internal static ITransaction? GetTransactionIfSampled(this IHub hub) + internal static ITransactionTracer? GetTransactionIfSampled(this IHub hub) { var transaction = hub.GetTransaction(); return transaction?.IsSampled == true ? transaction : null; diff --git a/src/Sentry/IHub.cs b/src/Sentry/IHub.cs index f2c20b1aee..cb484bae83 100644 --- a/src/Sentry/IHub.cs +++ b/src/Sentry/IHub.cs @@ -22,7 +22,7 @@ public interface IHub : /// /// Starts a transaction. /// - ITransaction StartTransaction( + ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext); @@ -32,12 +32,12 @@ ITransaction StartTransaction( /// /// This method is used internally and is not meant for public use. /// - void BindException(Exception exception, ISpan span); + void BindException(Exception exception, ISpanTracer span); /// /// Gets the currently ongoing (not finished) span or null if none available. /// - ISpan? GetSpan(); + ISpanTracer? GetSpan(); /// /// Gets the Sentry trace header that allows tracing across services diff --git a/src/Sentry/ISentryClient.cs b/src/Sentry/ISentryClient.cs index 01971d9790..58a27ff30b 100644 --- a/src/Sentry/ISentryClient.cs +++ b/src/Sentry/ISentryClient.cs @@ -38,7 +38,7 @@ public interface ISentryClient /// /// /// Note: this method is NOT meant to be called from user code! - /// Instead, call on the transaction. + /// Instead, call on the transaction. /// /// The transaction. [EditorBrowsable(EditorBrowsableState.Never)] @@ -49,7 +49,7 @@ public interface ISentryClient /// /// /// Note: this method is NOT meant to be called from user code! - /// Instead, call on the transaction. + /// Instead, call on the transaction. /// /// The transaction. /// diff --git a/src/Sentry/ISpan.cs b/src/Sentry/ISpanTracer.cs similarity index 82% rename from src/Sentry/ISpan.cs rename to src/Sentry/ISpanTracer.cs index 38a31b7eb3..bd8a8834c3 100644 --- a/src/Sentry/ISpan.cs +++ b/src/Sentry/ISpanTracer.cs @@ -3,9 +3,9 @@ namespace Sentry; /// -/// Span. +/// SpanTracer interface /// -public interface ISpan : ISpanData +public interface ISpanTracer : ISpanData { /// /// Span description. @@ -28,7 +28,7 @@ public interface ISpan : ISpanData /// /// Starts a child span. /// - ISpan StartChild(string operation); + ISpanTracer StartChild(string operation); /// /// Finishes the span. @@ -52,7 +52,7 @@ public interface ISpan : ISpanData } /// -/// Extensions for . +/// Extensions for . /// [EditorBrowsable(EditorBrowsableState.Never)] public static class SpanExtensions @@ -60,7 +60,7 @@ public static class SpanExtensions /// /// Starts a child span. /// - public static ISpan StartChild(this ISpan span, string operation, string? description) + public static ISpanTracer StartChild(this ISpanTracer span, string operation, string? description) { var child = span.StartChild(operation); child.Description = description; @@ -68,7 +68,7 @@ public static ISpan StartChild(this ISpan span, string operation, string? descri return child; } - internal static ISpan StartChild(this ISpan span, SpanContext context) + internal static ISpanTracer StartChild(this ISpanTracer span, SpanContext context) { var transaction = span.GetTransaction() as TransactionTracer; if (transaction?.StartChild(context.SpanId, span.SpanId, context.Operation, context.Instrumenter) @@ -84,10 +84,10 @@ internal static ISpan StartChild(this ISpan span, SpanContext context) /// /// Gets the transaction that this span belongs to. /// - public static ITransaction GetTransaction(this ISpan span) => + public static ITransactionTracer GetTransaction(this ISpanTracer span) => span switch { - ITransaction transaction => transaction, + ITransactionTracer transaction => transaction, SpanTracer tracer => tracer.Transaction, _ => throw new ArgumentOutOfRangeException(nameof(span), span, null) }; @@ -99,7 +99,7 @@ public static ITransaction GetTransaction(this ISpan span) => /// /// Used by EF, EF Core, and SQLClient integrations. /// - internal static ISpan GetDbParentSpan(this ISpan span) + internal static ISpanTracer GetDbParentSpan(this ISpanTracer span) { var transaction = span.GetTransaction(); return transaction.Spans diff --git a/src/Sentry/ITransaction.cs b/src/Sentry/ITransactionTracer.cs similarity index 75% rename from src/Sentry/ITransaction.cs rename to src/Sentry/ITransactionTracer.cs index ad21ad325d..ec85bc7316 100644 --- a/src/Sentry/ITransaction.cs +++ b/src/Sentry/ITransactionTracer.cs @@ -1,9 +1,9 @@ namespace Sentry; /// -/// Transaction. +/// TransactionTracer interface /// -public interface ITransaction : ITransactionData, ISpan +public interface ITransactionTracer : ITransactionData, ISpanTracer { /// /// Transaction name. @@ -20,10 +20,10 @@ public interface ITransaction : ITransactionData, ISpan /// /// Flat list of spans within this transaction. /// - IReadOnlyCollection Spans { get; } + IReadOnlyCollection Spans { get; } /// /// Gets the last active (not finished) span in this transaction. /// - ISpan? GetLastActiveSpan(); + ISpanTracer? GetLastActiveSpan(); } diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index 94419a2c2a..cf26404eed 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -19,7 +19,7 @@ internal class Hub : IHubEx, IDisposable private int _isPersistedSessionRecovered; // Internal for testability - internal ConditionalWeakTable ExceptionToSpanMap { get; } = new(); + internal ConditionalWeakTable ExceptionToSpanMap { get; } = new(); internal IInternalScopeManager ScopeManager { get; } @@ -114,12 +114,12 @@ public async Task ConfigureScopeAsync(Func configureScope) public void BindClient(ISentryClient client) => ScopeManager.BindClient(client); - public ITransaction StartTransaction( + public ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext) => StartTransaction(context, customSamplingContext, null); - internal ITransaction StartTransaction( + internal ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext, DynamicSamplingContext? dynamicSamplingContext) @@ -188,7 +188,7 @@ internal ITransaction StartTransaction( return transaction; } - public void BindException(Exception exception, ISpan span) + public void BindException(Exception exception, ISpanTracer span) { // Don't bind on sampled out spans if (span.IsSampled == false) @@ -200,7 +200,7 @@ public void BindException(Exception exception, ISpan span) _ = ExceptionToSpanMap.GetValue(exception, _ => span); } - public ISpan? GetSpan() => ScopeManager.GetCurrent().Key.Span; + public ISpanTracer? GetSpan() => ScopeManager.GetCurrent().Key.Span; public SentryTraceHeader GetTraceHeader() { @@ -350,7 +350,7 @@ private void EndSession(DateTimeOffset timestamp, SessionEndStatus status) public void EndSession(SessionEndStatus status = SessionEndStatus.Exited) => EndSession(_clock.GetUtcNow(), status); - private ISpan? GetLinkedSpan(SentryEvent evt) + private ISpanTracer? GetLinkedSpan(SentryEvent evt) { // Find the span which is bound to the same exception if (evt.Exception is { } exception && @@ -362,7 +362,7 @@ public void EndSession(SessionEndStatus status = SessionEndStatus.Exited) => return null; } - private void ApplyTraceContextToEvent(SentryEvent evt, ISpan span) + private void ApplyTraceContextToEvent(SentryEvent evt, ISpanTracer span) { evt.Contexts.Trace.SpanId = span.SpanId; evt.Contexts.Trace.TraceId = span.TraceId; diff --git a/src/Sentry/Internal/ITransactionProfiler.cs b/src/Sentry/Internal/ITransactionProfiler.cs index 27cb3ae6fb..71b8280654 100644 --- a/src/Sentry/Internal/ITransactionProfiler.cs +++ b/src/Sentry/Internal/ITransactionProfiler.cs @@ -10,7 +10,7 @@ internal interface ITransactionProfilerFactory /// /// Called during transaction start to start a new profiler, if applicable. /// - ITransactionProfiler? Start(ITransaction transaction, CancellationToken cancellationToken); + ITransactionProfiler? Start(ITransactionTracer transaction, CancellationToken cancellationToken); } /// diff --git a/src/Sentry/Internal/NoOpSpan.cs b/src/Sentry/Internal/NoOpSpan.cs index d5f9ffb505..9b6d75c496 100644 --- a/src/Sentry/Internal/NoOpSpan.cs +++ b/src/Sentry/Internal/NoOpSpan.cs @@ -5,9 +5,9 @@ namespace Sentry.Internal; /// /// Span class to use when we can't return null but a request to create a span couldn't be completed. /// -internal class NoOpSpan : ISpan +internal class NoOpSpan : ISpanTracer { - public static ISpan Instance { get; } = new NoOpSpan(); + public static ISpanTracer Instance { get; } = new NoOpSpan(); protected NoOpSpan() { @@ -41,7 +41,7 @@ public SpanStatus? Status set { } } - public ISpan StartChild(string operation) => this; + public ISpanTracer StartChild(string operation) => this; public void Finish() { diff --git a/src/Sentry/Internal/NoOpTransaction.cs b/src/Sentry/Internal/NoOpTransaction.cs index 5cdefbee8e..d2f9e1c736 100644 --- a/src/Sentry/Internal/NoOpTransaction.cs +++ b/src/Sentry/Internal/NoOpTransaction.cs @@ -5,9 +5,9 @@ namespace Sentry.Internal; /// /// Transaction class to use when we can't return null but a request to create a transaction couldn't be completed. /// -internal class NoOpTransaction : NoOpSpan, ITransaction +internal class NoOpTransaction : NoOpSpan, ITransactionTracer { - public new static ITransaction Instance { get; } = new NoOpTransaction(); + public new static ITransactionTracer Instance { get; } = new NoOpTransaction(); private NoOpTransaction() { @@ -87,11 +87,11 @@ public IReadOnlyList Fingerprint set { } } - public IReadOnlyCollection Spans => ImmutableList.Empty; + public IReadOnlyCollection Spans => ImmutableList.Empty; public IReadOnlyCollection Breadcrumbs => ImmutableList.Empty; - public ISpan? GetLastActiveSpan() => default; + public ISpanTracer? GetLastActiveSpan() => default; public void AddBreadcrumb(Breadcrumb breadcrumb) { } } diff --git a/src/Sentry/Scope.cs b/src/Sentry/Scope.cs index 10401a167e..f504fd41c7 100644 --- a/src/Sentry/Scope.cs +++ b/src/Sentry/Scope.cs @@ -179,12 +179,12 @@ public string? TransactionName } } - private ITransaction? _transaction; + private ITransactionTracer? _transaction; /// /// Transaction. /// - public ITransaction? Transaction + public ITransactionTracer? Transaction { get => _transaction; set => _transaction = value; @@ -540,9 +540,9 @@ internal void Evaluate() /// Obsolete. Use the property instead. /// [Obsolete("Use the Span property instead. This method will be removed in a future release.")] - public ISpan? GetSpan() => Span; + public ISpanTracer? GetSpan() => Span; - private ISpan? _span; + private ISpanTracer? _span; /// /// Gets or sets the active span, or null if none available. @@ -552,7 +552,7 @@ internal void Evaluate() /// Otherwise, the active span is the latest unfinished span on the transaction, presuming a transaction /// was set on the scope via the property. /// - public ISpan? Span + public ISpanTracer? Span { get { @@ -566,6 +566,6 @@ public ISpan? Span set => _span = value; } - internal void ResetTransaction(ITransaction? expectedCurrentTransaction) => + internal void ResetTransaction(ITransactionTracer? expectedCurrentTransaction) => Interlocked.CompareExchange(ref _transaction, null, expectedCurrentTransaction); } diff --git a/src/Sentry/ScopeExtensions.cs b/src/Sentry/ScopeExtensions.cs index e36b2b240b..6d31e610c5 100644 --- a/src/Sentry/ScopeExtensions.cs +++ b/src/Sentry/ScopeExtensions.cs @@ -209,6 +209,6 @@ public static void AddAttachment( /// /// The scope. /// The last span not finished or null. - internal static ISpan? LastCreatedSpan(this Scope scope) + internal static ISpanTracer? LastCreatedSpan(this Scope scope) => scope.Transaction?.Spans.LastOrDefault(s => !s.IsFinished); } diff --git a/src/Sentry/SentryGraphQLHttpMessageHandler.cs b/src/Sentry/SentryGraphQLHttpMessageHandler.cs index 9da269d8b5..9e1546a852 100644 --- a/src/Sentry/SentryGraphQLHttpMessageHandler.cs +++ b/src/Sentry/SentryGraphQLHttpMessageHandler.cs @@ -38,7 +38,7 @@ internal SentryGraphQLHttpMessageHandler(IHub? hub, SentryOptions? options, } /// - protected internal override ISpan? ProcessRequest(HttpRequestMessage request, string method, string url) + protected internal override ISpanTracer? ProcessRequest(HttpRequestMessage request, string method, string url) { var content = GraphQLContentExtractor.ExtractRequestContentAsync(request, _options).Result; if (content is not { } graphQlRequestContent) @@ -59,7 +59,7 @@ internal SentryGraphQLHttpMessageHandler(IHub? hub, SentryOptions? options, } /// - protected internal override void HandleResponse(HttpResponseMessage response, ISpan? span, string method, string url) + protected internal override void HandleResponse(HttpResponseMessage response, ISpanTracer? span, string method, string url) { var graphqlInfo = response.RequestMessage?.GetFused(); var breadcrumbData = new Dictionary diff --git a/src/Sentry/SentryHttpMessageHandler.cs b/src/Sentry/SentryHttpMessageHandler.cs index fa64feb5c7..dbabc0e791 100644 --- a/src/Sentry/SentryHttpMessageHandler.cs +++ b/src/Sentry/SentryHttpMessageHandler.cs @@ -61,7 +61,7 @@ internal SentryHttpMessageHandler(IHub? hub, SentryOptions? options, HttpMessage } /// - protected internal override ISpan? ProcessRequest(HttpRequestMessage request, string method, string url) + protected internal override ISpanTracer? ProcessRequest(HttpRequestMessage request, string method, string url) { // Start a span that tracks this request // (may be null if transaction is not set on the scope) @@ -74,7 +74,7 @@ internal SentryHttpMessageHandler(IHub? hub, SentryOptions? options, HttpMessage } /// - protected internal override void HandleResponse(HttpResponseMessage response, ISpan? span, string method, string url) + protected internal override void HandleResponse(HttpResponseMessage response, ISpanTracer? span, string method, string url) { var breadcrumbData = new Dictionary { diff --git a/src/Sentry/SentryMessageHandler.cs b/src/Sentry/SentryMessageHandler.cs index 8ebeaf77fb..77003c18af 100644 --- a/src/Sentry/SentryMessageHandler.cs +++ b/src/Sentry/SentryMessageHandler.cs @@ -64,17 +64,17 @@ internal SentryMessageHandler(IHub? hub, SentryOptions? options, HttpMessageHand /// The /// The request method (e.g. "GET") /// The request URL - /// An - protected internal abstract ISpan? ProcessRequest(HttpRequestMessage request, string method, string url); + /// An + protected internal abstract ISpanTracer? ProcessRequest(HttpRequestMessage request, string method, string url); /// /// Provides an opportunity for further processing of the span once a response is received. /// /// The - /// The created in + /// The created in /// The request method (e.g. "GET") /// The request URL - protected internal abstract void HandleResponse(HttpResponseMessage response, ISpan? span, string method, string url); + protected internal abstract void HandleResponse(HttpResponseMessage response, ISpanTracer? span, string method, string url); /// protected override async Task SendAsync( diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index f18703958a..980ce25231 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -528,7 +528,7 @@ public static void CaptureUserFeedback(SentryId eventId, string email, string co /// /// /// Note: this method is NOT meant to be called from user code! - /// Instead, call on the transaction. + /// Instead, call on the transaction. /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] @@ -540,7 +540,7 @@ public static void CaptureTransaction(Transaction transaction) /// /// /// Note: this method is NOT meant to be called from user code! - /// Instead, call on the transaction. + /// Instead, call on the transaction. /// [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] @@ -558,7 +558,7 @@ public static void CaptureSession(SessionUpdate sessionUpdate) /// Starts a transaction. /// [DebuggerStepThrough] - public static ITransaction StartTransaction( + public static ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext) => CurrentHub.StartTransaction(context, customSamplingContext); @@ -567,7 +567,7 @@ public static ITransaction StartTransaction( /// Starts a transaction. /// [DebuggerStepThrough] - internal static ITransaction StartTransaction( + internal static ITransactionTracer StartTransaction( ITransactionContext context, IReadOnlyDictionary customSamplingContext, DynamicSamplingContext? dynamicSamplingContext) @@ -577,28 +577,28 @@ internal static ITransaction StartTransaction( /// Starts a transaction. /// [DebuggerStepThrough] - public static ITransaction StartTransaction(ITransactionContext context) + public static ITransactionTracer StartTransaction(ITransactionContext context) => CurrentHub.StartTransaction(context); /// /// Starts a transaction. /// [DebuggerStepThrough] - public static ITransaction StartTransaction(string name, string operation) + public static ITransactionTracer StartTransaction(string name, string operation) => CurrentHub.StartTransaction(name, operation); /// /// Starts a transaction. /// [DebuggerStepThrough] - public static ITransaction StartTransaction(string name, string operation, string? description) + public static ITransactionTracer StartTransaction(string name, string operation, string? description) => CurrentHub.StartTransaction(name, operation, description); /// /// Starts a transaction. /// [DebuggerStepThrough] - public static ITransaction StartTransaction(string name, string operation, SentryTraceHeader traceHeader) + public static ITransactionTracer StartTransaction(string name, string operation, SentryTraceHeader traceHeader) => CurrentHub.StartTransaction(name, operation, traceHeader); /// @@ -608,14 +608,14 @@ public static ITransaction StartTransaction(string name, string operation, Sentr /// This method is used internally and is not meant for public use. /// [DebuggerStepThrough] - public static void BindException(Exception exception, ISpan span) + public static void BindException(Exception exception, ISpanTracer span) => CurrentHub.BindException(exception, span); /// /// Gets the last active span. /// [DebuggerStepThrough] - public static ISpan? GetSpan() + public static ISpanTracer? GetSpan() => CurrentHub.GetSpan(); /// diff --git a/src/Sentry/Span.cs b/src/Sentry/Span.cs index aaa9f7d6ab..378bbbee8e 100644 --- a/src/Sentry/Span.cs +++ b/src/Sentry/Span.cs @@ -88,7 +88,7 @@ public Span(SpanId? parentSpanId, string operation) /// /// Initializes an instance of . /// - public Span(ISpan tracer) + public Span(ISpanTracer tracer) : this(tracer.ParentSpanId, tracer.Operation) { SpanId = tracer.SpanId; diff --git a/src/Sentry/SpanTracer.cs b/src/Sentry/SpanTracer.cs index b902abf888..60893c1aa6 100644 --- a/src/Sentry/SpanTracer.cs +++ b/src/Sentry/SpanTracer.cs @@ -6,7 +6,7 @@ namespace Sentry; /// /// Transaction span tracer. /// -public class SpanTracer : ISpan +public class SpanTracer : ISpanTracer { private readonly IHub _hub; private readonly SentryStopwatch _stopwatch = SentryStopwatch.StartNew(); @@ -41,13 +41,13 @@ public class SpanTracer : ISpan public void SetMeasurement(string name, Measurement measurement) => (InternalMeasurements ??= new Dictionary())[name] = measurement; - /// + /// public string Operation { get; set; } - /// + /// public string? Description { get; set; } - /// + /// public SpanStatus? Status { get; set; } /// @@ -119,7 +119,7 @@ internal SpanTracer( } /// - public ISpan StartChild(string operation) => Transaction.StartChild(null, parentSpanId:SpanId, operation: operation); + public ISpanTracer StartChild(string operation) => Transaction.StartChild(null, parentSpanId:SpanId, operation: operation); /// /// Used to mark a span as unfinished when it was previously marked as finished. This allows us to reuse spans for diff --git a/src/Sentry/Transaction.cs b/src/Sentry/Transaction.cs index d351336ce7..eb53b1eb37 100644 --- a/src/Sentry/Transaction.cs +++ b/src/Sentry/Transaction.cs @@ -236,7 +236,7 @@ public Transaction(string name, string operation, TransactionNameSource nameSour /// /// Initializes an instance of . /// - public Transaction(ITransaction tracer) + public Transaction(ITransactionTracer tracer) : this(tracer.Name, tracer.NameSource) { // Contexts have to be set first because other fields use that diff --git a/src/Sentry/TransactionTracer.cs b/src/Sentry/TransactionTracer.cs index 8075d2a141..fa13a2e9bc 100644 --- a/src/Sentry/TransactionTracer.cs +++ b/src/Sentry/TransactionTracer.cs @@ -8,7 +8,7 @@ namespace Sentry; /// /// Transaction tracer. /// -public class TransactionTracer : ITransaction +public class TransactionTracer : ITransactionTracer { private readonly IHub _hub; private readonly SentryOptions? _options; @@ -41,13 +41,13 @@ public SentryId TraceId private set => Contexts.Trace.TraceId = value; } - /// + /// public string Name { get; set; } /// public TransactionNameSource NameSource { get; set; } - /// + /// public bool? IsParentSampled { get; set; } /// @@ -65,17 +65,17 @@ public SentryId TraceId /// public DateTimeOffset? EndTimestamp { get; internal set; } - /// + /// public string Operation { get => Contexts.Trace.Operation; set => Contexts.Trace.Operation = value; } - /// + /// public string? Description { get; set; } - /// + /// public SpanStatus? Status { get => Contexts.Trace.Status; @@ -168,7 +168,7 @@ public IReadOnlyList Fingerprint private readonly ConcurrentBag _spans = new(); /// - public IReadOnlyCollection Spans => _spans; + public IReadOnlyCollection Spans => _spans; private readonly ConcurrentDictionary _measurements = new(); @@ -271,9 +271,9 @@ internal TransactionTracer(IHub hub, ITransactionContext context, TimeSpan? idle public void SetMeasurement(string name, Measurement measurement) => _measurements[name] = measurement; /// - public ISpan StartChild(string operation) => StartChild(spanId: null, parentSpanId: SpanId, operation); + public ISpanTracer StartChild(string operation) => StartChild(spanId: null, parentSpanId: SpanId, operation); - internal ISpan StartChild(SpanId? spanId, SpanId parentSpanId, string operation, + internal ISpanTracer StartChild(SpanId? spanId, SpanId parentSpanId, string operation, Instrumenter instrumenter = Instrumenter.Sentry) { if (instrumenter != _instrumenter) @@ -311,10 +311,10 @@ private class LastActiveSpanTracker { private readonly object _lock = new object(); - private readonly Lazy> _trackedSpans = new(); - private Stack TrackedSpans => _trackedSpans.Value; + private readonly Lazy> _trackedSpans = new(); + private Stack TrackedSpans => _trackedSpans.Value; - public void Push(ISpan span) + public void Push(ISpanTracer span) { lock(_lock) { @@ -322,7 +322,7 @@ public void Push(ISpan span) } } - public ISpan? PeekActive() + public ISpanTracer? PeekActive() { lock(_lock) { @@ -343,7 +343,7 @@ public void Push(ISpan span) private readonly LastActiveSpanTracker _activeSpanTracker = new LastActiveSpanTracker(); /// - public ISpan? GetLastActiveSpan() => _activeSpanTracker.PeekActive(); + public ISpanTracer? GetLastActiveSpan() => _activeSpanTracker.PeekActive(); /// public void Finish() diff --git a/test/Sentry.AspNet.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.AspNet.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 7980235cdf..89bfce1155 100644 --- a/test/Sentry.AspNet.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.AspNet.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -4,7 +4,7 @@ { public static void FinishSentryTransaction(this System.Web.HttpContext httpContext) { } public static void StartOrContinueTrace(this System.Web.HttpContext httpContext) { } - public static Sentry.ITransaction StartSentryTransaction(this System.Web.HttpContext httpContext) { } + public static Sentry.ITransactionTracer StartSentryTransaction(this System.Web.HttpContext httpContext) { } } public static class SentryAspNetOptionsExtensions { diff --git a/test/Sentry.AspNetCore.Tests/ScopeExtensionsTests.cs b/test/Sentry.AspNetCore.Tests/ScopeExtensionsTests.cs index 56b2b5dd8d..0de8281312 100644 --- a/test/Sentry.AspNetCore.Tests/ScopeExtensionsTests.cs +++ b/test/Sentry.AspNetCore.Tests/ScopeExtensionsTests.cs @@ -42,7 +42,7 @@ public Fixture GetSut(bool addTransaction = true) { if (addTransaction) { - Scope.Transaction = Substitute.For(); + Scope.Transaction = Substitute.For(); } var routeFeature = new RoutingFeature @@ -67,7 +67,7 @@ public Fixture GetSutWithEmptyRoute(bool addTransaction = true) { if (addTransaction) { - Scope.Transaction = Substitute.For(); + Scope.Transaction = Substitute.For(); } var routeFeature = new RoutingFeature { diff --git a/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs b/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs index 2346795cdd..672d2f71dd 100644 --- a/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs +++ b/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs @@ -46,9 +46,9 @@ public Fixture() } public ItemsContext NewContext() => new(_database.ContextOptions); - public ISpan GetSpan() => ScopeManager.GetCurrent().Key.Span; + public ISpanTracer GetSpan() => ScopeManager.GetCurrent().Key.Span; - public ITransaction StartTransaction(IHub hub, ITransactionContext context) + public ITransactionTracer StartTransaction(IHub hub, ITransactionContext context) { var transaction = new TransactionTracer(hub, context) { diff --git a/test/Sentry.DiagnosticSource.Tests/SentryEFCoreListenerTests.cs b/test/Sentry.DiagnosticSource.Tests/SentryEFCoreListenerTests.cs index f1ae73a615..f2c492b457 100644 --- a/test/Sentry.DiagnosticSource.Tests/SentryEFCoreListenerTests.cs +++ b/test/Sentry.DiagnosticSource.Tests/SentryEFCoreListenerTests.cs @@ -5,7 +5,7 @@ namespace Sentry.DiagnosticSource.Tests; public class SentryEFCoreListenerTests { - private static Func GetValidator(string type) + private static Func GetValidator(string type) => type switch { EFQueryCompiling or EFQueryCompiled => @@ -28,7 +28,7 @@ private class Fixture public SentryOptions Options { get; } - public IReadOnlyCollection Spans => Tracer?.Spans; + public IReadOnlyCollection Spans => Tracer?.Spans; public IHub Hub { get; } @@ -473,13 +473,13 @@ public void OnNext_Same_Connections_Consolidated() interceptor.OnNext(new(EFConnectionClosed, connectionA)); // Assert - bool IsDbSpan(ISpan s) => s.Operation == "db.connection"; - bool IsCommandSpan(ISpan s) => s.Operation == "db.query"; - Func forConnection = (s, e) => + bool IsDbSpan(ISpanTracer s) => s.Operation == "db.connection"; + bool IsCommandSpan(ISpanTracer s) => s.Operation == "db.query"; + Func forConnection = (s, e) => s.Extra.ContainsKey(EFKeys.DbConnectionId) && s.Extra[EFKeys.DbConnectionId] is Guid connectionId && connectionId == e.ConnectionId; - Func forCommand = (s, e) => + Func forCommand = (s, e) => s.Extra.ContainsKey(EFKeys.DbCommandId) && s.Extra[EFKeys.DbCommandId] is Guid commandId && commandId == e.CommandId; diff --git a/test/Sentry.DiagnosticSource.Tests/SentrySqlListenerTests.cs b/test/Sentry.DiagnosticSource.Tests/SentrySqlListenerTests.cs index 62690daa74..223570a878 100644 --- a/test/Sentry.DiagnosticSource.Tests/SentrySqlListenerTests.cs +++ b/test/Sentry.DiagnosticSource.Tests/SentrySqlListenerTests.cs @@ -7,7 +7,7 @@ namespace Sentry.DiagnosticSource.Tests; public class SentrySqlListenerTests { - private static Func GetValidator(string type) + private static Func GetValidator(string type) => type switch { SqlDataWriteConnectionOpenBeforeCommand or @@ -45,7 +45,7 @@ private class Fixture public SentryOptions Options { get; } - public IReadOnlyCollection Spans => Tracer?.Spans; + public IReadOnlyCollection Spans => Tracer?.Spans; public IHub Hub { get; } public Fixture() diff --git a/test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs b/test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs index 0db055f85c..52dd9f7160 100644 --- a/test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs +++ b/test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs @@ -12,23 +12,23 @@ private class Fixture public DbConnection DbConnection { get; } public TestDbContext DbContext { get; } public IHub Hub { get; } - public ITransaction Tracer { get; } + public ITransactionTracer Tracer { get; } - public ConcurrentBag Spans = new(); + public ConcurrentBag Spans = new(); public Fixture() { DbConnection = Effort.DbConnectionFactory.CreateTransient(); DbContext = new TestDbContext(DbConnection, true); Hub = Substitute.For(); - Tracer = Substitute.For(); + Tracer = Substitute.For(); Tracer.StartChild(Arg.Any()).ReturnsForAnyArgs(AddSpan); Hub.GetSpan().ReturnsForAnyArgs(Tracer); } - private ISpan AddSpan(CallInfo callInfo) + private ISpanTracer AddSpan(CallInfo callInfo) { - var span = Substitute.For(); + var span = Substitute.For(); span.Operation = callInfo.Arg(); Spans.Add(span); return span; diff --git a/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs b/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs index 4a7f87e757..d33d5aa60f 100644 --- a/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs +++ b/test/Sentry.OpenTelemetry.Tests/SentrySpanProcessorTests.cs @@ -313,7 +313,7 @@ public void OnEnd_SpansEnriched() // Arrange _fixture.Options.Instrumenter = Instrumenter.OpenTelemetry; var mockEnricher = Substitute.For(); - mockEnricher.Enrich(Arg.Do(s => s.SetTag("foo", "bar")), Arg.Any(), Arg.Any(), Arg.Any()); + mockEnricher.Enrich(Arg.Do(s => s.SetTag("foo", "bar")), Arg.Any(), Arg.Any(), Arg.Any()); _fixture.Enrichers.Add(mockEnricher); var sut = _fixture.GetSut(); diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt index 3419a81138..32d952ff20 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Core3_1.verified.txt @@ -179,10 +179,10 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(this Sentry.IHub hub, string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void LockScope(this Sentry.IHub hub) { } public static System.IDisposable PushAndLockScope(this Sentry.IHub hub) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } public static void UnlockScope(this Sentry.IHub hub) { } } public interface IAttachmentContent @@ -218,18 +218,18 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpan span); + void BindException(System.Exception exception, Sentry.ISpanTracer span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null); Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null); void EndSession(Sentry.SessionEndStatus status = 0); Sentry.BaggageHeader? GetBaggage(); - Sentry.ISpan? GetSpan(); + Sentry.ISpanTracer? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); void StartSession(); - Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); + Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } public interface IJsonSerializable { @@ -284,17 +284,6 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext - { - new string? Description { get; set; } - new string Operation { get; set; } - new Sentry.SpanStatus? Status { get; set; } - void Finish(); - void Finish(Sentry.SpanStatus status); - void Finish(System.Exception exception); - void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpan StartChild(string operation); - } public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext { System.DateTimeOffset? EndTimestamp { get; } @@ -304,12 +293,16 @@ namespace Sentry Sentry.SentryTraceHeader GetTraceHeader(); void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } - public interface ITransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - new bool? IsParentSampled { get; set; } - new string Name { get; set; } - System.Collections.Generic.IReadOnlyCollection Spans { get; } - Sentry.ISpan? GetLastActiveSpan(); + new string? Description { get; set; } + new string Operation { get; set; } + new Sentry.SpanStatus? Status { get; set; } + void Finish(); + void Finish(Sentry.SpanStatus status); + void Finish(System.Exception exception); + void Finish(System.Exception exception, Sentry.SpanStatus status); + Sentry.ISpanTracer StartChild(string operation); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -321,6 +314,13 @@ namespace Sentry { string? Platform { get; set; } } + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + new bool? IsParentSampled { get; set; } + new string Name { get; set; } + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpanTracer? GetLastActiveSpan(); + } public enum InstructionAddressAdjustment { Auto = 0, @@ -426,9 +426,9 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpan? Span { get; set; } + public Sentry.ISpanTracer? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.ITransaction? Transaction { get; set; } + public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.User User { get; set; } public void AddAttachment(Sentry.Attachment attachment) { } @@ -442,7 +442,7 @@ namespace Sentry public void ClearBreadcrumbs() { } public Sentry.Scope Clone() { } [System.Obsolete("Use the Span property instead. This method will be removed in a future release.")] - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public void SetExtra(string key, object? value) { } public void SetTag(string key, string value) { } public void UnsetTag(string key) { } @@ -538,8 +538,8 @@ namespace Sentry public class SentryGraphQLHttpMessageHandler : Sentry.SentryMessageHandler { public SentryGraphQLHttpMessageHandler(System.Net.Http.HttpMessageHandler? innerHandler = null, Sentry.IHub? hub = null) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -547,8 +547,8 @@ namespace Sentry public SentryHttpMessageHandler(Sentry.IHub hub) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -596,8 +596,8 @@ namespace Sentry protected SentryMessageHandler(Sentry.IHub hub) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url); - protected abstract Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url); + protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); protected override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } } public class SentryOptions @@ -732,7 +732,7 @@ namespace Sentry public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } - public static void BindException(System.Exception exception, Sentry.ISpan span) { } + public static void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -760,7 +760,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync() { } public static System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public static Sentry.BaggageHeader? GetBaggage() { } - public static Sentry.ISpan? GetSpan() { } + public static Sentry.ISpanTracer? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -771,11 +771,11 @@ namespace Sentry public static System.IDisposable PushScope(TState state) { } public static void ResumeSession() { } public static void StartSession() { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } - public static Sentry.ITransaction StartTransaction(string name, string operation) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public static void WithScope(System.Action scopeCallback) { } @@ -892,7 +892,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpan tracer) { } + public Span(Sentry.ISpanTracer tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -937,8 +937,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransaction GetTransaction(this Sentry.ISpan span) { } - public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } + public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -977,7 +977,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -1001,7 +1001,7 @@ namespace Sentry public void SetExtra(string key, object? value) { } public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } public void SetTag(string key, string value) { } - public Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1038,7 +1038,7 @@ namespace Sentry } public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { - public Transaction(Sentry.ITransaction tracer) { } + 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; } @@ -1102,7 +1102,7 @@ namespace Sentry public System.Collections.Generic.IReadOnlyDictionary CustomSamplingContext { get; } public Sentry.ITransactionContext TransactionContext { get; } } - public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransaction, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1128,7 +1128,7 @@ namespace Sentry public double? SampleRate { get; } public Sentry.SdkVersion Sdk { get; } public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } public System.DateTimeOffset StartTimestamp { get; } public Sentry.SpanStatus? Status { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } @@ -1139,12 +1139,12 @@ namespace Sentry public void Finish(Sentry.SpanStatus status) { } public void Finish(System.Exception exception) { } public void Finish(System.Exception exception, Sentry.SpanStatus status) { } - public Sentry.ISpan? GetLastActiveSpan() { } + public Sentry.ISpanTracer? GetLastActiveSpan() { } 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 Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1232,7 +1232,7 @@ namespace Sentry.Extensibility public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, Sentry.Scope? scope = null) { } @@ -1248,14 +1248,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } public void WithScope(System.Action scopeCallback) { } } public class FormRequestPayloadExtractor : Sentry.Extensibility.BaseRequestPayloadExtractor @@ -1272,7 +1272,7 @@ namespace Sentry.Extensibility public void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void AddBreadcrumb(Sentry.Infrastructure.ISystemClock clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -1289,14 +1289,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public void WithScope(System.Action scopeCallback) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index 7bb8107619..94e0ca01b6 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -179,10 +179,10 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(this Sentry.IHub hub, string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void LockScope(this Sentry.IHub hub) { } public static System.IDisposable PushAndLockScope(this Sentry.IHub hub) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } public static void UnlockScope(this Sentry.IHub hub) { } } public interface IAttachmentContent @@ -218,18 +218,18 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpan span); + void BindException(System.Exception exception, Sentry.ISpanTracer span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null); Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null); void EndSession(Sentry.SessionEndStatus status = 0); Sentry.BaggageHeader? GetBaggage(); - Sentry.ISpan? GetSpan(); + Sentry.ISpanTracer? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); void StartSession(); - Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); + Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } public interface IJsonSerializable { @@ -284,17 +284,6 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext - { - new string? Description { get; set; } - new string Operation { get; set; } - new Sentry.SpanStatus? Status { get; set; } - void Finish(); - void Finish(Sentry.SpanStatus status); - void Finish(System.Exception exception); - void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpan StartChild(string operation); - } public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext { System.DateTimeOffset? EndTimestamp { get; } @@ -304,12 +293,16 @@ namespace Sentry Sentry.SentryTraceHeader GetTraceHeader(); void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } - public interface ITransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - new bool? IsParentSampled { get; set; } - new string Name { get; set; } - System.Collections.Generic.IReadOnlyCollection Spans { get; } - Sentry.ISpan? GetLastActiveSpan(); + new string? Description { get; set; } + new string Operation { get; set; } + new Sentry.SpanStatus? Status { get; set; } + void Finish(); + void Finish(Sentry.SpanStatus status); + void Finish(System.Exception exception); + void Finish(System.Exception exception, Sentry.SpanStatus status); + Sentry.ISpanTracer StartChild(string operation); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -321,6 +314,13 @@ namespace Sentry { string? Platform { get; set; } } + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + new bool? IsParentSampled { get; set; } + new string Name { get; set; } + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpanTracer? GetLastActiveSpan(); + } public enum InstructionAddressAdjustment { Auto = 0, @@ -426,9 +426,9 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpan? Span { get; set; } + public Sentry.ISpanTracer? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.ITransaction? Transaction { get; set; } + public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.User User { get; set; } public void AddAttachment(Sentry.Attachment attachment) { } @@ -442,7 +442,7 @@ namespace Sentry public void ClearBreadcrumbs() { } public Sentry.Scope Clone() { } [System.Obsolete("Use the Span property instead. This method will be removed in a future release.")] - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public void SetExtra(string key, object? value) { } public void SetTag(string key, string value) { } public void UnsetTag(string key) { } @@ -538,8 +538,8 @@ namespace Sentry public class SentryGraphQLHttpMessageHandler : Sentry.SentryMessageHandler { public SentryGraphQLHttpMessageHandler(System.Net.Http.HttpMessageHandler? innerHandler = null, Sentry.IHub? hub = null) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -547,8 +547,8 @@ namespace Sentry public SentryHttpMessageHandler(Sentry.IHub hub) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -596,8 +596,8 @@ namespace Sentry protected SentryMessageHandler(Sentry.IHub hub) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url); - protected abstract Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url); + protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); protected override System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } protected override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } } @@ -733,7 +733,7 @@ namespace Sentry public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } - public static void BindException(System.Exception exception, Sentry.ISpan span) { } + public static void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -761,7 +761,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync() { } public static System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public static Sentry.BaggageHeader? GetBaggage() { } - public static Sentry.ISpan? GetSpan() { } + public static Sentry.ISpanTracer? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -772,11 +772,11 @@ namespace Sentry public static System.IDisposable PushScope(TState state) { } public static void ResumeSession() { } public static void StartSession() { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } - public static Sentry.ITransaction StartTransaction(string name, string operation) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public static void WithScope(System.Action scopeCallback) { } @@ -893,7 +893,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpan tracer) { } + public Span(Sentry.ISpanTracer tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -938,8 +938,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransaction GetTransaction(this Sentry.ISpan span) { } - public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } + public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -978,7 +978,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -1002,7 +1002,7 @@ namespace Sentry public void SetExtra(string key, object? value) { } public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } public void SetTag(string key, string value) { } - public Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1039,7 +1039,7 @@ namespace Sentry } public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { - public Transaction(Sentry.ITransaction tracer) { } + 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; } @@ -1103,7 +1103,7 @@ namespace Sentry public System.Collections.Generic.IReadOnlyDictionary CustomSamplingContext { get; } public Sentry.ITransactionContext TransactionContext { get; } } - public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransaction, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1129,7 +1129,7 @@ namespace Sentry public double? SampleRate { get; } public Sentry.SdkVersion Sdk { get; } public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } public System.DateTimeOffset StartTimestamp { get; } public Sentry.SpanStatus? Status { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } @@ -1140,12 +1140,12 @@ namespace Sentry public void Finish(Sentry.SpanStatus status) { } public void Finish(System.Exception exception) { } public void Finish(System.Exception exception, Sentry.SpanStatus status) { } - public Sentry.ISpan? GetLastActiveSpan() { } + public Sentry.ISpanTracer? GetLastActiveSpan() { } 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 Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1233,7 +1233,7 @@ namespace Sentry.Extensibility public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, Sentry.Scope? scope = null) { } @@ -1249,14 +1249,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } public void WithScope(System.Action scopeCallback) { } } public class FormRequestPayloadExtractor : Sentry.Extensibility.BaseRequestPayloadExtractor @@ -1273,7 +1273,7 @@ namespace Sentry.Extensibility public void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void AddBreadcrumb(Sentry.Infrastructure.ISystemClock clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -1290,14 +1290,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public void WithScope(System.Action scopeCallback) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index 7bb8107619..94e0ca01b6 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -179,10 +179,10 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(this Sentry.IHub hub, string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void LockScope(this Sentry.IHub hub) { } public static System.IDisposable PushAndLockScope(this Sentry.IHub hub) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } public static void UnlockScope(this Sentry.IHub hub) { } } public interface IAttachmentContent @@ -218,18 +218,18 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpan span); + void BindException(System.Exception exception, Sentry.ISpanTracer span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null); Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null); void EndSession(Sentry.SessionEndStatus status = 0); Sentry.BaggageHeader? GetBaggage(); - Sentry.ISpan? GetSpan(); + Sentry.ISpanTracer? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); void StartSession(); - Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); + Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } public interface IJsonSerializable { @@ -284,17 +284,6 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext - { - new string? Description { get; set; } - new string Operation { get; set; } - new Sentry.SpanStatus? Status { get; set; } - void Finish(); - void Finish(Sentry.SpanStatus status); - void Finish(System.Exception exception); - void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpan StartChild(string operation); - } public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext { System.DateTimeOffset? EndTimestamp { get; } @@ -304,12 +293,16 @@ namespace Sentry Sentry.SentryTraceHeader GetTraceHeader(); void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } - public interface ITransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - new bool? IsParentSampled { get; set; } - new string Name { get; set; } - System.Collections.Generic.IReadOnlyCollection Spans { get; } - Sentry.ISpan? GetLastActiveSpan(); + new string? Description { get; set; } + new string Operation { get; set; } + new Sentry.SpanStatus? Status { get; set; } + void Finish(); + void Finish(Sentry.SpanStatus status); + void Finish(System.Exception exception); + void Finish(System.Exception exception, Sentry.SpanStatus status); + Sentry.ISpanTracer StartChild(string operation); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -321,6 +314,13 @@ namespace Sentry { string? Platform { get; set; } } + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + new bool? IsParentSampled { get; set; } + new string Name { get; set; } + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpanTracer? GetLastActiveSpan(); + } public enum InstructionAddressAdjustment { Auto = 0, @@ -426,9 +426,9 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpan? Span { get; set; } + public Sentry.ISpanTracer? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.ITransaction? Transaction { get; set; } + public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.User User { get; set; } public void AddAttachment(Sentry.Attachment attachment) { } @@ -442,7 +442,7 @@ namespace Sentry public void ClearBreadcrumbs() { } public Sentry.Scope Clone() { } [System.Obsolete("Use the Span property instead. This method will be removed in a future release.")] - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public void SetExtra(string key, object? value) { } public void SetTag(string key, string value) { } public void UnsetTag(string key) { } @@ -538,8 +538,8 @@ namespace Sentry public class SentryGraphQLHttpMessageHandler : Sentry.SentryMessageHandler { public SentryGraphQLHttpMessageHandler(System.Net.Http.HttpMessageHandler? innerHandler = null, Sentry.IHub? hub = null) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -547,8 +547,8 @@ namespace Sentry public SentryHttpMessageHandler(Sentry.IHub hub) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -596,8 +596,8 @@ namespace Sentry protected SentryMessageHandler(Sentry.IHub hub) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url); - protected abstract Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url); + protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); protected override System.Net.Http.HttpResponseMessage Send(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } protected override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } } @@ -733,7 +733,7 @@ namespace Sentry public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } - public static void BindException(System.Exception exception, Sentry.ISpan span) { } + public static void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -761,7 +761,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync() { } public static System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public static Sentry.BaggageHeader? GetBaggage() { } - public static Sentry.ISpan? GetSpan() { } + public static Sentry.ISpanTracer? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -772,11 +772,11 @@ namespace Sentry public static System.IDisposable PushScope(TState state) { } public static void ResumeSession() { } public static void StartSession() { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } - public static Sentry.ITransaction StartTransaction(string name, string operation) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public static void WithScope(System.Action scopeCallback) { } @@ -893,7 +893,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpan tracer) { } + public Span(Sentry.ISpanTracer tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -938,8 +938,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransaction GetTransaction(this Sentry.ISpan span) { } - public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } + public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -978,7 +978,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -1002,7 +1002,7 @@ namespace Sentry public void SetExtra(string key, object? value) { } public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } public void SetTag(string key, string value) { } - public Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1039,7 +1039,7 @@ namespace Sentry } public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { - public Transaction(Sentry.ITransaction tracer) { } + 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; } @@ -1103,7 +1103,7 @@ namespace Sentry public System.Collections.Generic.IReadOnlyDictionary CustomSamplingContext { get; } public Sentry.ITransactionContext TransactionContext { get; } } - public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransaction, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1129,7 +1129,7 @@ namespace Sentry public double? SampleRate { get; } public Sentry.SdkVersion Sdk { get; } public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } public System.DateTimeOffset StartTimestamp { get; } public Sentry.SpanStatus? Status { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } @@ -1140,12 +1140,12 @@ namespace Sentry public void Finish(Sentry.SpanStatus status) { } public void Finish(System.Exception exception) { } public void Finish(System.Exception exception, Sentry.SpanStatus status) { } - public Sentry.ISpan? GetLastActiveSpan() { } + public Sentry.ISpanTracer? GetLastActiveSpan() { } 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 Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1233,7 +1233,7 @@ namespace Sentry.Extensibility public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, Sentry.Scope? scope = null) { } @@ -1249,14 +1249,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } public void WithScope(System.Action scopeCallback) { } } public class FormRequestPayloadExtractor : Sentry.Extensibility.BaseRequestPayloadExtractor @@ -1273,7 +1273,7 @@ namespace Sentry.Extensibility public void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void AddBreadcrumb(Sentry.Infrastructure.ISystemClock clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -1290,14 +1290,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public void WithScope(System.Action scopeCallback) { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 6724473aef..18d99fcdc4 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -178,10 +178,10 @@ namespace Sentry public static Sentry.SentryId CaptureMessage(this Sentry.IHub hub, string message, System.Action configureScope, Sentry.SentryLevel level = 1) { } public static void LockScope(this Sentry.IHub hub) { } public static System.IDisposable PushAndLockScope(this Sentry.IHub hub) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(this Sentry.IHub hub, string name, string operation, string? description) { } public static void UnlockScope(this Sentry.IHub hub) { } } public interface IAttachmentContent @@ -217,18 +217,18 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpan span); + void BindException(System.Exception exception, Sentry.ISpanTracer span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.TransactionContext ContinueTrace(Sentry.SentryTraceHeader? traceHeader, Sentry.BaggageHeader? baggageHeader, string? name = null, string? operation = null); Sentry.TransactionContext ContinueTrace(string? traceHeader, string? baggageHeader, string? name = null, string? operation = null); void EndSession(Sentry.SessionEndStatus status = 0); Sentry.BaggageHeader? GetBaggage(); - Sentry.ISpan? GetSpan(); + Sentry.ISpanTracer? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); void StartSession(); - Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); + Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext); } public interface IJsonSerializable { @@ -283,17 +283,6 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext - { - new string? Description { get; set; } - new string Operation { get; set; } - new Sentry.SpanStatus? Status { get; set; } - void Finish(); - void Finish(Sentry.SpanStatus status); - void Finish(System.Exception exception); - void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpan StartChild(string operation); - } public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext { System.DateTimeOffset? EndTimestamp { get; } @@ -303,12 +292,16 @@ namespace Sentry Sentry.SentryTraceHeader GetTraceHeader(); void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } - public interface ITransaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - new bool? IsParentSampled { get; set; } - new string Name { get; set; } - System.Collections.Generic.IReadOnlyCollection Spans { get; } - Sentry.ISpan? GetLastActiveSpan(); + new string? Description { get; set; } + new string Operation { get; set; } + new Sentry.SpanStatus? Status { get; set; } + void Finish(); + void Finish(Sentry.SpanStatus status); + void Finish(System.Exception exception); + void Finish(System.Exception exception, Sentry.SpanStatus status); + Sentry.ISpanTracer StartChild(string operation); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -320,6 +313,13 @@ namespace Sentry { string? Platform { get; set; } } + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + { + new bool? IsParentSampled { get; set; } + new string Name { get; set; } + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpanTracer? GetLastActiveSpan(); + } public enum InstructionAddressAdjustment { Auto = 0, @@ -425,9 +425,9 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpan? Span { get; set; } + public Sentry.ISpanTracer? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } - public Sentry.ITransaction? Transaction { get; set; } + public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } public Sentry.User User { get; set; } public void AddAttachment(Sentry.Attachment attachment) { } @@ -441,7 +441,7 @@ namespace Sentry public void ClearBreadcrumbs() { } public Sentry.Scope Clone() { } [System.Obsolete("Use the Span property instead. This method will be removed in a future release.")] - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public void SetExtra(string key, object? value) { } public void SetTag(string key, string value) { } public void UnsetTag(string key) { } @@ -537,8 +537,8 @@ namespace Sentry public class SentryGraphQLHttpMessageHandler : Sentry.SentryMessageHandler { public SentryGraphQLHttpMessageHandler(System.Net.Http.HttpMessageHandler? innerHandler = null, Sentry.IHub? hub = null) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -546,8 +546,8 @@ namespace Sentry public SentryHttpMessageHandler(Sentry.IHub hub) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } public SentryHttpMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url) { } - protected override Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + protected override void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url) { } + protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -595,8 +595,8 @@ namespace Sentry protected SentryMessageHandler(Sentry.IHub hub) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler) { } protected SentryMessageHandler(System.Net.Http.HttpMessageHandler innerHandler, Sentry.IHub hub) { } - protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpan? span, string method, string url); - protected abstract Sentry.ISpan? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + protected abstract void HandleResponse(System.Net.Http.HttpResponseMessage response, Sentry.ISpanTracer? span, string method, string url); + protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); protected override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } } public class SentryOptions @@ -731,7 +731,7 @@ namespace Sentry public static void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void AddBreadcrumb(Sentry.Infrastructure.ISystemClock? clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public static void BindClient(Sentry.ISentryClient client) { } - public static void BindException(System.Exception exception, Sentry.ISpan span) { } + public static void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -759,7 +759,7 @@ namespace Sentry public static System.Threading.Tasks.Task FlushAsync() { } public static System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public static Sentry.BaggageHeader? GetBaggage() { } - public static Sentry.ISpan? GetSpan() { } + public static Sentry.ISpanTracer? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -770,11 +770,11 @@ namespace Sentry public static System.IDisposable PushScope(TState state) { } public static void ResumeSession() { } public static void StartSession() { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context) { } - public static Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } - public static Sentry.ITransaction StartTransaction(string name, string operation) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } - public static Sentry.ITransaction StartTransaction(string name, string operation, string? description) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context) { } + public static Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { } + public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public static void WithScope(System.Action scopeCallback) { } @@ -891,7 +891,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpan tracer) { } + public Span(Sentry.ISpanTracer tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -936,8 +936,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransaction GetTransaction(this Sentry.ISpan span) { } - public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } + public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -976,7 +976,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -1000,7 +1000,7 @@ namespace Sentry public void SetExtra(string key, object? value) { } public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { } public void SetTag(string key, string value) { } - public Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1037,7 +1037,7 @@ namespace Sentry } public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext { - public Transaction(Sentry.ITransaction tracer) { } + 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; } @@ -1101,7 +1101,7 @@ namespace Sentry public System.Collections.Generic.IReadOnlyDictionary CustomSamplingContext { get; } public Sentry.ITransactionContext TransactionContext { get; } } - public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransaction, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1127,7 +1127,7 @@ namespace Sentry public double? SampleRate { get; } public Sentry.SdkVersion Sdk { get; } public Sentry.SpanId SpanId { get; } - public System.Collections.Generic.IReadOnlyCollection Spans { get; } + public System.Collections.Generic.IReadOnlyCollection Spans { get; } public System.DateTimeOffset StartTimestamp { get; } public Sentry.SpanStatus? Status { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } @@ -1138,12 +1138,12 @@ namespace Sentry public void Finish(Sentry.SpanStatus status) { } public void Finish(System.Exception exception) { } public void Finish(System.Exception exception, Sentry.SpanStatus status) { } - public Sentry.ISpan? GetLastActiveSpan() { } + public Sentry.ISpanTracer? GetLastActiveSpan() { } 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 Sentry.ISpan StartChild(string operation) { } + public Sentry.ISpanTracer StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1231,7 +1231,7 @@ namespace Sentry.Extensibility public bool IsEnabled { get; } public Sentry.SentryId LastEventId { get; } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, Sentry.Scope? scope = null) { } @@ -1247,14 +1247,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } public void WithScope(System.Action scopeCallback) { } } public class FormRequestPayloadExtractor : Sentry.Extensibility.BaseRequestPayloadExtractor @@ -1271,7 +1271,7 @@ namespace Sentry.Extensibility public void AddBreadcrumb(string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void AddBreadcrumb(Sentry.Infrastructure.ISystemClock clock, string message, string? category = null, string? type = null, System.Collections.Generic.IDictionary? data = null, Sentry.BreadcrumbLevel level = 0) { } public void BindClient(Sentry.ISentryClient client) { } - public void BindException(System.Exception exception, Sentry.ISpan span) { } + public void BindException(System.Exception exception, Sentry.ISpanTracer span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } @@ -1288,14 +1288,14 @@ namespace Sentry.Extensibility public void EndSession(Sentry.SessionEndStatus status = 0) { } public System.Threading.Tasks.Task FlushAsync(System.TimeSpan timeout) { } public Sentry.BaggageHeader? GetBaggage() { } - public Sentry.ISpan? GetSpan() { } + public Sentry.ISpanTracer? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } public System.IDisposable PushScope(TState state) { } public void ResumeSession() { } public void StartSession() { } - public Sentry.ITransaction StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } + public Sentry.ITransactionTracer StartTransaction(Sentry.ITransactionContext context, System.Collections.Generic.IReadOnlyDictionary customSamplingContext) { } [System.Obsolete("This method is deprecated in favor of overloads of CaptureEvent, CaptureMessage a" + "nd CaptureException that provide a callback to a configurable scope.")] public void WithScope(System.Action scopeCallback) { } diff --git a/test/Sentry.Tests/Protocol/TransactionTests.cs b/test/Sentry.Tests/Protocol/TransactionTests.cs index 6814df8349..412cb2ac49 100644 --- a/test/Sentry.Tests/Protocol/TransactionTests.cs +++ b/test/Sentry.Tests/Protocol/TransactionTests.cs @@ -570,7 +570,7 @@ public void ISpan_GetTransaction_FromTransaction() { // Arrange var hub = Substitute.For(); - ISpan transaction = new TransactionTracer(hub, "my name", "my op"); + ISpanTracer transaction = new TransactionTracer(hub, "my name", "my op"); // Act var result = transaction.GetTransaction(); diff --git a/test/Sentry.Tests/ScopeTests.cs b/test/Sentry.Tests/ScopeTests.cs index 2cf0079294..8624cc3ac5 100644 --- a/test/Sentry.Tests/ScopeTests.cs +++ b/test/Sentry.Tests/ScopeTests.cs @@ -628,7 +628,7 @@ public static void ApplyFakeValues(this Scope scope, string salt = "fake") scope.Distribution = $"{salt} distribution"; scope.Environment = $"{salt} environment"; scope.TransactionName = $"{salt} transaction"; - scope.Transaction = Substitute.For(); + scope.Transaction = Substitute.For(); scope.Fingerprint = new[] { $"{salt} fingerprint" }; scope.AddBreadcrumb(new(message: $"{salt} breadcrumb")); scope.SetExtra("extra", $"{salt} extra"); diff --git a/test/Sentry.Tests/SentryGraphQlHttpMessageHandlerTests.cs b/test/Sentry.Tests/SentryGraphQlHttpMessageHandlerTests.cs index cdaf45fc90..0cbcaf5512 100644 --- a/test/Sentry.Tests/SentryGraphQlHttpMessageHandlerTests.cs +++ b/test/Sentry.Tests/SentryGraphQlHttpMessageHandlerTests.cs @@ -48,9 +48,9 @@ public void ProcessRequest_SetsSpanData() { // Arrange var hub = Substitute.For(); - var parentSpan = Substitute.For(); + var parentSpan = Substitute.For(); hub.GetSpan().Returns(parentSpan); - var childSpan = Substitute.For(); + var childSpan = Substitute.For(); parentSpan.When(p => p.StartChild(Arg.Any())) .Do(op => childSpan.Operation = op.Arg()); parentSpan.StartChild(Arg.Any()).Returns(childSpan); diff --git a/test/Sentry.Tests/SentryHttpMessageHandlerTests.cs b/test/Sentry.Tests/SentryHttpMessageHandlerTests.cs index 4d5b7844d7..64cff21b4a 100644 --- a/test/Sentry.Tests/SentryHttpMessageHandlerTests.cs +++ b/test/Sentry.Tests/SentryHttpMessageHandlerTests.cs @@ -171,7 +171,7 @@ public async Task SendAsync_ExceptionThrown_ExceptionLinkedToSpan() await Assert.ThrowsAsync(() => client.GetAsync("https://localhost/")); // Assert - hub.Received(1).BindException(exception, Arg.Any()); // second argument is an implicitly created span + hub.Received(1).BindException(exception, Arg.Any()); // second argument is an implicitly created span } [Fact] @@ -244,9 +244,9 @@ public void ProcessRequest_SetsSpanData() { // Arrange var hub = Substitute.For(); - var parentSpan = Substitute.For(); + var parentSpan = Substitute.For(); hub.GetSpan().Returns(parentSpan); - var childSpan = Substitute.For(); + var childSpan = Substitute.For(); parentSpan.When(p => p.StartChild(Arg.Any())) .Do(op => childSpan.Operation = op.Arg()); parentSpan.StartChild(Arg.Any()).Returns(childSpan); @@ -453,7 +453,7 @@ public void Send_ExceptionThrown_ExceptionLinkedToSpan() Assert.Throws(() => client.Get("https://localhost/")); // Assert - hub.Received(1).BindException(exception, Arg.Any()); // second argument is an implicitly created span + hub.Received(1).BindException(exception, Arg.Any()); // second argument is an implicitly created span } [Fact]