Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/4.0.0 deprecate IHasDistribution #2660

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:

- Removed IHasDistribution ([#2660](https://github.com/getsentry/sentry-dotnet/pull/2660))
jamescrosswell marked this conversation as resolved.
Show resolved Hide resolved

### 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