Browse Source

Adds Tables types to protobuf

bergquist 8 years ago
parent
commit
9e942f1a6d
3 changed files with 133 additions and 42 deletions
  1. 1 1
      Makefile
  2. 117 40
      pkg/tsdb/models/tsdb_plugin.pb.go
  3. 15 1
      pkg/tsdb/models/tsdb_plugin.proto

+ 1 - 1
Makefile

@@ -27,5 +27,5 @@ test: test-go test-js
 run:
 	./bin/grafana-server
 
-pbuf:
+protoc:
 	protoc -I pkg/tsdb/models pkg/tsdb/models/*.proto --go_out=plugins=grpc:pkg/tsdb/models/.

+ 117 - 40
pkg/tsdb/models/tsdb_plugin.pb.go

@@ -13,6 +13,9 @@ It has these top-level messages:
 	TimeRange
 	Response
 	QueryResult
+	Table
+	TableColumn
+	TableRow
 	DatasourceInfo
 	TimeSeries
 	Point
@@ -22,6 +25,7 @@ package proto
 import proto1 "github.com/golang/protobuf/proto"
 import fmt "fmt"
 import math "math"
+import google_protobuf "github.com/golang/protobuf/ptypes/any"
 
 import (
 	context "golang.org/x/net/context"
@@ -172,6 +176,7 @@ type QueryResult struct {
 	RefId    string        `protobuf:"bytes,2,opt,name=refId" json:"refId,omitempty"`
 	MetaJson string        `protobuf:"bytes,3,opt,name=metaJson" json:"metaJson,omitempty"`
 	Series   []*TimeSeries `protobuf:"bytes,4,rep,name=series" json:"series,omitempty"`
+	Tables   []*Table      `protobuf:"bytes,5,rep,name=tables" json:"tables,omitempty"`
 }
 
 func (m *QueryResult) Reset()                    { *m = QueryResult{} }
@@ -207,6 +212,69 @@ func (m *QueryResult) GetSeries() []*TimeSeries {
 	return nil
 }
 
+func (m *QueryResult) GetTables() []*Table {
+	if m != nil {
+		return m.Tables
+	}
+	return nil
+}
+
+type Table struct {
+	Columns []*TableColumn `protobuf:"bytes,1,rep,name=columns" json:"columns,omitempty"`
+	Rows    []*TableRow    `protobuf:"bytes,2,rep,name=rows" json:"rows,omitempty"`
+}
+
+func (m *Table) Reset()                    { *m = Table{} }
+func (m *Table) String() string            { return proto1.CompactTextString(m) }
+func (*Table) ProtoMessage()               {}
+func (*Table) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+
+func (m *Table) GetColumns() []*TableColumn {
+	if m != nil {
+		return m.Columns
+	}
+	return nil
+}
+
+func (m *Table) GetRows() []*TableRow {
+	if m != nil {
+		return m.Rows
+	}
+	return nil
+}
+
+type TableColumn struct {
+	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+}
+
+func (m *TableColumn) Reset()                    { *m = TableColumn{} }
+func (m *TableColumn) String() string            { return proto1.CompactTextString(m) }
+func (*TableColumn) ProtoMessage()               {}
+func (*TableColumn) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+
+func (m *TableColumn) GetName() string {
+	if m != nil {
+		return m.Name
+	}
+	return ""
+}
+
+type TableRow struct {
+	Values []*google_protobuf.Any `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
+}
+
+func (m *TableRow) Reset()                    { *m = TableRow{} }
+func (m *TableRow) String() string            { return proto1.CompactTextString(m) }
+func (*TableRow) ProtoMessage()               {}
+func (*TableRow) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
+
+func (m *TableRow) GetValues() []*google_protobuf.Any {
+	if m != nil {
+		return m.Values
+	}
+	return nil
+}
+
 type DatasourceInfo struct {
 	Id             int64  `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
 	OrgId          int64  `protobuf:"varint,2,opt,name=orgId" json:"orgId,omitempty"`
@@ -220,7 +288,7 @@ type DatasourceInfo struct {
 func (m *DatasourceInfo) Reset()                    { *m = DatasourceInfo{} }
 func (m *DatasourceInfo) String() string            { return proto1.CompactTextString(m) }
 func (*DatasourceInfo) ProtoMessage()               {}
-func (*DatasourceInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
+func (*DatasourceInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
 
 func (m *DatasourceInfo) GetId() int64 {
 	if m != nil {
@@ -280,7 +348,7 @@ type TimeSeries struct {
 func (m *TimeSeries) Reset()                    { *m = TimeSeries{} }
 func (m *TimeSeries) String() string            { return proto1.CompactTextString(m) }
 func (*TimeSeries) ProtoMessage()               {}
-func (*TimeSeries) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
+func (*TimeSeries) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
 
 func (m *TimeSeries) GetName() string {
 	if m != nil {
@@ -311,7 +379,7 @@ type Point struct {
 func (m *Point) Reset()                    { *m = Point{} }
 func (m *Point) String() string            { return proto1.CompactTextString(m) }
 func (*Point) ProtoMessage()               {}
-func (*Point) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
+func (*Point) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
 
 func (m *Point) GetTimestamp() int64 {
 	if m != nil {
@@ -333,6 +401,9 @@ func init() {
 	proto1.RegisterType((*TimeRange)(nil), "plugins.TimeRange")
 	proto1.RegisterType((*Response)(nil), "plugins.Response")
 	proto1.RegisterType((*QueryResult)(nil), "plugins.QueryResult")
+	proto1.RegisterType((*Table)(nil), "plugins.Table")
+	proto1.RegisterType((*TableColumn)(nil), "plugins.TableColumn")
+	proto1.RegisterType((*TableRow)(nil), "plugins.TableRow")
 	proto1.RegisterType((*DatasourceInfo)(nil), "plugins.DatasourceInfo")
 	proto1.RegisterType((*TimeSeries)(nil), "plugins.TimeSeries")
 	proto1.RegisterType((*Point)(nil), "plugins.Point")
@@ -413,41 +484,47 @@ var _TsdbPlugin_serviceDesc = grpc.ServiceDesc{
 func init() { proto1.RegisterFile("tsdb_plugin.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-	// 566 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x54, 0x51, 0x8b, 0xd3, 0x4c,
-	0x14, 0x25, 0x49, 0xdb, 0x6c, 0x6e, 0xf9, 0xca, 0xb7, 0xe3, 0x82, 0xa1, 0xa8, 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0xbb, 0xf7, 0xae, 0xa9, 0x74, 0x34, 0x65, 0xb1, 0x3e, 0x15, 0x46, 0xad,
+	0x28, 0x52, 0x6d, 0xc5, 0xf3, 0x72, 0x18, 0x37, 0x87, 0x1b, 0xc7, 0x91, 0x56, 0xe8, 0xe4, 0x08,
+	0x86, 0xf5, 0x52, 0x7b, 0xc1, 0x6f, 0x7c, 0x55, 0x1d, 0x6d, 0x7f, 0xad, 0x61, 0xe8, 0xae, 0xeb,
+	0x4b, 0x0c, 0x4e, 0x3a, 0xc7, 0x5e, 0xf8, 0x02, 0x7a, 0xb8, 0x13, 0x8e, 0x4e, 0x92, 0x71, 0x6d,
+	0x58, 0x96, 0x57, 0x56, 0x37, 0x89, 0xf5, 0x0d, 0xbc, 0x6a, 0x83, 0xc3, 0x97, 0x00, 0xf6, 0xcd,
+	0xbb, 0x40, 0x49, 0x24, 0x72, 0xcf, 0x4b, 0xeb, 0xa9, 0x73, 0x2f, 0xe2, 0xa4, 0xe9, 0x25, 0x37,
+	0x82, 0xaf, 0x07, 0x1f, 0x7b, 0x65, 0x03, 0xf4, 0xf1, 0xf3, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff,
+	0xff, 0xa8, 0xec, 0x66, 0xef, 0x7b, 0x05, 0x00, 0x00,
 }

+ 15 - 1
pkg/tsdb/models/tsdb_plugin.proto

@@ -3,6 +3,8 @@ option go_package = "proto";
 
 package plugins;
 
+import "google/protobuf/any.proto";
+
 message TsdbQuery {
   TimeRange timeRange = 1;
   DatasourceInfo datasource = 2;
@@ -32,8 +34,20 @@ message QueryResult {
   string refId = 2;
   string metaJson = 3;
   repeated TimeSeries series = 4;
+  repeated Table tables = 5;
+}
+
+message Table {
+  repeated TableColumn columns = 1;
+  repeated TableRow rows = 2;
+}
+
+message TableColumn {
+  string name = 1;
+}
 
-  //repeat Table tables = x;
+message TableRow {
+  repeated google.protobuf.Any values = 1;
 }
 
 message DatasourceInfo {