1
// Copyright 2016 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
10
// MetricResults contains results from a GetMetrics call, with
11
// one item per Entity given as an argument to the command.
12
type MetricResults struct {
13
Results []EntityMetrics `json:"results"`
16
// OneError returns the first error
17
func (m *MetricResults) OneError() error {
18
for _, r := range m.Results {
19
if err := r.Error; err != nil {
26
// EntityMetrics contains the results of a GetMetrics call for a single
28
type EntityMetrics struct {
29
Metrics []MetricResult `json:"metrics,omitempty"`
30
Error *Error `json:"error,omitempty"`
33
// MetricResults contains a single metric.
34
type MetricResult struct {
35
Time time.Time `json:"time"`
36
Key string `json:"key"`
37
Value string `json:"value"`