Add checker for passing correct sampling decision for xray (#1355)
* Add checker for passing correct sampling decision when apply xray id generator. * Added comment * Update comments. * Update links. * Updated CHANGELOG.md * Fixed the typo and lining * Moved check inline. Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
This commit is contained in:
parent
9b60e1fe8f
commit
b17278f691
|
|
@ -19,6 +19,9 @@
|
|||
for Activity.Recorded in SimpleActivityExportProcessor and
|
||||
BatchActivityExportProcessor
|
||||
([#1622](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1622))
|
||||
* Added check in `ActivitySourceAdapter` class for root activity if traceid is
|
||||
overridden by calling `SetParentId`
|
||||
([#1355](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1355))
|
||||
|
||||
## 1.0.0-rc1.1
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,10 @@ namespace OpenTelemetry.Trace
|
|||
private void RunGetRequestedDataOtherSampler(Activity activity)
|
||||
{
|
||||
ActivityContext parentContext;
|
||||
if (string.IsNullOrEmpty(activity.ParentId))
|
||||
|
||||
// Check activity.ParentId alone is sufficient to normally determine if a activity is root or not. But if one uses activity.SetParentId to override the TraceId (without intending to set an actual parent), then additional check of parentspanid being empty is required to confirm if an activity is root or not.
|
||||
// This checker can be removed, once Activity exposes an API to customize ID Generation (https://github.com/dotnet/runtime/issues/46704) or issue https://github.com/dotnet/runtime/issues/46706 is addressed.
|
||||
if (string.IsNullOrEmpty(activity.ParentId) || activity.ParentSpanId.ToHexString() == "0000000000000000")
|
||||
{
|
||||
parentContext = default;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue