// GetMetrics will receive metrics collected by the given entity func (c *Client) GetMetrics(tag string) ([]params.MetricResult, error) { p := params.Entities{Entities: []params.Entity{ {tag}, }} results := new(params.MetricResults) if err := c.facade.FacadeCall("GetMetrics", p, results); err != nil { return nil, errors.Trace(err) } if err := results.OneError(); err != nil { return nil, errors.Trace(err) } metrics := []params.MetricResult{} for _, r := range results.Results { metrics = append(metrics, r.Metrics...) } return metrics, nil }
// GetMetrics will receive metrics collected by the given entity func (c *Client) GetMetrics(tags ...string) ([]params.MetricResult, error) { entities := make([]params.Entity, len(tags)) for i, tag := range tags { entities[i] = params.Entity{Tag: tag} } p := params.Entities{Entities: entities} results := new(params.MetricResults) if err := c.facade.FacadeCall("GetMetrics", p, results); err != nil { return nil, errors.Trace(err) } if err := results.OneError(); err != nil { return nil, errors.Trace(err) } metrics := []params.MetricResult{} for _, r := range results.Results { metrics = append(metrics, r.Metrics...) } return metrics, nil }