Skip to content

Commit

Permalink
hotfix(keystone): send queue metrics from worker process only (#5482)
Browse files Browse the repository at this point in the history
* hotfix(keystone): send queue metrics from worker process only

* hotfix(address-service): add migration after kmigrator module changes

* hotfix(condorb): add missing migration

* hotfix(dev-api): add missing migration

* hotfix(condorb): add missing migration
  • Loading branch information
sitozzz authored Nov 14, 2024
1 parent d7a1210 commit fb31fc4
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// auto generated by kmigrator
// KMIGRATOR:0004_alter_addresshistoryrecord_history_action_and_more:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDQuMCBvbiAyMDI0LTExLTE0IDA3OjA3Cgpmcm9tIGRqYW5nby5kYiBpbXBvcnQgbWlncmF0aW9ucywgbW9kZWxzCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvbnMuTWlncmF0aW9uKToKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICAgICAgKCdfZGphbmdvX3NjaGVtYScsICcwMDAzX2FkZHJlc3Nfb3ZlcnJpZGVzX2FkZHJlc3NoaXN0b3J5cmVjb3JkX292ZXJyaWRlcycpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdhZGRyZXNzaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnlfYWN0aW9uJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkNoYXJGaWVsZChtYXhfbGVuZ3RoPTUwKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nYWRkcmVzc2luamVjdGlvbmhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5X2FjdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5DaGFyRmllbGQobWF4X2xlbmd0aD01MCksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J2FkZHJlc3Nzb3VyY2VoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeV9hY3Rpb24nLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQ2hhckZpZWxkKG1heF9sZW5ndGg9NTApLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyaGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnlfYWN0aW9uJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkNoYXJGaWVsZChtYXhfbGVuZ3RoPTUwKSwKICAgICAgICApLAogICAgXQo=

exports.up = async (knex) => {
await knex.raw(`
BEGIN;
--
-- Alter field history_action on addresshistoryrecord
--
--
-- Alter field history_action on addressinjectionhistoryrecord
--
--
-- Alter field history_action on addresssourcehistoryrecord
--
--
-- Alter field history_action on userhistoryrecord
--
COMMIT;
`)
}

exports.down = async (knex) => {
await knex.raw(`
BEGIN;
--
-- Alter field history_action on userhistoryrecord
--
--
-- Alter field history_action on addresssourcehistoryrecord
--
--
-- Alter field history_action on addressinjectionhistoryrecord
--
--
-- Alter field history_action on addresshistoryrecord
--
COMMIT;
`)
}
2 changes: 1 addition & 1 deletion apps/condorb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// auto generated by kmigrator
// KMIGRATOR:0005_alter_b2cappaccessright_environment_and_more:IyBHZW5lcmF0ZWQgYnkgRGphbmdvIDQuMCBvbiAyMDI0LTExLTE0IDA3OjE0Cgpmcm9tIGRqYW5nby5kYiBpbXBvcnQgbWlncmF0aW9ucywgbW9kZWxzCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvb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TApLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdiMmNhcHBwdWJsaXNocmVxdWVzdGhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5X2FjdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5DaGFyRmllbGQobWF4X2xlbmd0aD01MCksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J2NvbmZpcm1lbWFpbGFjdGlvbmhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5X2FjdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5DaGFyRmllbGQobWF4X2xlbmd0aD01MCksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J2NvbmZpcm1waG9uZWFjdGlvbmhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5X2FjdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5DaGFyRmllbGQobWF4X2xlbmd0aD01MCksCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFsdGVyRmllbGQoCiAgICAgICAgICAgIG1vZGVsX25hbWU9J3VzZXJoaXN0b3J5cmVjb3JkJywKICAgICAgICAgICAgbmFtZT0naGlzdG9yeV9hY3Rpb24nLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuQ2hhckZpZWxkKG1heF9sZW5ndGg9NTApLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BbHRlckZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd3ZWJob29raGlzdG9yeXJlY29yZCcsCiAgICAgICAgICAgIG5hbWU9J2hpc3RvcnlfYWN0aW9uJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkNoYXJGaWVsZChtYXhfbGVuZ3RoPTUwKSwKICAgICAgICApLAogICAgICAgIG1pZ3JhdGlvbnMuQWx0ZXJGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0nd2ViaG9va3N1YnNjcmlwdGlvbmhpc3RvcnlyZWNvcmQnLAogICAgICAgICAgICBuYW1lPSdoaXN0b3J5X2FjdGlvbicsCiAgICAgICAgICAgIGZpZWxkPW1vZGVscy5DaGFyRmllbGQobWF4X2xlbmd0aD01MCksCiAgICAgICAgKSwKICAgIF0K

exports.up = async (knex) => {
await knex.raw(`
BEGIN;
--
-- Alter field environment on b2cappaccessright
--
--
-- Alter field history_action on b2cappaccessrighthistoryrecord
--
--
-- Alter field history_action on b2cappbuildhistoryrecord
--
--
-- Alter field history_action on b2capphistoryrecord
--
--
-- Alter field history_action on b2capppublishrequesthistoryrecord
--
--
-- Alter field history_action on confirmemailactionhistoryrecord
--
--
-- Alter field history_action on confirmphoneactionhistoryrecord
--
--
-- Alter field history_action on userhistoryrecord
--
--
-- Alter field history_action on webhookhistoryrecord
--
--
-- Alter field history_action on webhooksubscriptionhistoryrecord
--
COMMIT;
`)
}

exports.down = async (knex) => {
await knex.raw(`
BEGIN;
--
-- Alter field history_action on webhooksubscriptionhistoryrecord
--
--
-- Alter field history_action on webhookhistoryrecord
--
--
-- Alter field history_action on userhistoryrecord
--
--
-- Alter field history_action on confirmphoneactionhistoryrecord
--
--
-- Alter field history_action on confirmemailactionhistoryrecord
--
--
-- Alter field history_action on b2capppublishrequesthistoryrecord
--
--
-- Alter field history_action on b2capphistoryrecord
--
--
-- Alter field history_action on b2cappbuildhistoryrecord
--
--
-- Alter field history_action on b2cappaccessrighthistoryrecord
--
--
-- Alter field environment on b2cappaccessright
--
COMMIT;
`)
}
2 changes: 1 addition & 1 deletion packages/keystone/KSv5v6/v5/prepareKeystone.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const sendAppMetrics = () => {
metrics.gauge({ name: 'processMemoryUsage.rss', value: memUsage.rss })
metrics.gauge({ name: 'processMemoryUsage.external', value: memUsage.external })

if (taskQueues.size > 0) {
if (IS_WORKER_PROCESS && taskQueues.size > 0) {
Array.from(taskQueues.entries()).forEach(([queueName, queue]) => {
queue.getJobCounts().then(jobCounts => {
metrics.gauge({ name: `worker.${queueName}.activeTasks`, value: jobCounts.active })
Expand Down

0 comments on commit fb31fc4

Please sign in to comment.