I am attempting to write a Grafana backend plugin in C++. I am doing this in order to integrate with a custom tool (called "lighthouse") that has a C++ API. I created a C++ gRPC application that implements the Grafana plugin protocol as this documentation suggests.
My question is this: how are the connection settings, the gRPC server port for instance, communicated between the main Grafana process and the backend plugin. I was expecting to be able to specify the connection string or port number in the plugin.json
configuration file but it doesn't appear that there is any such field.
I installed my plugin and attempted to load it. It didn't work, of course, but gave me this log output:
logger=plugin.loader t=2023-01-11T11:58:25.984652862Z level=debug msg="Loading plugin" path=/var/lib/grafana/plugins/lighthouse-datasource/plugin.json
logger=plugin.loader t=2023-01-11T11:58:25.984878566Z level=debug msg="Plugin is unsigned" id=lighthouse-datasource
logger=plugin.signature.validator t=2023-01-11T11:58:25.984904895Z level=warn msg="Permitting unsigned plugin. This is not recommended" pluginID=lighthouse-datasource pluginDir=/var/lib/grafana/plugins/lighthouse-datasource
logger=plugin.loader t=2023-01-11T11:58:25.984925224Z level=info msg="Plugin registered" pluginID=lighthouse-datasource
logger=plugin.lighthouse-datasource t=2023-01-11T11:58:25.984963175Z level=debug msg="starting plugin" path=/var/lib/grafana/plugins/lighthouse-datasource/lighthouse_backend_linux_amd64 args=[/var/lib/grafana/plugins/lighthouse-datasource/lighthouse_backend_linux_amd64]
logger=plugin.lighthouse-datasource t=2023-01-11T11:58:25.985195211Z level=debug msg="plugin started" path=/var/lib/grafana/plugins/lighthouse-datasource/lighthouse_backend_linux_amd64 pid=7065
logger=plugin.lighthouse-datasource t=2023-01-11T11:58:25.98523206Z level=debug msg="waiting for RPC address" path=/var/lib/grafana/plugins/lighthouse-datasource/lighthouse_backend_linux_amd64
logger=plugin.loader t=2023-01-11T11:59:31.176451438Z level=error msg="Could not start plugin" pluginId=lighthouse-datasource err="timeout while waiting for plugin to start"
logger=plugin.lighthouse-datasource t=2023-01-11T11:59:31.177010088Z level=debug msg="plugin process exited" path=/var/lib/grafana/plugins/lighthouse-datasource/lighthouse_backend_linux_amd64 pid=7065 error="signal: killed"
The message msg="waiting for RPC address"
suggests that the Grafana process is waiting for something, perhaps the plugin itself, to provide the gRPC address. If this interpretation is correct, how is the plugin supposed to provide this information?