datasource.proto 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. syntax = "proto3";
  2. option go_package = "datasource";
  3. package models;
  4. message DatasourceRequest {
  5. TimeRange timeRange = 1;
  6. DatasourceInfo datasource = 2;
  7. repeated Query queries = 3;
  8. }
  9. message Query {
  10. string refId = 1;
  11. int64 maxDataPoints = 2;
  12. int64 intervalMs = 3;
  13. string modelJson = 4;
  14. }
  15. message TimeRange {
  16. string fromRaw = 1;
  17. string toRaw = 2;
  18. int64 fromEpochMs = 3;
  19. int64 toEpochMs = 4;
  20. }
  21. message DatasourceResponse {
  22. repeated QueryResult results = 1;
  23. }
  24. message QueryResult {
  25. string error = 1;
  26. string refId = 2;
  27. string metaJson = 3;
  28. repeated TimeSeries series = 4;
  29. repeated Table tables = 5;
  30. }
  31. message Table {
  32. repeated TableColumn columns = 1;
  33. repeated TableRow rows = 2;
  34. }
  35. message TableColumn {
  36. string name = 1;
  37. }
  38. message TableRow {
  39. repeated RowValue values = 1;
  40. }
  41. message RowValue {
  42. enum Kind {
  43. // Field type null.
  44. TYPE_NULL = 0;
  45. // Field type double.
  46. TYPE_DOUBLE = 1;
  47. // Field type int64.
  48. TYPE_INT64 = 2;
  49. // Field type bool.
  50. TYPE_BOOL = 3;
  51. // Field type string.
  52. TYPE_STRING = 4;
  53. // Field type bytes.
  54. TYPE_BYTES = 5;
  55. };
  56. Kind kind = 1;
  57. double doubleValue = 2;
  58. int64 int64Value = 3;
  59. bool boolValue = 4;
  60. string stringValue = 5;
  61. bytes bytesValue = 6;
  62. }
  63. message DatasourceInfo {
  64. int64 id = 1;
  65. int64 orgId = 2;
  66. string name = 3;
  67. string type = 4;
  68. string url = 5;
  69. string jsonData = 6;
  70. map<string,string> decryptedSecureJsonData = 7;
  71. }
  72. message TimeSeries {
  73. string name = 1;
  74. map<string, string> tags = 2;
  75. repeated Point points = 3;
  76. }
  77. message Point {
  78. int64 timestamp = 1;
  79. double value = 2;
  80. }
  81. service DatasourcePlugin {
  82. rpc Query(DatasourceRequest) returns (DatasourceResponse);
  83. }