cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom plugin stopped working - Spring boot

Bert_VanderHeyd
Advisor

Recently a custom plugin I wrote did not work anymore.
It is a oneagent plugin written for a specific Spring boot application which does not activate anymore. I guess something has changed.

What I already saw is that recently the name changed from the process group. It used to be someting like scheduler....jar (name of the standalone jar file) and now it is:
"SpringBoot **.****.scheduler.SchedulerApplication (dev)"

So, I already modified the plugin.json to:

"processTypeNames": ["TOMCAT"]
...
"activation_name_pattern": "^SpringBoot be\\.inburgering\\.scheduler.SchedulerApplication.*$"

According to the latest docs it looks to the process_instance name.

And I am not sure about "TOMCAT" as processType. My previous version which worked used "JAVA"


1 REPLY 1

Bert_VanderHeyd
Advisor

I found it...
Reason was indeed the process group name change.

following is working for me:

"name": "custom.python.***-scheduler-plugin", 
"version": "1.6.17", 
"type": "python", 
"entity": "PROCESS_GROUP_INSTANCE", 
"processTypeNames": ["JAVA"], 
"source": { 
"package": "***_plugin", 
"className": "***SchedulerPlugin", 
"install_requires": [   "requests>=2.6.0"  ], 
"activation": "Singleton", 
"activation_name_pattern": "^.*scheduler.*$" 
},
...

processTypeNames is indeed JAVA in stead of tomcat and for the activation_name_pattern it looks at the process group name. This information can be found in the pluginDevLoggerPluginEngineDefault.log. It may be a good idea to explain this a bit better in the documentation. It took me some time to find it.

...ProcessSnapshotEntry(group_id=17701666967535205482, node_id=0, group_instance_id=11233226343147840351, process_type=10, group_name='SpringBoot be.inburgering.scheduler.SchedulerApplication (dev)', ... 

But the main issue was in the Python script itself where I took the pgi by name. Since the name was changed, because of the new "Spring boot" support (which I like a lot), it did not find a process instance.

So I replaced it with:

pgi = self.find_single_process_group(lambda pgi: pgi.group_name.startswith('SpringBoot be.inburgering.scheduler.SchedulerApplication'))

Note that I can't use the pgi_name function anymore because that does an "equals" and the name now includes the spring.profiles.active at the end.