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

Can't create BaggageHeader for SentrySdk.ContinueTrace(), it's not public #2597

Closed
j2ghz opened this issue Sep 6, 2023 · 5 comments · Fixed by #2601
Closed

Can't create BaggageHeader for SentrySdk.ContinueTrace(), it's not public #2597

j2ghz opened this issue Sep 6, 2023 · 5 comments · Fixed by #2601
Labels
Bug Something isn't working

Comments

@j2ghz
Copy link

j2ghz commented Sep 6, 2023

Package

Sentry

.NET Flavor

.NET Core

.NET Version

7.0.0

OS

Windows

SDK Version

3.36.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

  • Try using SentrySdk.ContinueTrace(), where the second parameter is BaggageHeader
  • See that there's no way to create an instance of BaggageHeader

Expected Result

I expect that BaggageHeader should have a public contructor or a public Parse/TryParse method

Actual Result

BaggageHeader doesn't have any public methods or constructors (expect an instance .ToString() method)
See: https://github.com/getsentry/sentry-dotnet/blob/3.36.0/src/Sentry/BaggageHeader.cs

@j2ghz j2ghz added Bug Something isn't working Platform: .NET labels Sep 6, 2023
@bitsandfoxes
Copy link
Contributor

Thanks for raising this. Fair point. That's an oversight but I'm not sure how to proceed here yet.

I'd like to avoid making the HttpContextExtensions methods public. I think we should rather provide overloads to the ContinueTrace to consume the headers more generically i.e. letting the SDK extract them from the System.Web.HttpContext and Microsoft.AspNetCore.Http.

@j2ghz
Copy link
Author

j2ghz commented Sep 6, 2023

i.e. letting the SDK extract them from the System.Web.HttpContext and Microsoft.AspNetCore.Http.

I don't think that would help in my case, because I'm trying to set up tracing for a transport that isn't HTTP (in my case it's Service Fabric TCP transport). I took inspiration from https://github.com/getsentry/sentry-dotnet/blob/3.36.0/src/Sentry.AspNetCore/SentryTracingMiddleware.cs, and on the transmitting side I can use BaggageHeader.ToString(), but there's nothing available on the receiving side. For comparison, SentryTraceHeader.Parse is public.

@bitsandfoxes
Copy link
Contributor

Thanks for the additional input! We're going to add an overload to the ContinueTrace that accepts the headers as strings.

@bruno-garcia
Copy link
Member

@j2ghz did this change resolve it for you? #2601

@j2ghz
Copy link
Author

j2ghz commented Sep 28, 2023

@bruno-garcia I haven't gotten around to testing it, but it sounds like it should be exactly what I needed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants