Skip to content

Commit

Permalink
improve handling thread names
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek committed Jan 9, 2025
1 parent accc6de commit b8464dd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/IntegrationTests/ContinuousProfilerContextTrackingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ public void TraceContextIsCorrectlyAssociatedWithThreadSamples()
private bool AssertAllProfiles(ICollection<ExportProfilesServiceRequest> profilesServiceRequests)
{
var totalSamplesWithTraceContextCount = 0;
var managedThreadsWithTraceContext = new HashSet<int>();
var managedThreadsWithTraceContext = new HashSet<string>();

foreach (var batch in profilesServiceRequests)
{
IEnumerable<Sample> samplesInBatch = batch
.ResourceProfiles
.SelectMany(rp => rp.ScopeProfiles)
.SelectMany(sp => sp.Profiles)
.SelectMany(p => p.Sample);
var profile = batch.ResourceProfiles.Single().ScopeProfiles.Single().Profiles.Single();

var samplesInBatch = profile.Sample;

var samplesWithTraceContext = samplesInBatch.Where(s => s.HasLinkIndex).ToList();

Expand All @@ -55,7 +53,7 @@ private bool AssertAllProfiles(ICollection<ExportProfilesServiceRequest> profile
totalSamplesWithTraceContextCount += samplesWithTraceContext.Count;
if (samplesWithTraceContext.FirstOrDefault() is { } sampleWithTraceContext)
{
managedThreadsWithTraceContext.Add(sampleWithTraceContext.AttributeIndices.Single());
managedThreadsWithTraceContext.Add(profile.AttributeTable[sampleWithTraceContext.AttributeIndices.Single()].Value.StringValue);
}
}

Expand Down

0 comments on commit b8464dd

Please sign in to comment.