types.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package stackdriver
  2. import (
  3. "net/url"
  4. "time"
  5. )
  6. // StackdriverQuery is the query that Grafana sends from the frontend
  7. type StackdriverQuery struct {
  8. Target string
  9. Params url.Values
  10. RefID string
  11. GroupBys []string
  12. AliasBy string
  13. }
  14. // StackdriverResponse is the data returned from the external Google Stackdriver API
  15. type StackdriverResponse struct {
  16. TimeSeries []struct {
  17. Metric struct {
  18. Labels map[string]string `json:"labels"`
  19. Type string `json:"type"`
  20. } `json:"metric"`
  21. Resource struct {
  22. Type string `json:"type"`
  23. Labels map[string]string `json:"labels"`
  24. } `json:"resource"`
  25. MetricKind string `json:"metricKind"`
  26. ValueType string `json:"valueType"`
  27. Points []struct {
  28. Interval struct {
  29. StartTime time.Time `json:"startTime"`
  30. EndTime time.Time `json:"endTime"`
  31. } `json:"interval"`
  32. Value struct {
  33. DoubleValue float64 `json:"doubleValue"`
  34. StringValue string `json:"stringValue"`
  35. BoolValue bool `json:"boolValue"`
  36. IntValue string `json:"int64Value"`
  37. } `json:"value"`
  38. } `json:"points"`
  39. } `json:"timeSeries"`
  40. }