RUM-10140: Add BackPressured Dump information into Telemetry log#2673
Conversation
d794fd8 to
dca06d8
Compare
6ec1827 to
a16ecd0
Compare
a16ecd0 to
3a95dea
Compare
|
The PR is updated with some major changes:
|
| override fun run() { | ||
| runnable.run() | ||
| } |
There was a problem hiding this comment.
minor: can be a good use case for the delegate class NamedRunnable(name: String, private val runnable: Runnable): Runnable by runnable, then no need to declare it explicitly.
| - "java.util.concurrent.atomic.AtomicReference.set(io.opentracing.Tracer?)" | ||
| - "java.util.concurrent.atomic.AtomicReference.set(kotlin.Nothing?)" | ||
| - "java.util.concurrent.atomic.AtomicReference.set(kotlin.String?)" | ||
| - "java.util.concurrent.LinkedBlockingQueue.toArray()" |
There was a problem hiding this comment.
ah, super usage in the call is just for Detekt?
|
I discussed it with Yi already, but will duplicate here for everyone else. I have a concern that if the user calls methods of We copy 1024 items from the queue, then compute some Especially taking into account the customer case related to backpressure I found this morning. This needs to be checked, I am not entirely sure, but it looks a bit scary to me. |
Although the copy of the individual item should be cheap, it is just by reference. The main time-consumer here is the iteration over the items. It can be another approach: maintain statistics at the |
Looks good to me. Performance shouldn't change significantly, it doesn't look heavy. I didn't measure though, but looking at the code, it seems ok. |
For me a problem of this is that we have to listen all the functions which might cause the size change of the For me maybe copy the queue |
3a95dea to
68ba524
Compare
|
Latest PR update summary:
|
68ba524 to
21dc2e7
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2673 +/- ##
===========================================
+ Coverage 69.95% 70.00% +0.05%
===========================================
Files 820 822 +2
Lines 30657 30687 +30
Branches 5162 5168 +6
===========================================
+ Hits 21445 21481 +36
+ Misses 7769 7763 -6
Partials 1443 1443
🚀 New features to boost your workflow:
|
a1340fd to
7d272cb
Compare
bcdb1ef
7d272cb to
bcdb1ef
Compare
| import java.util.concurrent.TimeUnit | ||
| import java.util.concurrent.atomic.AtomicLong | ||
|
|
||
| internal open class ObservableBlockingQueue<E : Any>( |
There was a problem hiding this comment.
very minor suggestion
| internal open class ObservableBlockingQueue<E : Any>( | |
| internal open class ObservableLinkedBlockingQueue<E : Any>( |
| fun dumpQueue(): Map<String, Int>? { | ||
| val currentTime = currentTimeProvider.invoke() | ||
| val last = lastDumpTimestamp.get() | ||
| val timeSinceLastDump = currentTime - last | ||
| return if (timeSinceLastDump > DUMPING_TIME_INTERVAL_IN_MS) { | ||
| if (lastDumpTimestamp.compareAndSet(last, currentTime)) { | ||
| buildDumpMap() | ||
| } else { | ||
| null | ||
| } | ||
| } else { | ||
| null | ||
| } | ||
| } |
There was a problem hiding this comment.
maybe this logic should be on consumer side, because it creates some indeterministic behavior from the caller perspective, but I'm okay keeping it like that, because it is only for the internal use.
bcdb1ef to
3709b4f
Compare
| ) | ||
| @MockitoSettings(strictness = Strictness.LENIENT) | ||
| @ForgeConfiguration(Configurator::class) | ||
| class ObservableBlockingQueueTest { |
There was a problem hiding this comment.
this should be also renamed to ObservableLinkedBlockingQueueTest, but to avoid more PR updates let's keep it like that, it doesn't affect anything really.
What does this PR do?
More detailed context can be seen in the ticket.
This PR adds
NamedRunnablewrapper class to contain custom name for each runnable, so that inBackPressuredBlockingQueue, the name can be retrieved if needed.Also for Rum even processing, the operation name changes from "Rum event handling" to "Rum event handling StartAction" to specify the event type that rum-pipeline is handling.
Known issue:
When dumping the blocking queue we may not have the full dump result of the queue due to the concurrency, but my thought is that it's good enough to do the best effort of dumping instead of blocking the thread to have the perfect result.
Motivation
RUM-10140
Result of this PR
in
backpressure.dumpattribute, we will have the statistic of all the runnable names.Review checklist (to be filled by reviewers)