metric_row.go 870 B

1234567891011121314151617181920212223242526272829303132
  1. package report
  2. import "time"
  3. // MetricRow is a tuple of data used to render a metric as a sparkline and
  4. // accoutrements.
  5. type MetricRow struct {
  6. ID string `json:"id"`
  7. Label string `json:"label"`
  8. Format string `json:"format"`
  9. Group string `json:"group"`
  10. Value float64 `json:"value"`
  11. ValueEmpty bool `json:"value_empty"`
  12. Priority float64 `json:"priority"`
  13. URL string `json:"url"`
  14. // Metric *Metric
  15. Metric
  16. }
  17. // Metric is a list of timeseries data with some metadata. Clients must use the
  18. // Add method to add values. Metrics are immutable.
  19. type Metric struct {
  20. Samples []Sample `json:"samples,omitempty"`
  21. Min float64 `json:"min"`
  22. Max float64 `json:"max"`
  23. }
  24. // Sample is a single datapoint of a metric.
  25. type Sample struct {
  26. Timestamp time.Time `json:"date"`
  27. Value float64 `json:"value"`
  28. }