Debugging Grafana Backend Plugin

Hi,

I’m new to Grafana development and would like to learn how to develop backend plugins as described in
https://grafana.com/docs/grafana/latest/plugins/developing/backend-plugins-guide/. I started to have a deeper look into the simple json backend datasource plugin (https://github.com/grafana/simple-json-backend-datasource), and now I’m wondering how debug the GO coding with a debugger provided by VSCode or IntelliJ GoLand. As far as I understand, the plugin is registered with the Grafana server which starts the plugin backend code. Do I have to run the Grafana server in the IDE in order to debug backend plugin code or is there any other way to observe plugin execution inside a debugger?

Thanks and best regards!

This tutorial hasn’t been published yet but in this PR, it describes how to set up debugging:

1 Like

Thanks, for the link. I’ll check and hope that I’ll be able to debug.

Hello folks,

It would be nice to have this covered step by step. I’m also trying to get clues to get it work.

As I see it is planned to be documented soon https://github.com/grafana/grafana/pull/26851

Right now backend.Logger.Debug looks a only one best option for me.

Regards,
V.

Hi, as I came across this also during my search, I would like to add that mage debugger is available in the meantime.

Hi @stephenking,

How can one attach grafana to the plugin that is running in debug(ger) mode?
In other words, what is the next step after running mage -v debugger?

Hi, hope my blog post helps you: Grafana Plugin Debugging on Apple Silicon – Steffen Gebert