Grafana backend datasource plugin with streaming

Hi,

I am currently writing a Grafana backend datasource plugin. I have a requirement where while performing execution of my queries in the QueryData() method, I would want to set a value into a variable called IntervalSecs (integer) that I want to be available in the RunStream() method. Currently I am not able to see how I can set certain values in one method (like QueryData) and make the value available in another method (like RunStream) when streaming is enabled.

I tried to set the variable in the context of QueryData(ctx context.Context… and tried accessing it in context of RunStream(ctx context.Context … method but the variable is not visible in the context.

Any help on this is appreciated.

Thanks,
Siva

I got the solution. Since RunStream is a receiver function of Datasource, just specify the variable inside the the datasource struct and you can access it in RunStream method directly through the datasource reference.

Hi, Iam currently working on building a backend streaming plugin. able to create a backend datasource. Can you share the code on how I can add streaming to the plugin.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.