profiler: suppress errors if the profiler is stopped#2886
Merged
Conversation
BenchmarksBenchmark execution time: 2024-09-24 18:42:43 Comparing candidate commit bd99cda in PR branch Found 0 performance improvements and 1 performance regressions! Performance is the same for 58 metrics, 0 unstable metrics. scenario:BenchmarkInjectW3C-24
|
nsrip-dd
force-pushed
the
nick.ripley/fix-windows-metrics-profile-test
branch
from
September 24, 2024 17:31
8772c17 to
e398c9c
Compare
Contributor
Author
|
Kicking off a Windows run to test this: https://github.com/DataDog/dd-trace-go/actions/runs/11019312785 |
nsrip-dd
force-pushed
the
nick.ripley/fix-windows-metrics-profile-test
branch
from
September 24, 2024 17:51
e398c9c to
232e3d1
Compare
The fix in #2865 was intended to suppress spurious metrics profile errors when the profiler is stopped. It did so by relaxing the one-second duration constraint of the metrics profiler. However, the Windows system timer resolution is about 15 milliseconds (see https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers#controlling-timer-accuracy) This caused the metrics profile tests from #2865 to fail because the metrics profiler will likely be stopped in less than 15 milliseconds, meaning we'll see 0 duration between profile collection and log an error. This commit actually suppresses the error by checking whether the profiler was stopped (meaning interruptibleSleep was interrupted). If so, and if the metrics profiler returned an error, we instead return a sentinel error indicating that profiling was stopped. If we see that error, we just drop the profile and don't log an error. We won't upload the profile anyway. This way, we should only report an error from the metrics profiler if there is _actually_ a problem with the timer.
nsrip-dd
force-pushed
the
nick.ripley/fix-windows-metrics-profile-test
branch
from
September 24, 2024 17:58
232e3d1 to
bd99cda
Compare
nsrip-dd
marked this pull request as ready for review
September 24, 2024 18:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The fix in #2865 was intended to suppress spurious metrics profile
errors when the profiler is stopped. It did so by relaxing the
one-second duration constraint of the metrics profiler. However,
the Windows system timer resolution is about 15 milliseconds (see
https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers#controlling-timer-accuracy)
This caused the metrics profile tests from #2865 to fail because the
metrics profiler will likely be stopped in less than 15 milliseconds,
meaning we'll see 0 duration between profile collection and log an
error.
This commit actually suppresses the error by checking whether the
profiler was stopped (meaning interruptibleSleep was interrupted). If
so, and if the metrics profiler returned an error, we instead return a
sentinel error indicating that profiling was stopped. If we see that
error, we just drop the profile and don't log an error. We won't upload
the profile anyway. This way, we should only report an error from the
metrics profiler if there is actually a problem with the timer.
Motivation
Fix broken CI. Example failure: https://github.com/DataDog/dd-trace-go/actions/runs/11017364478/job/30595111862