RUM-9130: Fix flaky TraceWriterTest M log error and proceed W write() { serialization failed }#2565
Conversation
bb36104 to
31b362d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2565 +/- ##
===========================================
- Coverage 70.11% 70.10% -0.01%
===========================================
Files 803 803
Lines 30144 30146 +2
Branches 5046 5046
===========================================
- Hits 21135 21133 -2
+ Misses 7610 7607 -3
- Partials 1399 1406 +7
🚀 New features to boost your workflow:
|
| private fun generateSpanListWithPriorities(forge: Forge, priorities: Set<Int>): MutableList<DDSpan> { | ||
| return forge.aList { | ||
| SpanForgeryFactory { frg, span -> | ||
| span.samplingPriority = frg.anElementFrom(priorities) | ||
| }.getForgery(forge) | ||
| }.toMutableList() | ||
| } |
There was a problem hiding this comment.
it can be done simpler, without the need to do changes in SpanForgeryFactory (plus it can be an extension method):
| private fun generateSpanListWithPriorities(forge: Forge, priorities: Set<Int>): MutableList<DDSpan> { | |
| return forge.aList { | |
| SpanForgeryFactory { frg, span -> | |
| span.samplingPriority = frg.anElementFrom(priorities) | |
| }.getForgery(forge) | |
| }.toMutableList() | |
| } | |
| private fun Forge.spansWithPriorities(forge: Forge, priorities: Set<Int>): MutableList<DDSpan> { | |
| return aList { | |
| getForgery<DDSpan>().apply { span.samplingPriority = anElementFrom(priorities) } | |
| }.toMutableList() | |
| } |
but I'm okay with keeping the proposed change as well.
There was a problem hiding this comment.
it can be done simpler
I did it the way you describe at first. But this actually is a different solution that didn't quite work.
- Suppose
SpanForgeryFactorysetssamplingPrioritytoPrioritySampling.USER_DROPhere. - Then we change it the way you describe to
PrioritySampling.UNSET.PrioritySampling.UNSETsatisfies the condition!in DROP_SAMPLING_PRIORITIES, it was used in the test before, so we probably should not forget about it. - Here
PrioritySampling.UNSETis ignored. - We end up with a failed test because we have
PrioritySampling.USER_DROPas priority.
There was a problem hiding this comment.
okay, makes sense then for PrioritySampling.UNSET case
| private val KEEP_SAMPLING_PRIORITIES = setOf(PrioritySampling.SAMPLER_KEEP, PrioritySampling.USER_KEEP) | ||
| internal val KEEP_AND_UNSET_SAMPLING_PRIORITIES = KEEP_SAMPLING_PRIORITIES + PrioritySampling.UNSET |
There was a problem hiding this comment.
probably these are needed only for tests? maybe put them in the TraceWriterTest?
There was a problem hiding this comment.
I thought it is better this way because if you put KEEP_AND_UNSET_SAMPLING_PRIORITIES in test source set, when it is needed in the main source set later we will end up with duplicate code with very high chance. These things should probably be grouped together even if some are needed only in tests for now.
887d426
31b362d to
887d426
Compare
|
just resolved conflicts |
… { serialization failed }
887d426 to
7faab76
Compare
…-flacky-trace-writer-test
RUM-9130: Fix flaky TraceWriterTest M log error and proceed W write() { serialization failed }
What does this PR do?
Fixed a flaky test. Had to parametrize
SpanForgeryFactoryin order to control forging thesamplingPriorityfield. I am not sure it is a canonical way of doing things so feel free to criticize.Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)