Skip to content

Commit

Permalink
feat: Renamed Sentry.Transaction to Sentry.SentryTransaction (#3023)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes committed Jan 11, 2024
1 parent 90dd027 commit 2a41c48
Show file tree
Hide file tree
Showing 42 changed files with 380 additions and 379 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Class renamed `Sentry.User` to `Sentry.SentryUser` ([#3015](https://github.com/getsentry/sentry-dotnet/pull/3015))
- Class renamed `Sentry.Runtime` to `Sentry.SentryRuntime` ([#3016](https://github.com/getsentry/sentry-dotnet/pull/3016))
- Class renamed `Sentry.Span` to `Sentry.SentrySpan` ([#3021](https://github.com/getsentry/sentry-dotnet/pull/3021))
- Class renamed `Sentry.Transaction` to `Sentry.SentryTransaction` ([#3023](https://github.com/getsentry/sentry-dotnet/pull/3023))

### Dependencies

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/Sentry.Benchmarks/ProfilingBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void StartProfiler()
public void StopProfiler()
{
_profiler?.Finish();
(_profiler as SamplingTransactionProfiler)?.CollectAsync(new Transaction("", "")).Wait();
(_profiler as SamplingTransactionProfiler)?.CollectAsync(new SentryTransaction("", "")).Wait();
_profiler = null;
_factory.Dispose();
_factory = null;
Expand All @@ -52,7 +52,7 @@ public long Transaction(int runtimeMs, bool collect)
tt.TransactionProfiler = _factory.Start(tt, CancellationToken.None);
var result = RunForMs(runtimeMs);
tt.TransactionProfiler.Finish();
var transaction = new Transaction(tt);
var transaction = new SentryTransaction(tt);
if (collect)
{
var collectTask = (tt.TransactionProfiler as SamplingTransactionProfiler).CollectAsync(transaction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Sentry.OpenTelemetry;

internal class OpenTelemetryTransactionProcessor : ISentryTransactionProcessor
{
public Transaction Process(Transaction transaction)
public SentryTransaction Process(SentryTransaction transaction)
{
var activity = Activity.Current;
if (activity != null)
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry.Profiling/SamplingTransactionProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ public void Finish()
}

/// <inheritdoc />
public Protocol.Envelopes.ISerializable? Collect(Transaction transaction)
public Protocol.Envelopes.ISerializable? Collect(SentryTransaction transaction)
=> Protocol.Envelopes.AsyncJsonSerializable.CreateFrom(CollectAsync(transaction));

internal async Task<ProfileInfo> CollectAsync(Transaction transaction)
internal async Task<ProfileInfo> CollectAsync(SentryTransaction transaction)
{
if (!_stopped)
{
Expand All @@ -118,7 +118,7 @@ internal async Task<ProfileInfo> CollectAsync(Transaction transaction)
return CreateProfileInfo(transaction, _processor.Profile);
}

internal static ProfileInfo CreateProfileInfo(Transaction transaction, SampleProfile profile)
internal static ProfileInfo CreateProfileInfo(SentryTransaction transaction, SampleProfile profile)
{
return new()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Extensibility/DisabledHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ public void BindClient(ISentryClient client)
/// <summary>
/// No-Op.
/// </summary>
public void CaptureTransaction(Transaction transaction)
public void CaptureTransaction(SentryTransaction transaction)
{
}

/// <summary>
/// No-Op.
/// </summary>
public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint)
public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Extensibility/HubAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ public SentryId CaptureException(Exception exception)
/// </summary>
[DebuggerStepThrough]
[EditorBrowsable(EditorBrowsableState.Never)]
public void CaptureTransaction(Transaction transaction)
public void CaptureTransaction(SentryTransaction transaction)
=> SentrySdk.CaptureTransaction(transaction);

/// <summary>
/// Forwards the call to <see cref="SentrySdk"/>.
/// </summary>
[DebuggerStepThrough]
[EditorBrowsable(EditorBrowsableState.Never)]
public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint)
public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint)
=> SentrySdk.CaptureTransaction(transaction, scope, hint);

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/Sentry/Extensibility/ISentryTransactionProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
namespace Sentry.Extensibility;

/// <summary>
/// Process a <see cref="Transaction"/> during the prepare phase.
/// Process a <see cref="SentryTransaction"/> during the prepare phase.
/// </summary>
public interface ISentryTransactionProcessor
{
/// <summary>
/// Process the <see cref="Transaction"/>
/// Process the <see cref="SentryTransaction"/>
/// </summary>
/// <param name="transaction">The Transaction to process</param>
/// <remarks>
/// The transaction returned can be the same instance received or a new one.
/// Returning null will stop the processing pipeline.
/// Meaning the transaction should no longer be processed nor send.
/// </remarks>
Transaction? Process(Transaction transaction);
SentryTransaction? Process(SentryTransaction transaction);
}

internal static class ISentryTransactionProcessorExtensions
{
internal static Transaction? DoProcessTransaction(this ISentryTransactionProcessor processor, Transaction transaction, Hint hint)
internal static SentryTransaction? DoProcessTransaction(this ISentryTransactionProcessor processor, SentryTransaction transaction, Hint hint)
{
return (processor is ISentryTransactionProcessorWithHint contextualProcessor)
? contextualProcessor.Process(transaction, hint)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Sentry.Extensibility;

/// <summary>
/// Process a <see cref="Transaction"/> during the prepare phase.
/// Process a <see cref="SentryTransaction"/> during the prepare phase.
/// </summary>
public interface ISentryTransactionProcessorWithHint: ISentryTransactionProcessor
{
/// <summary>
/// Process the <see cref="Transaction"/>
/// Process the <see cref="SentryTransaction"/>
/// </summary>
/// <param name="transaction">The Transaction to process</param>
/// <param name="hint">A <see cref="Hint"/> with context that may be useful prior to sending the transaction</param>
Expand All @@ -15,5 +15,5 @@ public interface ISentryTransactionProcessorWithHint: ISentryTransactionProcesso
/// Returning null will stop the processing pipeline.
/// Meaning the transaction should no longer be processed nor send.
/// </remarks>
Transaction? Process(Transaction transaction, Hint hint);
SentryTransaction? Process(SentryTransaction transaction, Hint hint);
}
4 changes: 2 additions & 2 deletions src/Sentry/ISentryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface ISentryClient
/// </remarks>
/// <param name="transaction">The transaction.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
void CaptureTransaction(Transaction transaction);
void CaptureTransaction(SentryTransaction transaction);

/// <summary>
/// Captures a transaction.
Expand All @@ -50,7 +50,7 @@ public interface ISentryClient
/// This will be available in callbacks prior to processing the transaction.
/// </param>
[EditorBrowsable(EditorBrowsableState.Never)]
void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint);
void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint);

/// <summary>
/// Captures a session update.
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry/Internal/DelegateTransactionProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ namespace Sentry.Internal;

internal class DelegateTransactionProcessor : ISentryTransactionProcessor
{
private readonly Func<Transaction, Transaction?> _func;
private readonly Func<SentryTransaction, SentryTransaction?> _func;

public DelegateTransactionProcessor(Func<Transaction, Transaction?> func)
public DelegateTransactionProcessor(Func<SentryTransaction, SentryTransaction?> func)
{
_func = func;
}

public Transaction? Process(Transaction transaction)
public SentryTransaction? Process(SentryTransaction transaction)
{
return _func(transaction);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Internal/Hub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ public void CaptureUserFeedback(UserFeedback userFeedback)
}
}

public void CaptureTransaction(Transaction transaction) => CaptureTransaction(transaction, null, null);
public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null);

public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint)
public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint)
{
// Note: The hub should capture transactions even if it is disabled.
// This allows transactions to be reported as failed when they encountered an unhandled exception,
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Internal/ITransactionProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ internal interface ITransactionProfiler

/// <summary>Process and collect the profile.</summary>
/// <returns>The collected profile.</returns>
ISerializable? Collect(Transaction transaction);
ISerializable? Collect(SentryTransaction transaction);
}
2 changes: 1 addition & 1 deletion src/Sentry/Platforms/Cocoa/CocoaProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Finish()
}
}

public ISerializable? Collect(Transaction transaction)
public ISerializable? Collect(SentryTransaction transaction)
{
var payload = SentryCocoaHybridSdk.CollectProfileBetween(_startTimeNs, _endTimeNs, _cocoaTraceId);
if (payload is null)
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Protocol/Envelopes/Envelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public static Envelope FromUserFeedback(UserFeedback sentryUserFeedback)
/// <summary>
/// Creates an envelope that contains a single transaction.
/// </summary>
public static Envelope FromTransaction(Transaction transaction)
public static Envelope FromTransaction(SentryTransaction transaction)
{
var eventId = transaction.EventId;
var header = CreateHeader(eventId, transaction.DynamicSamplingContext);
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Protocol/Envelopes/EnvelopeItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public static EnvelopeItem FromUserFeedback(UserFeedback sentryUserFeedback)
/// <summary>
/// Creates an <see cref="EnvelopeItem"/> from <paramref name="transaction"/>.
/// </summary>
public static EnvelopeItem FromTransaction(Transaction transaction)
public static EnvelopeItem FromTransaction(SentryTransaction transaction)
{
var header = new Dictionary<string, object?>(1, StringComparer.Ordinal)
{
Expand Down Expand Up @@ -373,7 +373,7 @@ private static async Task<ISerializable> DeserializePayloadAsync(
{
var bufferLength = (int)(payloadLength ?? stream.Length);
var buffer = await stream.ReadByteChunkAsync(bufferLength, cancellationToken).ConfigureAwait(false);
var transaction = Json.Parse(buffer, Transaction.FromJson);
var transaction = Json.Parse(buffer, SentryTransaction.FromJson);

return new JsonSerializable(transaction);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Protocol/ProfileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Contexts Contexts

public string? Release { get; set; }

public Transaction? Transaction { get; set; }
public SentryTransaction? Transaction { get; set; }


public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
Expand Down
8 changes: 4 additions & 4 deletions src/Sentry/ScopeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@ public static void AddEventProcessors(this Scope scope, IEnumerable<ISentryEvent
}

/// <summary>
/// Adds an transaction processor which is invoked when creating a <see cref="Transaction"/>.
/// Adds an transaction processor which is invoked when creating a <see cref="SentryTransaction"/>.
/// </summary>
/// <param name="scope">The Scope to hold the processor.</param>
/// <param name="processor">The transaction processor.</param>
public static void AddTransactionProcessor(this Scope scope, ISentryTransactionProcessor processor)
=> scope.TransactionProcessors.Add(processor);

/// <summary>
/// Adds an transaction processor which is invoked when creating a <see cref="Transaction"/>.
/// Adds an transaction processor which is invoked when creating a <see cref="SentryTransaction"/>.
/// </summary>
/// <param name="scope">The Scope to hold the processor.</param>
/// <param name="processor">The transaction processor.</param>
public static void AddTransactionProcessor(this Scope scope, Func<Transaction, Transaction?> processor)
public static void AddTransactionProcessor(this Scope scope, Func<SentryTransaction, SentryTransaction?> processor)
=> scope.AddTransactionProcessor(new DelegateTransactionProcessor(processor));

/// <summary>
/// Adds transaction processors which are invoked when creating a <see cref="Transaction"/>.
/// Adds transaction processors which are invoked when creating a <see cref="SentryTransaction"/>.
/// </summary>
/// <param name="scope">The Scope to hold the processor.</param>
/// <param name="processors">The transaction processors.</param>
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry/SentryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public void CaptureUserFeedback(UserFeedback userFeedback)
}

/// <inheritdoc />
public void CaptureTransaction(Transaction transaction) => CaptureTransaction(transaction, null, null);
public void CaptureTransaction(SentryTransaction transaction) => CaptureTransaction(transaction, null, null);

/// <inheritdoc />
public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint)
public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint)
{
if (transaction.SpanId.Equals(SpanId.Empty))
{
Expand Down Expand Up @@ -198,7 +198,7 @@ public void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint
CaptureEnvelope(Envelope.FromTransaction(processedTransaction));
}

private Transaction? BeforeSendTransaction(Transaction transaction, Hint hint)
private SentryTransaction? BeforeSendTransaction(SentryTransaction transaction, Hint hint)
{
if (_options.BeforeSendTransactionInternal is null)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Sentry/SentryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,15 @@ public void SetBeforeSend(Func<SentryEvent, SentryEvent?> beforeSend)
_beforeSend = (@event, _) => beforeSend(@event);
}

private Func<Transaction, Hint, Transaction?>? _beforeSendTransaction;
private Func<SentryTransaction, Hint, SentryTransaction?>? _beforeSendTransaction;

internal Func<Transaction, Hint, Transaction?>? BeforeSendTransactionInternal => _beforeSendTransaction;
internal Func<SentryTransaction, Hint, SentryTransaction?>? BeforeSendTransactionInternal => _beforeSendTransaction;

/// <summary>
/// Configures a callback to invoke before sending a transaction to Sentry
/// </summary>
/// <param name="beforeSendTransaction">The callback</param>
public void SetBeforeSendTransaction(Func<Transaction, Hint, Transaction?> beforeSendTransaction)
public void SetBeforeSendTransaction(Func<SentryTransaction, Hint, SentryTransaction?> beforeSendTransaction)
{
_beforeSendTransaction = beforeSendTransaction;
}
Expand All @@ -462,7 +462,7 @@ public void SetBeforeSendTransaction(Func<Transaction, Hint, Transaction?> befor
/// Configures a callback to invoke before sending a transaction to Sentry
/// </summary>
/// <param name="beforeSendTransaction">The callback</param>
public void SetBeforeSendTransaction(Func<Transaction, Transaction?> beforeSendTransaction)
public void SetBeforeSendTransaction(Func<SentryTransaction, SentryTransaction?> beforeSendTransaction)
{
_beforeSendTransaction = (transaction, _) => beforeSendTransaction(transaction);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry/SentryOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static void AddEventProcessorProvider(this SentryOptions options, Func<IE
}

/// <summary>
/// Adds an transaction processor which is invoked when creating a <see cref="Transaction"/>.
/// Adds an transaction processor which is invoked when creating a <see cref="SentryTransaction"/>.
/// </summary>
/// <param name="options">The SentryOptions to hold the processor.</param>
/// <param name="processor">The transaction processor.</param>
Expand All @@ -269,7 +269,7 @@ public static void AddTransactionProcessor(this SentryOptions options, ISentryTr
}

/// <summary>
/// Adds transaction processors which are invoked when creating a <see cref="Transaction"/>.
/// Adds transaction processors which are invoked when creating a <see cref="SentryTransaction"/>.
/// </summary>
/// <param name="options">The SentryOptions to hold the processor.</param>
/// <param name="processors">The transaction processors.</param>
Expand All @@ -295,7 +295,7 @@ public static void RemoveTransactionProcessor<TProcessor>(this SentryOptions opt
=> options.TransactionProcessors?.RemoveAll(processor => processor is TProcessor);

/// <summary>
/// Adds an transaction processor provider which is invoked when creating a <see cref="Transaction"/>.
/// Adds an transaction processor provider which is invoked when creating a <see cref="SentryTransaction"/>.
/// </summary>
/// <param name="options">The SentryOptions to hold the processor provider.</param>
/// <param name="processorProvider">The transaction processor provider.</param>
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/SentrySdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public static void CaptureUserFeedback(SentryId eventId, string email, string co
/// </remarks>
[DebuggerStepThrough]
[EditorBrowsable(EditorBrowsableState.Never)]
public static void CaptureTransaction(Transaction transaction)
public static void CaptureTransaction(SentryTransaction transaction)
=> CurrentHub.CaptureTransaction(transaction);

/// <summary>
Expand All @@ -502,7 +502,7 @@ public static void CaptureTransaction(Transaction transaction)
/// </remarks>
[DebuggerStepThrough]
[EditorBrowsable(EditorBrowsableState.Never)]
public static void CaptureTransaction(Transaction transaction, Scope? scope, Hint? hint)
public static void CaptureTransaction(SentryTransaction transaction, Scope? scope, Hint? hint)
=> CurrentHub.CaptureTransaction(transaction, scope, hint);

/// <summary>
Expand Down
Loading

0 comments on commit 2a41c48

Please sign in to comment.