Add Metrics for CompactionJobPriority Queues#3551
Conversation
Adds the following metrics for cjpq: * Number of Queues * Queue Size * Number of Queued Jobs * Number of Dequeued Jobs * Number of Rejected Jobs
fcbfe19 to
cc61007
Compare
Removed bad line of code that was left over from a poor merge conflict resolution
|
In general - why are the metric changes being testing in BulkNewIT? Would it be better if the test was a stand-alone test of the metrics? If a package does not exist, in may be desirable to have a metrics specific sub-package for metric IT tests so that they are easier to find? |
Applies feedback from PR review. * Changes metric registration to register via queue name, rather than by queue object. * * This helps avoid metric issues when the queues are created & deleted. * Removes unnessessary Atomic var for tracking queued Jobs. * Fixes naming scheme issues.
Switch from size test to looking up all metrics via queue ID.
I was testing this in BulkNewIT as I knew that the compaction operations would trigger and metrics would be generated. However, I need to add more deliberate tests for these metrics to ensure the gauges are being set to correct values. I'm not sure about how to best organize the metric tests so I'd be happy to discuss the best options there. |
Added formatting steps to formatString and included test class with string examples.
* Switched CompactionJobQueues to a Final * Cleaned up anonymous functions in the update method.
* Fixes the queue count metrics * Switches metric names to dot notation * Removes test changes from BulkNewIT * Adds CompactionPriorityQueueMetricsIT * Adds User defined CompactionResourceGroup override to MAC * Adds new Lowest Job Priority Metric
|
Currently the new test added in (CompactionPriorityQueueMetricsIT.java) fails when run. Also should all references to queue be swapped for compaction group? The jobs still do function in a queue structure. |
* Refactors IT test to create additional tablets and properly generate compaction jobs without having selected file collisions. * Adds configurable property to change CompactionQueue size and test rejectedJobs. See apache#3635 for more details. * Adds comparision checks in the IT to check metric values against known datapoints.
Discussed this with @keith-turner and discovered the issue was with my setup of the tablets and split points. Additional checks were added to validate specific metrics values. #3635 was also created to eventually replace a property that was added for setting a PriorityQueue's maxSize. |
* Removes unnecessary comments * Switches metric names to use `queue` vs `cjpq` * Adds final modifier to queueSize var
|
|
||
| boolean sawQueues = false; | ||
| // An empty queue means that the last known value is the most recent. | ||
| while (!queueMetrics.isEmpty()) { |
There was a problem hiding this comment.
Would it make sense to also check the dequeued count in this part of the test?
There was a problem hiding this comment.
I tried doing that, but the problem with dequeued is that once all the jobs are processed the queue is removed so dequeued returns 0.
Due to the 3 second polling rate, it's hard to identify that condition quickly enough in the test.
If we wanted to check dequeued jobs then that should be a separate test with a large queue size and a slow compaction (+1 second runtime per compaction)
| } | ||
|
|
||
| @Test | ||
| public void testQueueMetrics() throws Exception { |
There was a problem hiding this comment.
Would be nice to test metrics from multiple queues, just to ensure the data for queue is independent. Could be a follow in issue.
|
@ddanielr are you ready to merge this? |
|
Yes. I believe it's in a good state. |
…ction/queue/CompactionJobPriorityQueue.java
|
ok, I will merge if the build passes |
Adds the following metrics for cjpq to solve #3474:
This is using the Thread polling method of updating metric values.
Looking for feedback on metric naming & prefixes, and implementation.