From 84925a9da90197e88ef41013e80e028358b9951f Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 20 Nov 2023 22:47:06 +1300 Subject: [PATCH] Undo renaming of ISpan (#2870) --- CHANGELOG.md | 4 + src/Sentry.AspNet/HttpContextExtensions.cs | 2 +- .../EFCommandDiagnosticSourceHelper.cs | 8 +- .../EFConnectionDiagnosticSourceHelper.cs | 4 +- .../EFDiagnosticSourceHelper.cs | 10 +-- .../EFQueryCompilerDiagnosticSourceHelper.cs | 4 +- .../DiagnosticSource/SentrySqlListener.cs | 20 ++--- .../DbCommandInterceptionContextExtensions.cs | 6 +- .../AspNetCoreEnricher.cs | 2 +- .../IOpenTelemetryEnricher.cs | 2 +- .../SentrySpanProcessor.cs | 2 +- src/Sentry/Extensibility/DisabledHub.cs | 4 +- src/Sentry/Extensibility/HubAdapter.cs | 4 +- src/Sentry/IHub.cs | 4 +- src/Sentry/ISentryClient.cs | 4 +- src/Sentry/{ISpanTracer.cs => ISpan.cs} | 14 ++-- src/Sentry/ITransactionTracer.cs | 6 +- src/Sentry/Internal/Hub.cs | 10 +-- src/Sentry/Internal/NoOpSpan.cs | 6 +- src/Sentry/Internal/NoOpTransaction.cs | 4 +- src/Sentry/Scope.cs | 4 +- src/Sentry/ScopeExtensions.cs | 2 +- src/Sentry/SentryGraphQLHttpMessageHandler.cs | 4 +- src/Sentry/SentryHttpMessageHandler.cs | 4 +- src/Sentry/SentryMessageHandler.cs | 8 +- src/Sentry/SentrySdk.cs | 8 +- src/Sentry/Span.cs | 2 +- src/Sentry/SpanTracer.cs | 10 +-- src/Sentry/TransactionTracer.cs | 22 +++--- .../SQLite/SentryDiagnosticListenerTests.cs | 2 +- .../SentryEFCoreListenerTests.cs | 12 +-- .../SentrySqlListenerTests.cs | 4 +- .../SentryQueryPerformanceListenerTests.cs | 6 +- .../SentrySpanProcessorTests.cs | 2 +- ...piApprovalTests.Run.DotNet6_0.verified.txt | 76 +++++++++---------- ...piApprovalTests.Run.DotNet7_0.verified.txt | 76 +++++++++---------- ...piApprovalTests.Run.DotNet8_0.verified.txt | 76 +++++++++---------- .../ApiApprovalTests.Run.Net4_8.verified.txt | 76 +++++++++---------- .../Sentry.Tests/Protocol/TransactionTests.cs | 2 +- .../SentryGraphQlHttpMessageHandlerTests.cs | 4 +- .../SentryHttpMessageHandlerTests.cs | 8 +- 41 files changed, 266 insertions(+), 262 deletions(-) rename src/Sentry/{ISpanTracer.cs => ISpan.cs} (85%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9369eafef6..c87686eed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased - 4.x + +- ISpanTracer has been renamed back again to ISpan, to make it easier to upgrade from v3.x to v4.x ([#2870](https://github.com/getsentry/sentry-dotnet/pull/2870)) + ## 4.0.0-beta.1 ### Features diff --git a/src/Sentry.AspNet/HttpContextExtensions.cs b/src/Sentry.AspNet/HttpContextExtensions.cs index aa266ba2b5..8312729986 100644 --- a/src/Sentry.AspNet/HttpContextExtensions.cs +++ b/src/Sentry.AspNet/HttpContextExtensions.cs @@ -136,7 +136,7 @@ public static void FinishSentryTransaction(this HttpContext httpContext) return; } - if (httpContext.Items[HttpContextTransactionItemName] is not ISpanTracer transaction) + if (httpContext.Items[HttpContextTransactionItemName] is not ISpan transaction) { return; } diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFCommandDiagnosticSourceHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFCommandDiagnosticSourceHelper.cs index e807cfda7a..14d67caf69 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(ISpanTracer span, Guid? commandId) + private static void SetCommandId(ISpan span, Guid? commandId) { Debug.Assert(commandId != Guid.Empty); span.SetExtra(EFKeys.DbCommandId, commandId); } - private static Guid? TryGetCommandId(ISpanTracer span) => span.Extra.TryGetValue(EFKeys.DbCommandId); + private static Guid? TryGetCommandId(ISpan span) => span.Extra.TryGetValue(EFKeys.DbCommandId); - protected override ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) + protected override ISpan? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) { if (GetCommandId(diagnosticSourceValue) is { } commandId) { @@ -38,7 +38,7 @@ private static void SetCommandId(ISpanTracer span, Guid? commandId) return null; } - protected override void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue) + protected override void SetSpanReference(ISpan 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 822f94c066..50ac30fb65 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 ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) + protected override ISpan? 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(ISpanTracer span, object? diagnosticSourceValue) + protected override void SetSpanReference(ISpan 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 e283ae1c35..9dcf190e6b 100644 --- a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFDiagnosticSourceHelper.cs +++ b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFDiagnosticSourceHelper.cs @@ -39,11 +39,11 @@ internal EFDiagnosticSourceHelper(IHub hub, SentryOptions options) Transaction = hub.GetTransactionIfSampled(); } - protected static Guid? TryGetConnectionId(ISpanTracer span) => span.Extra.TryGetValue(EFKeys.DbConnectionId); + protected static Guid? TryGetConnectionId(ISpan span) => span.Extra.TryGetValue(EFKeys.DbConnectionId); protected static Guid? GetConnectionId(object? diagnosticSourceValue) => diagnosticSourceValue?.GetGuidProperty("ConnectionId"); - protected static void SetConnectionId(ISpanTracer span, Guid? connectionId) + protected static void SetConnectionId(ISpan 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(ISpanTracer span, object? diagnosticSourceValue) + protected void SetDbData(ISpan span, object? diagnosticSourceValue) { if (GetDatabaseName(diagnosticSourceValue) is { } dataBaseName) { @@ -140,7 +140,7 @@ protected void LogTransactionSpans() return str?[(str.IndexOf('\n') + 1)..]; } - protected abstract ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue); + protected abstract ISpan? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue); - protected abstract void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue); + protected abstract void SetSpanReference(ISpan span, object? diagnosticSourceValue); } diff --git a/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFQueryCompilerDiagnosticSourceHelper.cs b/src/Sentry.DiagnosticSource/Internal/DiagnosticSource/EFQueryCompilerDiagnosticSourceHelper.cs index 78f71bcbf1..db0aae4929 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 ISpanTracer? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) => + protected override ISpan? GetSpanReference(ITransactionTracer transaction, object? diagnosticSourceValue) => transaction.Spans .FirstOrDefault(span => !span.IsFinished && span.Operation == Operation); - protected override void SetSpanReference(ISpanTracer span, object? diagnosticSourceValue) + protected override void SetSpanReference(ISpan 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 76d381deae..3bd90b9a46 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(ISpanTracer span, string databaseName) + private static void SetDatabaseName(ISpan span, string databaseName) { Debug.Assert(databaseName != string.Empty); span.SetExtra(OTelKeys.DbName, databaseName); } - private static void SetDatabaseAddress(ISpanTracer span, string databaseAddress) + private static void SetDatabaseAddress(ISpan span, string databaseAddress) { Debug.Assert(databaseAddress != string.Empty); span.SetExtra(OTelKeys.DbServer, databaseAddress); } - private static void SetConnectionId(ISpanTracer span, Guid? connectionId) + private static void SetConnectionId(ISpan span, Guid? connectionId) { Debug.Assert(connectionId != Guid.Empty); span.SetExtra(SqlKeys.DbConnectionId, connectionId); } - private static void SetOperationId(ISpanTracer span, Guid? operationId) + private static void SetOperationId(ISpan span, Guid? operationId) { Debug.Assert(operationId != Guid.Empty); span.SetExtra(SqlKeys.DbOperationId, operationId); } - private static Guid? TryGetOperationId(ISpanTracer span) => span.Extra.TryGetValue(SqlKeys.DbOperationId); + private static Guid? TryGetOperationId(ISpan span) => span.Extra.TryGetValue(SqlKeys.DbOperationId); - private static Guid? TryGetConnectionId(ISpanTracer span) => span.Extra.TryGetValue(SqlKeys.DbConnectionId); + private static Guid? TryGetConnectionId(ISpan 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 ISpanTracer? GetSpan(SentrySqlSpanType type, object? value) + private ISpan? 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 ISpanTracer? TryGetConnectionSpan(ITransactionTracer transaction, Guid? connectionId) => + private static ISpan? 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 ISpanTracer? TryGetQuerySpan(ITransactionTracer transaction, Guid? operationId) => + private static ISpan? TryGetQuerySpan(ITransactionTracer transaction, Guid? operationId) => operationId == null ? null : transaction.Spans.FirstOrDefault(span => TryGetOperationId(span) == operationId); @@ -248,7 +248,7 @@ public void OnNext(KeyValuePair kvp) } } - private static void TrySetConnectionStatistics(ISpanTracer span, object? value) + private static void TrySetConnectionStatistics(ISpan 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 8106789bac..8c4975535e 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 ISpanTracer? GetSpanFromContext(this DbCommandInterceptionContext interceptionContext) - => interceptionContext.FindUserState(SentryQueryPerformanceListener.SentryUserStateKey) as ISpanTracer; + internal static ISpan? GetSpanFromContext(this DbCommandInterceptionContext interceptionContext) + => interceptionContext.FindUserState(SentryQueryPerformanceListener.SentryUserStateKey) as ISpan; - internal static void AttachSpan(this DbCommandInterceptionContext interceptionContext, ISpanTracer span) + internal static void AttachSpan(this DbCommandInterceptionContext interceptionContext, ISpan span) => interceptionContext.SetUserState(SentryQueryPerformanceListener.SentryUserStateKey, span); } diff --git a/src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs b/src/Sentry.OpenTelemetry/AspNetCoreEnricher.cs index 934811857d..dd0fb833a5 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(ISpanTracer span, Activity activity, IHub hub, SentryOptions? options) + public void Enrich(ISpan 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 4452c8db7e..2fa72949f0 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(ISpanTracer span, Activity activity, IHub hub, SentryOptions? options); + void Enrich(ISpan span, Activity activity, IHub hub, SentryOptions? options); } diff --git a/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs b/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs index f73c573d8a..819406e7db 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/Extensibility/DisabledHub.cs b/src/Sentry/Extensibility/DisabledHub.cs index c8decb664c..c41ea7121e 100644 --- a/src/Sentry/Extensibility/DisabledHub.cs +++ b/src/Sentry/Extensibility/DisabledHub.cs @@ -53,14 +53,14 @@ public void ConfigureScope(Action configureScope) /// /// No-Op. /// - public void BindException(Exception exception, ISpanTracer span) + public void BindException(Exception exception, ISpan span) { } /// /// Returns null. /// - public ISpanTracer? GetSpan() => null; + public ISpan? GetSpan() => null; /// /// Returns null. diff --git a/src/Sentry/Extensibility/HubAdapter.cs b/src/Sentry/Extensibility/HubAdapter.cs index ffe1992cc3..6f7cbaa4d1 100644 --- a/src/Sentry/Extensibility/HubAdapter.cs +++ b/src/Sentry/Extensibility/HubAdapter.cs @@ -82,14 +82,14 @@ public IDisposable PushScope(TState state) /// Forwards the call to . /// [DebuggerStepThrough] - public void BindException(Exception exception, ISpanTracer span) => + public void BindException(Exception exception, ISpan span) => SentrySdk.BindException(exception, span); /// /// Forwards the call to . /// [DebuggerStepThrough] - public ISpanTracer? GetSpan() + public ISpan? GetSpan() => SentrySdk.GetSpan(); /// diff --git a/src/Sentry/IHub.cs b/src/Sentry/IHub.cs index 07f4f6011d..726d548a7a 100644 --- a/src/Sentry/IHub.cs +++ b/src/Sentry/IHub.cs @@ -32,12 +32,12 @@ public interface IHub : /// /// This method is used internally and is not meant for public use. /// - void BindException(Exception exception, ISpanTracer span); + void BindException(Exception exception, ISpan span); /// /// Gets the currently ongoing (not finished) span or null if none available. /// - ISpanTracer? GetSpan(); + ISpan? GetSpan(); /// /// Gets the Sentry trace header that allows tracing across services diff --git a/src/Sentry/ISentryClient.cs b/src/Sentry/ISentryClient.cs index 384624fe5e..0b1d193225 100644 --- a/src/Sentry/ISentryClient.cs +++ b/src/Sentry/ISentryClient.cs @@ -30,7 +30,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)] @@ -41,7 +41,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. /// The scope to be applied to the transaction diff --git a/src/Sentry/ISpanTracer.cs b/src/Sentry/ISpan.cs similarity index 85% rename from src/Sentry/ISpanTracer.cs rename to src/Sentry/ISpan.cs index bd8a8834c3..e1f4ad436c 100644 --- a/src/Sentry/ISpanTracer.cs +++ b/src/Sentry/ISpan.cs @@ -5,7 +5,7 @@ namespace Sentry; /// /// SpanTracer interface /// -public interface ISpanTracer : ISpanData +public interface ISpan : ISpanData { /// /// Span description. @@ -28,7 +28,7 @@ public interface ISpanTracer : ISpanData /// /// Starts a child span. /// - ISpanTracer StartChild(string operation); + ISpan StartChild(string operation); /// /// Finishes the span. @@ -52,7 +52,7 @@ public interface ISpanTracer : 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 ISpanTracer StartChild(this ISpanTracer span, string operation, string? description) + public static ISpan StartChild(this ISpan span, string operation, string? description) { var child = span.StartChild(operation); child.Description = description; @@ -68,7 +68,7 @@ public static ISpanTracer StartChild(this ISpanTracer span, string operation, st return child; } - internal static ISpanTracer StartChild(this ISpanTracer span, SpanContext context) + internal static ISpan StartChild(this ISpan span, SpanContext context) { var transaction = span.GetTransaction() as TransactionTracer; if (transaction?.StartChild(context.SpanId, span.SpanId, context.Operation, context.Instrumenter) @@ -84,7 +84,7 @@ internal static ISpanTracer StartChild(this ISpanTracer span, SpanContext contex /// /// Gets the transaction that this span belongs to. /// - public static ITransactionTracer GetTransaction(this ISpanTracer span) => + public static ITransactionTracer GetTransaction(this ISpan span) => span switch { ITransactionTracer transaction => transaction, @@ -99,7 +99,7 @@ span switch /// /// Used by EF, EF Core, and SQLClient integrations. /// - internal static ISpanTracer GetDbParentSpan(this ISpanTracer span) + internal static ISpan GetDbParentSpan(this ISpan span) { var transaction = span.GetTransaction(); return transaction.Spans diff --git a/src/Sentry/ITransactionTracer.cs b/src/Sentry/ITransactionTracer.cs index ec85bc7316..015840061c 100644 --- a/src/Sentry/ITransactionTracer.cs +++ b/src/Sentry/ITransactionTracer.cs @@ -3,7 +3,7 @@ namespace Sentry; /// /// TransactionTracer interface /// -public interface ITransactionTracer : ITransactionData, ISpanTracer +public interface ITransactionTracer : ITransactionData, ISpan { /// /// Transaction name. @@ -20,10 +20,10 @@ public interface ITransactionTracer : ITransactionData, ISpanTracer /// /// Flat list of spans within this transaction. /// - IReadOnlyCollection Spans { get; } + IReadOnlyCollection Spans { get; } /// /// Gets the last active (not finished) span in this transaction. /// - ISpanTracer? GetLastActiveSpan(); + ISpan? GetLastActiveSpan(); } diff --git a/src/Sentry/Internal/Hub.cs b/src/Sentry/Internal/Hub.cs index 79b7c11cb5..bec6e778e9 100644 --- a/src/Sentry/Internal/Hub.cs +++ b/src/Sentry/Internal/Hub.cs @@ -18,7 +18,7 @@ internal class Hub : IHub, IDisposable private int _isPersistedSessionRecovered; // Internal for testability - internal ConditionalWeakTable ExceptionToSpanMap { get; } = new(); + internal ConditionalWeakTable ExceptionToSpanMap { get; } = new(); internal IInternalScopeManager ScopeManager { get; } @@ -171,7 +171,7 @@ public async Task ConfigureScopeAsync(Func configureScope) return transaction; } - public void BindException(Exception exception, ISpanTracer span) + public void BindException(Exception exception, ISpan span) { // Don't bind on sampled out spans if (span.IsSampled == false) @@ -183,7 +183,7 @@ public void BindException(Exception exception, ISpanTracer span) _ = ExceptionToSpanMap.GetValue(exception, _ => span); } - public ISpanTracer? GetSpan() => ScopeManager.GetCurrent().Key.Span; + public ISpan? GetSpan() => ScopeManager.GetCurrent().Key.Span; public SentryTraceHeader GetTraceHeader() { @@ -333,7 +333,7 @@ private void EndSession(DateTimeOffset timestamp, SessionEndStatus status) public void EndSession(SessionEndStatus status = SessionEndStatus.Exited) => EndSession(_clock.GetUtcNow(), status); - private ISpanTracer? GetLinkedSpan(SentryEvent evt) + private ISpan? GetLinkedSpan(SentryEvent evt) { // Find the span which is bound to the same exception if (evt.Exception is { } exception && @@ -345,7 +345,7 @@ private void EndSession(DateTimeOffset timestamp, SessionEndStatus status) return null; } - private void ApplyTraceContextToEvent(SentryEvent evt, ISpanTracer span) + private void ApplyTraceContextToEvent(SentryEvent evt, ISpan span) { evt.Contexts.Trace.SpanId = span.SpanId; evt.Contexts.Trace.TraceId = span.TraceId; diff --git a/src/Sentry/Internal/NoOpSpan.cs b/src/Sentry/Internal/NoOpSpan.cs index 9b6d75c496..d5f9ffb505 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 : ISpanTracer +internal class NoOpSpan : ISpan { - public static ISpanTracer Instance { get; } = new NoOpSpan(); + public static ISpan Instance { get; } = new NoOpSpan(); protected NoOpSpan() { @@ -41,7 +41,7 @@ public string Operation set { } } - public ISpanTracer StartChild(string operation) => this; + public ISpan StartChild(string operation) => this; public void Finish() { diff --git a/src/Sentry/Internal/NoOpTransaction.cs b/src/Sentry/Internal/NoOpTransaction.cs index d2f9e1c736..7693e4dddc 100644 --- a/src/Sentry/Internal/NoOpTransaction.cs +++ b/src/Sentry/Internal/NoOpTransaction.cs @@ -87,11 +87,11 @@ public IReadOnlyList Fingerprint set { } } - public IReadOnlyCollection Spans => ImmutableList.Empty; + public IReadOnlyCollection Spans => ImmutableList.Empty; public IReadOnlyCollection Breadcrumbs => ImmutableList.Empty; - public ISpanTracer? GetLastActiveSpan() => default; + public ISpan? GetLastActiveSpan() => default; public void AddBreadcrumb(Breadcrumb breadcrumb) { } } diff --git a/src/Sentry/Scope.cs b/src/Sentry/Scope.cs index 5866b6a0de..8daffb13dd 100644 --- a/src/Sentry/Scope.cs +++ b/src/Sentry/Scope.cs @@ -536,7 +536,7 @@ internal void Evaluate() } } - private ISpanTracer? _span; + private ISpan? _span; /// /// Gets or sets the active span, or null if none available. @@ -546,7 +546,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 ISpanTracer? Span + public ISpan? Span { get { diff --git a/src/Sentry/ScopeExtensions.cs b/src/Sentry/ScopeExtensions.cs index 6d31e610c5..e36b2b240b 100644 --- a/src/Sentry/ScopeExtensions.cs +++ b/src/Sentry/ScopeExtensions.cs @@ -209,6 +209,6 @@ public static void AddTransactionProcessors(this Scope scope, IEnumerable /// The scope. /// The last span not finished or null. - internal static ISpanTracer? LastCreatedSpan(this Scope scope) + internal static ISpan? LastCreatedSpan(this Scope scope) => scope.Transaction?.Spans.LastOrDefault(s => !s.IsFinished); } diff --git a/src/Sentry/SentryGraphQLHttpMessageHandler.cs b/src/Sentry/SentryGraphQLHttpMessageHandler.cs index 9e1546a852..9da269d8b5 100644 --- a/src/Sentry/SentryGraphQLHttpMessageHandler.cs +++ b/src/Sentry/SentryGraphQLHttpMessageHandler.cs @@ -38,7 +38,7 @@ public SentryGraphQLHttpMessageHandler(HttpMessageHandler? innerHandler = defaul } /// - protected internal override ISpanTracer? ProcessRequest(HttpRequestMessage request, string method, string url) + protected internal override ISpan? ProcessRequest(HttpRequestMessage request, string method, string url) { var content = GraphQLContentExtractor.ExtractRequestContentAsync(request, _options).Result; if (content is not { } graphQlRequestContent) @@ -59,7 +59,7 @@ public SentryGraphQLHttpMessageHandler(HttpMessageHandler? innerHandler = defaul } /// - protected internal override void HandleResponse(HttpResponseMessage response, ISpanTracer? span, string method, string url) + protected internal override void HandleResponse(HttpResponseMessage response, ISpan? 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 dbabc0e791..fa64feb5c7 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 ISpanTracer? ProcessRequest(HttpRequestMessage request, string method, string url) + protected internal override ISpan? 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, ISpanTracer? span, string method, string url) + protected internal override void HandleResponse(HttpResponseMessage response, ISpan? span, string method, string url) { var breadcrumbData = new Dictionary { diff --git a/src/Sentry/SentryMessageHandler.cs b/src/Sentry/SentryMessageHandler.cs index 77003c18af..8ebeaf77fb 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 ISpanTracer? ProcessRequest(HttpRequestMessage request, string method, string url); + /// An + protected internal abstract ISpan? 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, ISpanTracer? span, string method, string url); + protected internal abstract void HandleResponse(HttpResponseMessage response, ISpan? span, string method, string url); /// protected override async Task SendAsync( diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index 294038090d..0b488758bc 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -449,7 +449,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)] @@ -461,7 +461,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)] @@ -529,14 +529,14 @@ public static ITransactionTracer StartTransaction(string name, string operation, /// This method is used internally and is not meant for public use. /// [DebuggerStepThrough] - public static void BindException(Exception exception, ISpanTracer span) + public static void BindException(Exception exception, ISpan span) => CurrentHub.BindException(exception, span); /// /// Gets the last active span. /// [DebuggerStepThrough] - public static ISpanTracer? GetSpan() + public static ISpan? GetSpan() => CurrentHub.GetSpan(); /// diff --git a/src/Sentry/Span.cs b/src/Sentry/Span.cs index f6942e4dd7..b12f375c12 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(ISpanTracer tracer) + public Span(ISpan tracer) : this(tracer.ParentSpanId, tracer.Operation) { SpanId = tracer.SpanId; diff --git a/src/Sentry/SpanTracer.cs b/src/Sentry/SpanTracer.cs index 60893c1aa6..b902abf888 100644 --- a/src/Sentry/SpanTracer.cs +++ b/src/Sentry/SpanTracer.cs @@ -6,7 +6,7 @@ namespace Sentry; /// /// Transaction span tracer. /// -public class SpanTracer : ISpanTracer +public class SpanTracer : ISpan { private readonly IHub _hub; private readonly SentryStopwatch _stopwatch = SentryStopwatch.StartNew(); @@ -41,13 +41,13 @@ public class SpanTracer : ISpanTracer 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 @@ public class SpanTracer : ISpanTracer } /// - public ISpanTracer StartChild(string operation) => Transaction.StartChild(null, parentSpanId:SpanId, operation: operation); + public ISpan 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/TransactionTracer.cs b/src/Sentry/TransactionTracer.cs index fa13a2e9bc..ba89291d91 100644 --- a/src/Sentry/TransactionTracer.cs +++ b/src/Sentry/TransactionTracer.cs @@ -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 ISpanTracer StartChild(string operation) => StartChild(spanId: null, parentSpanId: SpanId, operation); + public ISpan StartChild(string operation) => StartChild(spanId: null, parentSpanId: SpanId, operation); - internal ISpanTracer StartChild(SpanId? spanId, SpanId parentSpanId, string operation, + internal ISpan 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(ISpanTracer span) + public void Push(ISpan span) { lock(_lock) { @@ -322,7 +322,7 @@ public void Push(ISpanTracer span) } } - public ISpanTracer? PeekActive() + public ISpan? PeekActive() { lock(_lock) { @@ -343,7 +343,7 @@ public void Push(ISpanTracer span) private readonly LastActiveSpanTracker _activeSpanTracker = new LastActiveSpanTracker(); /// - public ISpanTracer? GetLastActiveSpan() => _activeSpanTracker.PeekActive(); + public ISpan? GetLastActiveSpan() => _activeSpanTracker.PeekActive(); /// public void Finish() diff --git a/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs b/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs index 672d2f71dd..c73e62d50d 100644 --- a/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs +++ b/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs @@ -46,7 +46,7 @@ public Fixture() } public ItemsContext NewContext() => new(_database.ContextOptions); - public ISpanTracer GetSpan() => ScopeManager.GetCurrent().Key.Span; + public ISpan GetSpan() => ScopeManager.GetCurrent().Key.Span; public ITransactionTracer StartTransaction(IHub hub, ITransactionContext context) { diff --git a/test/Sentry.DiagnosticSource.Tests/SentryEFCoreListenerTests.cs b/test/Sentry.DiagnosticSource.Tests/SentryEFCoreListenerTests.cs index 5d966a1bc3..516e7242e9 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(ISpanTracer s) => s.Operation == "db.connection"; - bool IsCommandSpan(ISpanTracer s) => s.Operation == "db.query"; - Func forConnection = (s, e) => + bool IsDbSpan(ISpan s) => s.Operation == "db.connection"; + bool IsCommandSpan(ISpan 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 223570a878..62690daa74 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 52dd9f7160..0e74973d0c 100644 --- a/test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs +++ b/test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs @@ -14,7 +14,7 @@ private class Fixture public IHub Hub { get; } public ITransactionTracer Tracer { get; } - public ConcurrentBag Spans = new(); + public ConcurrentBag Spans = new(); public Fixture() { @@ -26,9 +26,9 @@ public Fixture() Hub.GetSpan().ReturnsForAnyArgs(Tracer); } - private ISpanTracer AddSpan(CallInfo callInfo) + private ISpan 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 d33d5aa60f..4a7f87e757 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.DotNet6_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt index a0f1c96df4..02c6e3474e 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt @@ -219,14 +219,14 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpanTracer span); + void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, 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.ISpanTracer? GetSpan(); + Sentry.ISpan? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); @@ -282,16 +282,7 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext - { - System.DateTimeOffset? EndTimestamp { get; } - bool IsFinished { get; } - System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - System.DateTimeOffset StartTimestamp { get; } - Sentry.SentryTraceHeader GetTraceHeader(); - void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); - } - public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { new string? Description { get; set; } new string Operation { get; set; } @@ -300,7 +291,16 @@ namespace Sentry void Finish(Sentry.SpanStatus status); void Finish(System.Exception exception); void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpanTracer StartChild(string operation); + Sentry.ISpan StartChild(string operation); + } + public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext + { + System.DateTimeOffset? EndTimestamp { get; } + bool IsFinished { get; } + System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + System.DateTimeOffset StartTimestamp { get; } + Sentry.SentryTraceHeader GetTraceHeader(); + void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -312,12 +312,12 @@ 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 + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, 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(); + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpan? GetLastActiveSpan(); } public enum InstructionAddressAdjustment { @@ -424,7 +424,7 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpanTracer? Span { get; set; } + public Sentry.ISpan? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } @@ -531,8 +531,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -540,8 +540,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -589,8 +589,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.ISpanTracer? span, string method, string url); - protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + 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 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) { } } @@ -706,7 +706,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.ISpanTracer span) { } + public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -733,7 +733,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.ISpanTracer? GetSpan() { } + public static Sentry.ISpan? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -847,7 +847,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpanTracer tracer) { } + public Span(Sentry.ISpan tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -892,8 +892,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } - public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } + public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -932,7 +932,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -956,7 +956,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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1051,7 +1051,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.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1077,7 +1077,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; } @@ -1088,12 +1088,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.ISpanTracer? GetLastActiveSpan() { } + public Sentry.ISpan? 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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1181,7 +1181,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -1197,7 +1197,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } @@ -1220,7 +1220,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan 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) { } @@ -1238,7 +1238,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt index a0f1c96df4..02c6e3474e 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt @@ -219,14 +219,14 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpanTracer span); + void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, 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.ISpanTracer? GetSpan(); + Sentry.ISpan? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); @@ -282,16 +282,7 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext - { - System.DateTimeOffset? EndTimestamp { get; } - bool IsFinished { get; } - System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - System.DateTimeOffset StartTimestamp { get; } - Sentry.SentryTraceHeader GetTraceHeader(); - void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); - } - public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { new string? Description { get; set; } new string Operation { get; set; } @@ -300,7 +291,16 @@ namespace Sentry void Finish(Sentry.SpanStatus status); void Finish(System.Exception exception); void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpanTracer StartChild(string operation); + Sentry.ISpan StartChild(string operation); + } + public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext + { + System.DateTimeOffset? EndTimestamp { get; } + bool IsFinished { get; } + System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + System.DateTimeOffset StartTimestamp { get; } + Sentry.SentryTraceHeader GetTraceHeader(); + void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -312,12 +312,12 @@ 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 + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, 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(); + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpan? GetLastActiveSpan(); } public enum InstructionAddressAdjustment { @@ -424,7 +424,7 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpanTracer? Span { get; set; } + public Sentry.ISpan? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } @@ -531,8 +531,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -540,8 +540,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -589,8 +589,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.ISpanTracer? span, string method, string url); - protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + 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 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) { } } @@ -706,7 +706,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.ISpanTracer span) { } + public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -733,7 +733,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.ISpanTracer? GetSpan() { } + public static Sentry.ISpan? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -847,7 +847,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpanTracer tracer) { } + public Span(Sentry.ISpan tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -892,8 +892,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } - public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } + public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -932,7 +932,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -956,7 +956,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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1051,7 +1051,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.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1077,7 +1077,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; } @@ -1088,12 +1088,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.ISpanTracer? GetLastActiveSpan() { } + public Sentry.ISpan? 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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1181,7 +1181,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -1197,7 +1197,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } @@ -1220,7 +1220,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan 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) { } @@ -1238,7 +1238,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index a0f1c96df4..02c6e3474e 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -219,14 +219,14 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpanTracer span); + void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, 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.ISpanTracer? GetSpan(); + Sentry.ISpan? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); @@ -282,16 +282,7 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext - { - System.DateTimeOffset? EndTimestamp { get; } - bool IsFinished { get; } - System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - System.DateTimeOffset StartTimestamp { get; } - Sentry.SentryTraceHeader GetTraceHeader(); - void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); - } - public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { new string? Description { get; set; } new string Operation { get; set; } @@ -300,7 +291,16 @@ namespace Sentry void Finish(Sentry.SpanStatus status); void Finish(System.Exception exception); void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpanTracer StartChild(string operation); + Sentry.ISpan StartChild(string operation); + } + public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext + { + System.DateTimeOffset? EndTimestamp { get; } + bool IsFinished { get; } + System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + System.DateTimeOffset StartTimestamp { get; } + Sentry.SentryTraceHeader GetTraceHeader(); + void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -312,12 +312,12 @@ 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 + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, 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(); + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpan? GetLastActiveSpan(); } public enum InstructionAddressAdjustment { @@ -424,7 +424,7 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpanTracer? Span { get; set; } + public Sentry.ISpan? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } @@ -531,8 +531,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -540,8 +540,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -589,8 +589,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.ISpanTracer? span, string method, string url); - protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + 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 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) { } } @@ -706,7 +706,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.ISpanTracer span) { } + public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -733,7 +733,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.ISpanTracer? GetSpan() { } + public static Sentry.ISpan? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -847,7 +847,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpanTracer tracer) { } + public Span(Sentry.ISpan tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -892,8 +892,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } - public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } + public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -932,7 +932,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -956,7 +956,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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1051,7 +1051,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.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1077,7 +1077,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; } @@ -1088,12 +1088,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.ISpanTracer? GetLastActiveSpan() { } + public Sentry.ISpan? 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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1181,7 +1181,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -1197,7 +1197,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } @@ -1220,7 +1220,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan 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) { } @@ -1238,7 +1238,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 8f62a96484..c1beabccf8 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -218,14 +218,14 @@ namespace Sentry public interface IHub : Sentry.ISentryClient, Sentry.ISentryScopeManager { Sentry.SentryId LastEventId { get; } - void BindException(System.Exception exception, Sentry.ISpanTracer span); + void BindException(System.Exception exception, Sentry.ISpan span); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope); Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, 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.ISpanTracer? GetSpan(); + Sentry.ISpan? GetSpan(); Sentry.SentryTraceHeader? GetTraceHeader(); void PauseSession(); void ResumeSession(); @@ -281,16 +281,7 @@ namespace Sentry System.DateTimeOffset StartTimestamp { get; } string? UserAgent { get; } } - public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext - { - System.DateTimeOffset? EndTimestamp { get; } - bool IsFinished { get; } - System.Collections.Generic.IReadOnlyDictionary Measurements { get; } - System.DateTimeOffset StartTimestamp { get; } - Sentry.SentryTraceHeader GetTraceHeader(); - void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); - } - public interface ISpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext + public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext { new string? Description { get; set; } new string Operation { get; set; } @@ -299,7 +290,16 @@ namespace Sentry void Finish(Sentry.SpanStatus status); void Finish(System.Exception exception); void Finish(System.Exception exception, Sentry.SpanStatus status); - Sentry.ISpanTracer StartChild(string operation); + Sentry.ISpan StartChild(string operation); + } + public interface ISpanData : Sentry.IHasExtra, Sentry.IHasTags, Sentry.Protocol.ITraceContext + { + System.DateTimeOffset? EndTimestamp { get; } + bool IsFinished { get; } + System.Collections.Generic.IReadOnlyDictionary Measurements { get; } + System.DateTimeOffset StartTimestamp { get; } + Sentry.SentryTraceHeader GetTraceHeader(); + void SetMeasurement(string name, Sentry.Protocol.Measurement measurement); } public interface ITransactionContext : Sentry.Protocol.ITraceContext { @@ -311,12 +311,12 @@ 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 + public interface ITransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, 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(); + System.Collections.Generic.IReadOnlyCollection Spans { get; } + Sentry.ISpan? GetLastActiveSpan(); } public enum InstructionAddressAdjustment { @@ -423,7 +423,7 @@ namespace Sentry public string? Release { get; set; } public Sentry.Request Request { get; set; } public Sentry.SdkVersion Sdk { get; } - public Sentry.ISpanTracer? Span { get; set; } + public Sentry.ISpan? Span { get; set; } public System.Collections.Generic.IReadOnlyDictionary Tags { get; } public Sentry.ITransactionTracer? Transaction { get; set; } public string? TransactionName { get; set; } @@ -530,8 +530,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public class SentryHttpMessageHandler : Sentry.SentryMessageHandler { @@ -539,8 +539,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.ISpanTracer? span, string method, string url) { } - protected override Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url) { } + 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) { } } public readonly struct SentryId : Sentry.IJsonSerializable, System.IEquatable { @@ -588,8 +588,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.ISpanTracer? span, string method, string url); - protected abstract Sentry.ISpanTracer? ProcessRequest(System.Net.Http.HttpRequestMessage request, string method, string url); + 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 override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { } } public class SentryOptions @@ -703,7 +703,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.ISpanTracer span) { } + public static void BindException(System.Exception exception, Sentry.ISpan span) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public static Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -730,7 +730,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.ISpanTracer? GetSpan() { } + public static Sentry.ISpan? GetSpan() { } public static Sentry.SentryTraceHeader? GetTraceHeader() { } public static System.IDisposable Init() { } public static System.IDisposable Init(Sentry.SentryOptions options) { } @@ -844,7 +844,7 @@ namespace Sentry } public class Span : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext { - public Span(Sentry.ISpanTracer tracer) { } + public Span(Sentry.ISpan tracer) { } public Span(Sentry.SpanId? parentSpanId, string operation) { } public string? Description { get; set; } public System.DateTimeOffset? EndTimestamp { get; } @@ -889,8 +889,8 @@ namespace Sentry } public static class SpanExtensions { - public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpanTracer span) { } - public static Sentry.ISpanTracer StartChild(this Sentry.ISpanTracer span, string operation, string? description) { } + public static Sentry.ITransactionTracer GetTransaction(this Sentry.ISpan span) { } + public static Sentry.ISpan StartChild(this Sentry.ISpan span, string operation, string? description) { } } public readonly struct SpanId : Sentry.IJsonSerializable, System.IEquatable { @@ -929,7 +929,7 @@ namespace Sentry OutOfRange = 15, DataLoss = 16, } - public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.ISpanTracer, Sentry.Protocol.ITraceContext + public class SpanTracer : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.Protocol.ITraceContext { public SpanTracer(Sentry.IHub hub, Sentry.TransactionTracer transaction, Sentry.SpanId? parentSpanId, Sentry.SentryId traceId, string operation) { } public string? Description { get; set; } @@ -953,7 +953,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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public enum StackTraceMode @@ -1048,7 +1048,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.ISpanData, Sentry.ISpanTracer, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext + public class TransactionTracer : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpan, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.ITransactionTracer, Sentry.Protocol.ITraceContext { public TransactionTracer(Sentry.IHub hub, Sentry.ITransactionContext context) { } public System.Collections.Generic.IReadOnlyCollection Breadcrumbs { get; } @@ -1074,7 +1074,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; } @@ -1085,12 +1085,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.ISpanTracer? GetLastActiveSpan() { } + public Sentry.ISpan? 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.ISpanTracer StartChild(string operation) { } + public Sentry.ISpan StartChild(string operation) { } public void UnsetTag(string key) { } } public sealed class User : Sentry.IJsonSerializable @@ -1178,7 +1178,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan span) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Hint? hint, System.Action configureScope) { } public Sentry.SentryId CaptureEvent(Sentry.SentryEvent evt, Sentry.Scope? scope = null, Sentry.Hint? hint = null) { } @@ -1194,7 +1194,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } @@ -1217,7 +1217,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.ISpanTracer span) { } + public void BindException(System.Exception exception, Sentry.ISpan 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) { } @@ -1235,7 +1235,7 @@ 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.ISpanTracer? GetSpan() { } + public Sentry.ISpan? GetSpan() { } public Sentry.SentryTraceHeader? GetTraceHeader() { } public void PauseSession() { } public System.IDisposable PushScope() { } diff --git a/test/Sentry.Tests/Protocol/TransactionTests.cs b/test/Sentry.Tests/Protocol/TransactionTests.cs index 0b5802f3a7..dd43d92398 100644 --- a/test/Sentry.Tests/Protocol/TransactionTests.cs +++ b/test/Sentry.Tests/Protocol/TransactionTests.cs @@ -571,7 +571,7 @@ public void ISpan_GetTransaction_FromTransaction() { // Arrange var hub = Substitute.For(); - ISpanTracer transaction = new TransactionTracer(hub, "my name", "my op"); + ISpan transaction = new TransactionTracer(hub, "my name", "my op"); // Act var result = transaction.GetTransaction(); diff --git a/test/Sentry.Tests/SentryGraphQlHttpMessageHandlerTests.cs b/test/Sentry.Tests/SentryGraphQlHttpMessageHandlerTests.cs index 0cbcaf5512..cdaf45fc90 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 7b283eaf10..fc38202019 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]