diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2e69a5920..718501e868 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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))
diff --git a/src/Sentry/IEventLike.cs b/src/Sentry/IEventLike.cs
index 9992a99fc6..3a068f66e8 100644
--- a/src/Sentry/IEventLike.cs
+++ b/src/Sentry/IEventLike.cs
@@ -5,6 +5,11 @@ namespace Sentry;
///
public interface IEventLike : IHasBreadcrumbs, IHasTags, IHasExtra
{
+ ///
+ /// The release distribution of the application.
+ ///
+ public string? Distribution { get; set; }
+
///
/// Sentry level.
///
diff --git a/src/Sentry/Internal/Enricher.cs b/src/Sentry/Internal/Enricher.cs
index 8e59579a54..fd945e2eff 100644
--- a/src/Sentry/Internal/Enricher.cs
+++ b/src/Sentry/Internal/Enricher.cs
@@ -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();
diff --git a/src/Sentry/Internal/IHasDistribution.cs b/src/Sentry/Internal/IHasDistribution.cs
deleted file mode 100644
index 36c6309cea..0000000000
--- a/src/Sentry/Internal/IHasDistribution.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace Sentry.Internal;
-// NOTE: We only need this interface because IEventLike is public and thus we can't
-// add more properties without introducing a potentially breaking change.
-// TODO: Move the Distribution property to IEventLike in the next major release.
-
-internal interface IHasDistribution
-{
- ///
- /// The release distribution of the application.
- ///
- public string? Distribution { get; set; }
-}
-
-internal static class HasDistributionExtensions
-{
- internal static string? GetDistribution(this IEventLike obj) =>
- (obj as IHasDistribution)?.Distribution;
-
- internal static void WithDistribution(this IEventLike obj, Action action)
- {
- if (obj is IHasDistribution hasDistribution)
- {
- action.Invoke(hasDistribution);
- }
- }
-}
diff --git a/src/Sentry/Internal/NoOpTransaction.cs b/src/Sentry/Internal/NoOpTransaction.cs
index 92535847d2..b4354379a7 100644
--- a/src/Sentry/Internal/NoOpTransaction.cs
+++ b/src/Sentry/Internal/NoOpTransaction.cs
@@ -25,6 +25,12 @@ public bool? IsParentSampled
set { }
}
+ public string? Distribution
+ {
+ get => string.Empty;
+ set { }
+ }
+
public SentryLevel? Level
{
get => default;
diff --git a/src/Sentry/Scope.cs b/src/Sentry/Scope.cs
index f89b9db5f5..85a9cab8d9 100644
--- a/src/Sentry/Scope.cs
+++ b/src/Sentry/Scope.cs
@@ -11,7 +11,7 @@ namespace Sentry;
/// Scope data is sent together with any event captured
/// during the lifetime of the scope.
///
-public class Scope : IEventLike, IHasDistribution
+public class Scope : IEventLike
{
internal SentryOptions Options { get; }
@@ -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;
diff --git a/src/Sentry/SentryEvent.cs b/src/Sentry/SentryEvent.cs
index 31c8de2ea1..9742d6f030 100644
--- a/src/Sentry/SentryEvent.cs
+++ b/src/Sentry/SentryEvent.cs
@@ -11,7 +11,7 @@ namespace Sentry;
///
///
[DebuggerDisplay("{GetType().Name,nq}: {" + nameof(EventId) + ",nq}")]
-public sealed class SentryEvent : IEventLike, IJsonSerializable, IHasDistribution
+public sealed class SentryEvent : IEventLike, IJsonSerializable
{
private IDictionary? _modules;
diff --git a/src/Sentry/Transaction.cs b/src/Sentry/Transaction.cs
index 4ca09f3cdb..566b276eea 100644
--- a/src/Sentry/Transaction.cs
+++ b/src/Sentry/Transaction.cs
@@ -9,7 +9,7 @@ namespace Sentry;
///
/// Sentry performance transaction.
///
-public class Transaction : ITransactionData, IJsonSerializable, IHasDistribution, IHasTransactionNameSource, IHasMeasurements
+public class Transaction : ITransactionData, IJsonSerializable, IHasTransactionNameSource, IHasMeasurements
{
///
/// Transaction's event ID.
@@ -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;
diff --git a/src/Sentry/TransactionTracer.cs b/src/Sentry/TransactionTracer.cs
index 56f041949c..9b485477cb 100644
--- a/src/Sentry/TransactionTracer.cs
+++ b/src/Sentry/TransactionTracer.cs
@@ -7,7 +7,7 @@ namespace Sentry;
///
/// Transaction tracer.
///
-public class TransactionTracer : ITransaction, IHasDistribution, IHasTransactionNameSource, IHasMeasurements
+public class TransactionTracer : ITransaction, IHasTransactionNameSource, IHasMeasurements
{
private readonly IHub _hub;
private readonly SentryOptions? _options;