Repository navigation
Add stats to KillUnusedSegments coordinator duty - #14782
Conversation
|
|
||
| private static final Logger LOG = new Logger(CompactSegments.class); | ||
|
|
||
| private static final Predicate<TaskStatusPlus> TASK_PREDICATE = |
There was a problem hiding this comment.
Can we name this COMPACTION_TASK_PREDICATE, or IS_COMPACTION_TASK?
| // the tasks of the unknown taskType as the killTask. This is because it's important to not run | ||
| // killTasks more than the configured limit at any time which might impact to the ingestion | ||
| // performance. | ||
| if (status.getType() == null || (taskPredicate.apply(status))) { |
There was a problem hiding this comment.
I observe something unclear in the null check here:
- First, we assume
statusis non-null because we deref status - The, we call predicate; predicate first checks if
statusis null (when it can never be because of deref/NPE) - Then we do comparison.
I think it would be good idea to clarify in Javadoc (and code) either one or the other situation
Predicate<TaskStatusPlus>predicate "must be able to accept null", OR, predicate "will never be called with null".
| { | ||
| public static final String KILL_TASK_TYPE = "kill"; | ||
| public static final String TASK_ID_PREFIX = "coordinator-issued"; | ||
| public static final Predicate<TaskStatusPlus> TASK_PREDICATE = |
There was a problem hiding this comment.
Similar here, I think we should give the name a more clear name, IS_KILL_TASK?
There was a problem hiding this comment.
If we choose to have a more specific name, I think it should say IS_AUTO_KILL_TASK instead of IS_KILL_TASK as the predicate excludes manual kill tasks
| final long currentTimeMillis = System.currentTimeMillis(); | ||
| if (CollectionUtils.isNullOrEmpty(dataSourcesToKill)) { | ||
| log.debug("No eligible datasource to kill unused segments."); | ||
| } else if (lastKillTime + period > currentTimeMillis) { |
There was a problem hiding this comment.
Should this check be pulled out earlier in the function; ie: we can avoid calculation altogether if the kill time was too recent. Not sure if I missed something.
| availableKillTaskSlots < dataSourcesToKill.size() | ||
| ? StringUtils.format( | ||
| " Datasources skipped: %s", | ||
| ImmutableList.copyOf(dataSourcesToKill).subList(submittedTasks, dataSourcesToKill.size()) |
There was a problem hiding this comment.
fwiw, I think this might need to be wrapped in an log.isDebug(), since the string format will likely be executed even if debug is not enabled.
jasonk000
left a comment
There was a problem hiding this comment.
swapping to request changes based on prior comments
suneet-s
left a comment
There was a problem hiding this comment.
Request changes for
- Remove the use of the constant TaskStats.EMPTY across coordinator runs
- Please add these new metrics to the metrics.md file, perhaps next to the
compactTask/*metrics as these are related
| { | ||
| public static final String KILL_TASK_TYPE = "kill"; | ||
| public static final String TASK_ID_PREFIX = "coordinator-issued"; | ||
| public static final Predicate<TaskStatusPlus> TASK_PREDICATE = |
There was a problem hiding this comment.
If we choose to have a more specific name, I think it should say IS_AUTO_KILL_TASK instead of IS_KILL_TASK as the predicate excludes manual kill tasks
Co-authored-by: Suneet Saldanha <suneet@apache.org>
…CoordinatorDutyUtils.java Co-authored-by: Suneet Saldanha <suneet@apache.org>
jasonk000
left a comment
There was a problem hiding this comment.
approved with a clarification/question
| } | ||
|
|
||
| if (lastKillTime + period > currentTimeMillis) { | ||
| log.debug("Skipping kill of unused segments as kill period has not elapsed yet."); |
There was a problem hiding this comment.
I'm not sure why we check this twice (above, at line 117-119). Is it because we want to capture stats?
suneet-s
left a comment
There was a problem hiding this comment.
LGTM with a suggestion on changing the metric names to match the auto-compaction metric naming scheme a little better
I think |
Co-authored-by: Suneet Saldanha <suneet@apache.org>
### Description Added the following metrics, which are calculated from the `KillUnusedSegments` coordinatorDuty `"killTask/availableSlot/count"`: calculates the number remaining task slots available for auto kill `"killTask/maxSlot/count"`: calculates the maximum number of tasks available for auto kill `"killTask/task/count"`: calculates the number of tasks submitted by auto kill. #### Release note NEW: metrics added for auto kill `"killTask/availableSlot/count"`: calculates the number remaining task slots available for auto kill `"killTask/maxSlot/count"`: calculates the maximum number of tasks available for auto kill `"killTask/task/count"`: calculates the number of tasks submitted by auto kill.
Description
Added the following metrics, which are calculated from the
KillUnusedSegmentscoordinatorDuty"killTask/availableSlot/count": calculates the number remaining task slots available for auto kill"killTask/maxSlot/count": calculates the maximum number of tasks available for auto kill"killTask/task/count": calculates the number of tasks submitted by auto kill.Release note
NEW: metrics added for auto kill
"killTask/availableSlot/count": calculates the number remaining task slots available for auto kill"killTask/maxSlot/count": calculates the maximum number of tasks available for auto kill"killTask/task/count": calculates the number of tasks submitted by auto kill.This PR has: