Skip to content

Commit f8ddb56

Browse files
committed
do not add multiple probes
1 parent 4d62a9f commit f8ddb56

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tracer/src/Datadog.Trace/Debugger/Sink/SnapshotExplorationTestSink.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ private sealed class ProbeReportWriter : IDisposable
5959
private const string _fileName = "SnapshotExplorationTestReport.csv";
6060
private readonly string _folderPath;
6161
private readonly BlockingCollection<IdAndSnapshot> _writeQueue;
62+
private readonly HashSet<string> _probesIds;
6263
private readonly Task _writerTask;
6364
private readonly CancellationTokenSource _cts;
6465
private readonly int _bufferSize;
@@ -69,6 +70,7 @@ public ProbeReportWriter(string folderPath, int bufferSize = 4096)
6970
_folderPath = folderPath ?? throw new ArgumentNullException(nameof(folderPath));
7071
_bufferSize = bufferSize;
7172
_writeQueue = new BlockingCollection<IdAndSnapshot>();
73+
_probesIds = new HashSet<string>();
7274
_cts = new CancellationTokenSource();
7375
_writerTask = Task.Run(WriteProcess, _cts.Token);
7476
}
@@ -109,6 +111,12 @@ private async Task WriteProcess()
109111
continue;
110112
}
111113

114+
if (!_probesIds.Add(info.Id))
115+
{
116+
// we have already got snapshot for this probe ID
117+
continue;
118+
}
119+
112120
var methodFullName = GetMethodFullName(info.Snapshot);
113121
var line = $"{info.Id},{methodFullName ?? "N/A"},{!string.IsNullOrEmpty(methodFullName)}";
114122
await writer.WriteLineAsync(line).ConfigureAwait(false);

0 commit comments

Comments
 (0)