improvement(go.d dyncfg): log collector dyncfg actions (#19672)
Ilya Mashchenko committed
Feb 18, 2025 at 14:18 UTC
bfdbf9750bb48cd18257e3bdf04463a09db656ff
1 file changed
+20
src/go/plugin/go.d/agent/jobmgr/dyncfg_collector.go
+20
@@ -178,6 +178,8 @@ func (m *Manager) dyncfgConfigTest(fn functions.Function) {
178
jn = fn.Args[2]
179
}
180
181
+ m.Infof("dyncfg: test: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
182
+
183
if err := validateJobName(jn); err != nil {
184
m.Warningf("dyncfg: test: module %s: unacceptable job name '%s': %v", mn, jn, err)
185
m.dyncfgRespf(fn, 400, "Unacceptable job name '%s': %v.", jn, err)
@@ -252,6 +254,8 @@ func (m *Manager) dyncfgConfigSchema(fn functions.Function) {
254
return
255
}
256
257
+ m.Infof("dyncfg: schema: %s module by user '%s'", mn, getFnSourceValue(fn, "user"))
258
+
259
if mod.JobConfigSchema == "" {
260
m.Warningf("dyncfg: schema: module %s: schema not found", mn)
261
m.dyncfgRespf(fn, 500, "Module %s configuration schema not found.", mn)
@@ -278,6 +282,8 @@ func (m *Manager) dyncfgConfigGet(fn functions.Function) {
282
return
283
}
284
285
+ m.Infof("dyncfg: get: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
286
+
287
ecfg, ok := m.exposedConfigs.lookupByName(mn, jn)
288
if !ok {
289
m.Warningf("dyncfg: get: module %s job %s not found", mn, jn)
@@ -346,6 +352,8 @@ func (m *Manager) dyncfgConfigRestart(fn functions.Function) {
352
default:
353
}
354
355
+ m.Infof("dyncfg: restart: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
356
+
357
if err := job.AutoDetection(); err != nil {
358
job.Cleanup()
359
ecfg.status = dyncfgFailed
@@ -407,6 +415,10 @@ func (m *Manager) dyncfgConfigEnable(fn functions.Function) {
415
return
416
}
417
418
+ if ecfg.status == dyncfgDisabled {
419
+ m.Infof("dyncfg: enable: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
420
+ }
421
+
422
if err := job.AutoDetection(); err != nil {
423
job.Cleanup()
424
ecfg.status = dyncfgFailed
@@ -475,6 +487,8 @@ func (m *Manager) dyncfgConfigDisable(fn functions.Function) {
487
default:
488
}
489
490
+ m.Infof("dyncfg: disable: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
491
+
492
ecfg.status = dyncfgDisabled
493
m.dyncfgRespf(fn, 200, "")
494
m.dyncfgJobStatus(ecfg.cfg, ecfg.status)
@@ -523,6 +537,8 @@ func (m *Manager) dyncfgConfigAdd(fn functions.Function) {
537
return
538
}
539
540
+ m.Infof("dyncfg: add: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
541
+
542
if ecfg, ok := m.exposedConfigs.lookup(cfg); ok {
543
if scfg, ok := m.seenConfigs.lookup(ecfg.cfg); ok && isDyncfg(scfg.cfg) {
544
m.seenConfigs.remove(ecfg.cfg)
@@ -562,6 +578,8 @@ func (m *Manager) dyncfgConfigRemove(fn functions.Function) {
578
return
579
}
580
581
+ m.Infof("dyncfg: remove: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
582
+
583
m.seenConfigs.remove(ecfg.cfg)
584
m.exposedConfigs.remove(ecfg.cfg)
585
m.stopRunningJob(ecfg.cfg.FullName())
@@ -618,6 +636,8 @@ func (m *Manager) dyncfgConfigUpdate(fn functions.Function) {
636
return
637
}
638
639
+ m.Infof("dyncfg: update: %s/%s job by user '%s'", mn, jn, getFnSourceValue(fn, "user"))
640
+
641
m.exposedConfigs.remove(ecfg.cfg)
642
m.stopRunningJob(ecfg.cfg.FullName())
643