Trend the gateway thread count

I want to create a ignition tag that historizes the gateway thread count.


Is there a way of doing this without doing thread dumps, something lighter.

I am trying to find a bug that causes the thread count of the gateway to exponentially increase which leads to a crash.

The issue is it happens randomly. Gateway will be stable for a few days and then this issue will occur.

I have logging on all my scripts but need to find the exact time the thread count increases massively.

Thanks,

Call this function and get it into a tag however you want:

def getThreadCount():
	from java.lang.management import ManagementFactory

	threadMxBean = ManagementFactory.getThreadMXBean()
	return threadMxBean.getThreadCount()
2 Likes