sentry-docs
sentry-docs copied to clipboard
Aspnetcore Setting a Sampling Function docs incorret key value
Core or SDK?
Platform/SDK
Which part? Which one?
Aspnetcore
Description
In the Aspnetcore "Setting a Sampling Function" docs example script is not working, looks like key value "url" changed to "__HttpPath"
document page: https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/configuration/sampling/#setting-a-sampling-function
I'm trying send a pull request but I could not found that page in this repo.
Suggested Solution
Change
context.CustomSamplingContext.GetValueOrDefault("url")
to
context.CustomSamplingContext.GetValueOrDefault("__HttpPath")
Thanks for raising. The snippets are here: https://github.com/getsentry/sentry-docs/tree/master/src/includes We'd appreciate a PR
Actually, it looks like the example doc referenced is showing custom context information. The build in one is available with just context.TryGetHttpPath().
The docs could still be a little clearer about this.
@lucas-zimerman - want to improve this doc if you have some time?
Will do :)
See https://github.com/getsentry/sentry-dotnet/blob/3e77b2d9d0c2c246f7fb309de2571eccb6c82e0d/src/Sentry.AspNetCore/SamplingExtensions.cs
Actually, it looks like the example doc referenced is showing custom context information. The build in one is available with just
context.TryGetHttpPath().The docs could still be a little clearer about this.
Thing is, TryGetHttpPath is only available on Asp.NET where the mentioned doc is shared across all .NET targets
Maybe mention TryGetHttpPath if using with ASP.NET Core, otherwise the longer method.
I see. Yeah - no need to split the docs up. Just put them both in the same example with a comment such as // assuming ASP.NET Core on one and // or from your own custom data on the other.
@bruno-garcia could you close this Issue?