Skip to content

Commit

Permalink
Remove proactive sampling decision (#2764)
Browse files Browse the repository at this point in the history
* Remove proactive sampling decision

* Fix tests

* Update changelog
  • Loading branch information
rajkumar-rangaraj authored Apr 11, 2023
1 parent 3a54102 commit 1f553ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public void InitializeWithActivityWinsOverCallContext()
currentActivity.Stop();
}

[Ignore("ProactiveSamplingDecision is removed and won't work")]
[TestMethod]
public void InitializeWithActivityRecorded()
{
Expand All @@ -299,6 +300,7 @@ public void InitializeWithActivityRecorded()
currentActivity.Stop();
}

[Ignore("ProactiveSamplingDecision is removed and won't work")]
[TestMethod]
public void InitializeWithActivityRecordedOperationIdSet()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ private void ValidateTelemetry<T>(T telemetry, Activity activity, bool isW3C = t
Assert.IsFalse(telemetry.Properties.ContainsKey("tracestate"));
}

Assert.AreEqual(activity.Recorded ? SamplingDecision.SampledIn : SamplingDecision.None, (telemetry as ISupportAdvancedSampling).ProactiveSamplingDecision);
Assert.AreEqual(SamplingDecision.None, (telemetry as ISupportAdvancedSampling).ProactiveSamplingDecision);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ telemetryItem is OperationTelemetry &&
telemetryProp.Properties.Add(TracestatePropertyKey, currentActivity.TraceStateString);
}

// update proactive sampling decision if Activity is recorded
// sampling processor may change the decision
if (currentActivity.Recorded &&
telemetryItem is ISupportAdvancedSampling supportSamplingTelemetry &&
supportSamplingTelemetry.ProactiveSamplingDecision == SamplingDecision.None)
{
supportSamplingTelemetry.ProactiveSamplingDecision = SamplingDecision.SampledIn;
}

if (string.IsNullOrEmpty(itemOperationContext.Id))
{
if (currentActivity.IdFormat == ActivityIdFormat.W3C)
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## VNext

- [Fixed an adaptive sampling issue that caused incorrect item count when an `Activity` Recorded flags were modified externally, when enabled side-by-side with OpenTelemetry or other solutions.](https://github.com/microsoft/ApplicationInsights-dotnet/issues/2742)

## Version 2.22.0-beta2
- [Upgrade System.Diagnostics.PerformanceCounter to version 6.0.0 to address CVE-2021-24112](https://github.com/microsoft/ApplicationInsights-dotnet/pull/2707)
- [Report internal dependencies from Cosmos SDK as InProc and align with Cosmos SDK EventSource changes](https://github.com/microsoft/ApplicationInsights-dotnet/pull/2712)
Expand Down

0 comments on commit 1f553ad

Please sign in to comment.