Skip to content

Commit

Permalink
fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Dec 18, 2023
1 parent ce98216 commit e3b0d8d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Sentry.Profiling/Downsampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
internal class Downsampler
{
private static double _samplingRateMs = (double)1_000 / 101; // 101 Hz
private double _samplingGapMs = _samplingRateMs * 0.9;

// Maps from ThreadIndex to the last sample timestamp for that thread.
private GrowableArray<double> _prevThreadSamples = new(10);
Expand All @@ -17,7 +16,7 @@ public void NewThreadAdded(int threadIndex)
if (threadIndex >= _prevThreadSamples.Count)
{
_prevThreadSamples.Count = threadIndex + 1;
_prevThreadSamples[threadIndex] = Double.MinValue;
_prevThreadSamples[threadIndex] = double.MinValue;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Profiling/SampleProfileBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SampleProfileBuilder(SentryOptions options, TraceLog traceLog)
internal void AddSample(TraceEvent data, double timestampMs)
{
var thread = data.Thread();
if (thread.ThreadIndex == ThreadIndex.Invalid)
if (thread is null || thread.ThreadIndex == ThreadIndex.Invalid)
{
_options.DiagnosticLogger?.LogDebug("Encountered a Profiler Sample without a correct thread. Skipping.");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SamplingTransactionProfilerTests
private readonly TestOutputDiagnosticLogger _testOutputLogger;
private readonly SentryOptions _testSentryOptions;

private int RuntimeMs => TestEnvironment.IsGitHubActions ? 20_000 : 300;
private int RuntimeMs => TestEnvironment.IsGitHubActions ? 5_000 : 300;

public SamplingTransactionProfilerTests(ITestOutputHelper output)
{
Expand Down

0 comments on commit e3b0d8d

Please sign in to comment.