python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 599 forks source link

"global name 'self' is not defined" in diamond/utils/scheduler.py #761

Closed mchx-mgruberman closed 2 years ago

mchx-mgruberman commented 2 years ago

We're currently seeing the following exception from collector using the latest diamond, likely the version we auto-deployed from the master branch after Wed Dec 29 03:03:46 UTC 2021 (the last timestamp in /var/log/diamond/archive.log).

Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/pymodules/python2.7/diamond/utils/scheduler.py", line 55, in collector_process
if str_to_bool(self.config['stagger_collection']):
NameError: global name 'self' is not defined

followed by an exit(1), detected from strace:

exit_group(1)

Per our chef install log, it looks like this broke when we installed the 0a9e17dbcfc66be8b2c37479b1a51ac7b16c4fd8 commit:

[2021-12-10T01:46:08+00:00] INFO: git[/usr/local/share/diamond_src] updated to revision e866d24071b11c42b369ef0869e504d5b5b153d3
[2021-12-15T02:46:26+00:00] INFO: git[/usr/local/share/diamond_src] updated to revision be0a43ec00dd006484c39d1bb6845db0f19d72d6
[2021-12-22T22:18:06+00:00] INFO: git[/usr/local/share/diamond_src] updated to revision 774284f92e89af0fb1879e8a38f64d7ff2618cf2   << still working
[2021-12-29T02:57:49+00:00] INFO: git[/usr/local/share/diamond_src] updated to revision 0a9e17dbcfc66be8b2c37479b1a51ac7b16c4fd8   << stacktrace
[2021-12-31T03:33:54+00:00] INFO: git[/usr/local/share/diamond_src] updated to revision 7000e16cfdf4508ed9291fc4b3800592557b2431
mattrobenolt commented 2 years ago

It looks like, unfortuantely 9 days ago, this was merged haphazardly: https://github.com/python-diamond/Diamond/pull/698

And doesn't work. cc @shortdudey123 @DStape

mattrobenolt commented 2 years ago

I left a comment on what I think the issue is: https://github.com/python-diamond/Diamond/pull/698/files#r779903486

But as I mentioned, I have 0 capacity to confirm this. I haven't used or touched Diamond in many years.

shortdudey123 commented 2 years ago

This should have been solved by #760 Reopen if not Closing . . .