Explorar el Código

backend plugins: expose meta field

Alexander Zobnin hace 7 años
padre
commit
4533f22871
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  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"
 	"fmt"
 
 
 	"github.com/grafana/grafana/pkg/components/null"
 	"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/log"
 	"github.com/grafana/grafana/pkg/models"
 	"github.com/grafana/grafana/pkg/models"
 	"github.com/grafana/grafana/pkg/tsdb"
 	"github.com/grafana/grafana/pkg/tsdb"
@@ -79,6 +80,11 @@ func (tw *DatasourcePluginWrapper) Query(ctx context.Context, ds *models.DataSou
 			qr.ErrorString = r.Error
 			qr.ErrorString = r.Error
 		}
 		}
 
 
+		if r.MetaJson != "" {
+			metaJson, _ := simplejson.NewJson([]byte(r.MetaJson))
+			qr.Meta = metaJson
+		}
+
 		for _, s := range r.GetSeries() {
 		for _, s := range r.GetSeries() {
 			points := tsdb.TimeSeriesPoints{}
 			points := tsdb.TimeSeriesPoints{}