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

Remove TracePropagationTarget #2763

Merged
merged 5 commits into from Nov 3, 2023
Merged

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Oct 26, 2023

Resolves #2666

Motivation

TracePropagationTarget currently doesn't add any functionality over/above SubstringOrRegexPattern, so there's no need to retain both of these:

[TypeConverter(typeof(TracePropagationTargetTypeConverter))]
public class TracePropagationTarget: SubstringOrRegexPattern
{
    public TracePropagationTarget(string substringOrRegexPattern, StringComparison comparison = StringComparison.OrdinalIgnoreCase)
        : base(substringOrRegexPattern, comparison)
    {
    }

    public TracePropagationTarget(Regex regex) : base (regex)
    {
    }
}

SubstringOrRegexPattern is the less specific type that is also used for FailedRequestTargets:

// The default failed request target list will match anything, but adding to the list should clear that.
private IList<SubstringOrRegexPattern> _failedRequestTargets = new AutoClearingList<SubstringOrRegexPattern>(
new[] { new SubstringOrRegexPattern(".*") }, clearOnNextAdd: true);

@jamescrosswell jamescrosswell linked an issue Oct 26, 2023 that may be closed by this pull request
@jamescrosswell jamescrosswell marked this pull request as ready for review October 26, 2023 08:23
@@ -1,60 +0,0 @@
namespace Sentry;

// TODO: Replace TracePropagationTarget with SubstringOrRegexPattern in next major version.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't really explain why.
This type at least from what its named is part of Sentry's protocol and easy to find in docs, etc.

It's getting removed just because it's 'the same as SubstringOrRegexPattern'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put some context in the PR description. I think the TracePropagationTargets property will still be easy enough to find and is well documented and having it's own type wouldn't make it any more usable:

/// <summary>
/// A customizable list of <see cref="SubstringOrRegexPattern"/> objects, each containing either a
/// substring or regular expression pattern that can be used to control which outgoing HTTP requests
/// will have the <c>sentry-trace</c> and <c>baggage</c> headers propagated, for purposes of distributed tracing.
/// The default value contains a single value of <c>.*</c>, which matches everything.
/// To disable propagation completely, clear this collection or set it to an empty collection.
/// </summary>
/// <seealso href="https://develop.sentry.dev/sdk/performance/#tracepropagationtargets"/>
/// <remarks>
/// Adding an item to the default list will clear the <c>.*</c> value automatically.
/// </remarks>
public IList<SubstringOrRegexPattern> TracePropagationTargets
{
// NOTE: During configuration binding, .NET 6 and lower used to just call Add on the existing item.
// .NET 7 changed this to call the setter with an array that already starts with the old value.
// We have to handle both cases.
get => _tracePropagationTargets;
set => _tracePropagationTargets = value.SetWithConfigBinding();
}

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@bitsandfoxes bitsandfoxes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bruno-garcia bruno-garcia merged commit 3ebfcb0 into feat/4.0.0 Nov 3, 2023
13 checks passed
@bruno-garcia bruno-garcia deleted the remove-tracepropagationtarget branch November 3, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace TracePropagationTarget with SubstringOrRegexPattern
3 participants