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.