models.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package influxdb
  15. import (
  16. "time"
  17. api "yunion.io/x/onecloud/pkg/apis/monitor"
  18. )
  19. type Query struct {
  20. Measurement string
  21. Policy string
  22. ResultFormat string
  23. Tags []api.MetricQueryTag
  24. GroupBy []*QueryPart
  25. Selects []*Select
  26. Alias string
  27. Tz string
  28. Interval time.Duration
  29. }
  30. type Select []QueryPart
  31. type Response struct {
  32. Results []Result `json:"results"`
  33. Err error `json:"err"`
  34. }
  35. type Result struct {
  36. Series []Row `json:"series"`
  37. Message []*Message `json:"message"`
  38. Err error `json:"err"`
  39. }
  40. type Message struct {
  41. Level string `json:"level,omitempty"`
  42. Text string `json:"text,omitempty"`
  43. }
  44. type Row struct {
  45. Name string `json:"name,omitempty"`
  46. Tags map[string]string `json:"tags,omitempty"`
  47. Columns []string `json:"columns,omitempty"`
  48. Values [][]interface{} `json:"values,omitempty"`
  49. }