in apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskExecutionService.java [199:255]
private CheckResult checkProfileTaskSuccess(ProfileTask task) {
// endpoint name
if (StringUtil.isEmpty(task.getFirstSpanOPName())) {
return new CheckResult(false, "endpoint name cannot be empty");
}
// duration
if (task.getDuration() < ProfileConstants.TASK_DURATION_MIN_MINUTE) {
return new CheckResult(
false, "monitor duration must greater than " + ProfileConstants.TASK_DURATION_MIN_MINUTE + " minutes");
}
if (task.getDuration() > ProfileConstants.TASK_DURATION_MAX_MINUTE) {
return new CheckResult(
false,
"The duration of the monitoring task cannot be greater than " + ProfileConstants.TASK_DURATION_MAX_MINUTE + " minutes"
);
}
// min duration threshold
if (task.getMinDurationThreshold() < 0) {
return new CheckResult(false, "min duration threshold must greater than or equals zero");
}
// dump period
if (task.getThreadDumpPeriod() < ProfileConstants.TASK_DUMP_PERIOD_MIN_MILLIS) {
return new CheckResult(
false,
"dump period must be greater than or equals " + ProfileConstants.TASK_DUMP_PERIOD_MIN_MILLIS + " milliseconds"
);
}
// max sampling count
if (task.getMaxSamplingCount() <= 0) {
return new CheckResult(false, "max sampling count must greater than zero");
}
if (task.getMaxSamplingCount() >= ProfileConstants.TASK_MAX_SAMPLING_COUNT) {
return new CheckResult(
false, "max sampling count must less than " + ProfileConstants.TASK_MAX_SAMPLING_COUNT);
}
// check task queue, check only one task in a certain time
long taskProcessFinishTime = calcProfileTaskFinishTime(task);
for (ProfileTask profileTask : profileTaskList) {
// if the end time of the task to be added is during the execution of any data, means is a error data
if (taskProcessFinishTime >= profileTask.getStartTime() && taskProcessFinishTime <= calcProfileTaskFinishTime(
profileTask)) {
return new CheckResult(
false,
"there already have processing task in time range, could not add a new task again. processing task monitor endpoint name: "
+ profileTask.getFirstSpanOPName()
);
}
}
return new CheckResult(true, null);
}