Browse Source

backend plugins: expose meta field

Alexander Zobnin 7 years ago
parent
commit
4533f22871
1 changed files with 6 additions and 0 deletions
  1. 6 0
      pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go

+ 6 - 0
pkg/plugins/datasource/wrapper/datasource_plugin_wrapper.go

@@ -6,6 +6,7 @@ import (
 	"fmt"
 
 	"github.com/grafana/grafana/pkg/components/null"
+	"github.com/grafana/grafana/pkg/components/simplejson"
 	"github.com/grafana/grafana/pkg/log"
 	"github.com/grafana/grafana/pkg/models"
 	"github.com/grafana/grafana/pkg/tsdb"
@@ -79,6 +80,11 @@ func (tw *DatasourcePluginWrapper) Query(ctx context.Context, ds *models.DataSou
 			qr.ErrorString = r.Error
 		}
 
+		if r.MetaJson != "" {
+			metaJson, _ := simplejson.NewJson([]byte(r.MetaJson))
+			qr.Meta = metaJson
+		}
+
 		for _, s := range r.GetSeries() {
 			points := tsdb.TimeSeriesPoints{}