Skip to content

Commit

Permalink
Removed IHasDistribution and added Distrubution to IEventLike instead (
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrosswell authored Sep 26, 2023
1 parent 3efc18f commit 56e5b06
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 33 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ without native/platform specific bindings and SDKs. See [this ticket for more de

- Drop .NET 6 Mobile in favor of .NET 7 ([#2624](https://github.com/getsentry/sentry-dotnet/pull/2604))

API Changes:

- Adding `Distribution` to `IEventLike` ([#2660](https://github.com/getsentry/sentry-dotnet/pull/2660))

### Features

- Sentry tracing middleware now gets configured automatically ([#2602](https://github.com/getsentry/sentry-dotnet/pull/2602))
Expand Down
5 changes: 5 additions & 0 deletions src/Sentry/IEventLike.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ namespace Sentry;
/// </summary>
public interface IEventLike : IHasBreadcrumbs, IHasTags, IHasExtra
{
/// <summary>
/// The release distribution of the application.
/// </summary>
public string? Distribution { get; set; }

/// <summary>
/// Sentry level.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Internal/Enricher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void Apply(IEventLike eventLike)
eventLike.Release ??= _options.SettingLocator.GetRelease();

// Distribution
eventLike.WithDistribution(_ => _.Distribution ??= _options.Distribution);
eventLike.Distribution ??= _options.Distribution;

// Environment
eventLike.Environment ??= _options.SettingLocator.GetEnvironment();
Expand Down
26 changes: 0 additions & 26 deletions src/Sentry/Internal/IHasDistribution.cs

This file was deleted.

6 changes: 6 additions & 0 deletions src/Sentry/Internal/NoOpTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public bool? IsParentSampled
set { }
}

public string? Distribution
{
get => string.Empty;
set { }
}

public SentryLevel? Level
{
get => default;
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Sentry;
/// Scope data is sent together with any event captured
/// during the lifetime of the scope.
/// </remarks>
public class Scope : IEventLike, IHasDistribution
public class Scope : IEventLike
{
internal SentryOptions Options { get; }

Expand Down Expand Up @@ -435,7 +435,7 @@ public void Apply(IEventLike other)

other.Platform ??= Platform;
other.Release ??= Release;
other.WithDistribution(_ => _.Distribution ??= Distribution);
other.Distribution ??= Distribution;
other.Environment ??= Environment;
other.TransactionName ??= TransactionName;
other.Level ??= Level;
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/SentryEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Sentry;
/// </summary>
/// <seealso href="https://develop.sentry.dev/sdk/event-payloads/" />
[DebuggerDisplay("{GetType().Name,nq}: {" + nameof(EventId) + ",nq}")]
public sealed class SentryEvent : IEventLike, IJsonSerializable, IHasDistribution
public sealed class SentryEvent : IEventLike, IJsonSerializable
{
private IDictionary<string, string>? _modules;

Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Sentry;
/// <summary>
/// Sentry performance transaction.
/// </summary>
public class Transaction : ITransactionData, IJsonSerializable, IHasDistribution, IHasTransactionNameSource, IHasMeasurements
public class Transaction : ITransactionData, IJsonSerializable, IHasTransactionNameSource, IHasMeasurements
{
/// <summary>
/// Transaction's event ID.
Expand Down Expand Up @@ -244,7 +244,7 @@ public Transaction(ITransaction tracer)
Operation = tracer.Operation;
Platform = tracer.Platform;
Release = tracer.Release;
Distribution = tracer.GetDistribution();
Distribution = tracer.Distribution;
StartTimestamp = tracer.StartTimestamp;
EndTimestamp = tracer.EndTimestamp;
Description = tracer.Description;
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/TransactionTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Sentry;
/// <summary>
/// Transaction tracer.
/// </summary>
public class TransactionTracer : ITransaction, IHasDistribution, IHasTransactionNameSource, IHasMeasurements
public class TransactionTracer : ITransaction, IHasTransactionNameSource, IHasMeasurements
{
private readonly IHub _hub;
private readonly SentryOptions? _options;
Expand Down

0 comments on commit 56e5b06

Please sign in to comment.