github.com/wtfutil/wtf@v0.43.0/modules/newrelic/client/component_metrics.go (about) 1 package newrelic 2 3 import ( 4 "fmt" 5 ) 6 7 // GetComponentMetrics will return a slice of Metric items for a 8 // particular Component ID, optionally filtered by MetricsOptions. 9 func (c *Client) GetComponentMetrics(id int, options *MetricsOptions) ([]Metric, error) { 10 mc := NewMetricClient(c) 11 12 return mc.GetMetrics( 13 fmt.Sprintf( 14 "components/%d/metrics.json", 15 id, 16 ), 17 options, 18 ) 19 } 20 21 // GetComponentMetricData will return all metric data for a particular 22 // component, optionally filtered by MetricDataOptions. 23 func (c *Client) GetComponentMetricData(id int, names []string, options *MetricDataOptions) (*MetricDataResponse, error) { 24 mc := NewMetricClient(c) 25 26 return mc.GetMetricData( 27 fmt.Sprintf( 28 "components/%d/metrics/data.json", 29 id, 30 ), 31 names, 32 options, 33 ) 34 }