Exemplo n.º 1
0
// Retrieves raw metrics from Heapster.
func getRawMetrics(heapsterClient client.HeapsterClient, metricPath string) ([]byte, error) {
	resultRaw, err := heapsterClient.Get(metricPath).DoRaw()

	if err != nil {
		return make([]byte, 0), err
	}
	return resultRaw, nil
}
// HeapsterUnmarshalType performs heapster GET request to the specifies path and transfers
// the data to the interface provided.
func HeapsterUnmarshalType(client client.HeapsterClient, path string, v interface{}) error {
	rawData, err := client.Get("/model/" + path).DoRaw()
	if err != nil {
		return err
	}
	return json.Unmarshal(rawData, v)
}