summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2022-05-13 19:53:57 +0300
committerGitHub <noreply@github.com>2022-05-13 19:53:57 +0300
commit41e02576aa1bff63074f84c589f8c9769a4bc5d1 (patch)
tree1b916e4dedb18a9cc3730f852db49d54317c1dae /libnetdata
parent9effbee01f4057eb8f90b3b1e37f4c7f97cbad35 (diff)
chore(worker_utilization): log an error when re-registering an already registered job (#12903)
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/worker_utilization/worker_utilization.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libnetdata/worker_utilization/worker_utilization.c b/libnetdata/worker_utilization/worker_utilization.c
index 160a4f6550..992852e91d 100644
--- a/libnetdata/worker_utilization/worker_utilization.c
+++ b/libnetdata/worker_utilization/worker_utilization.c
@@ -69,6 +69,10 @@ void worker_register_job_name(size_t job_id, const char *name) {
error("WORKER_UTILIZATION: job_id %zu is too big. Max is %zu", job_id, (size_t)(WORKER_UTILIZATION_MAX_JOB_TYPES - 1));
return;
}
+ if (worker->per_job_type[job_id].name && *worker->per_job_type[job_id].name) {
+ error("WORKER_UTILIZATION: duplicate job registration: worker '%s' job id %zu is '%s', ignoring '%s'", worker->workname, job_id, worker->per_job_type[job_id].name, name);
+ return;
+ }
strncpy(worker->per_job_type[job_id].name, name, WORKER_UTILIZATION_MAX_JOB_NAME_LENGTH);
}