2013-01-10 17:27:03 -08:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2013-01-12 12:22:59 -08:00
|
|
|
"code.google.com/p/gorest"
|
2013-02-06 08:08:05 -08:00
|
|
|
"github.com/prometheus/prometheus/storage/metric"
|
2013-01-27 10:59:20 -08:00
|
|
|
"github.com/prometheus/prometheus/utility"
|
2013-01-10 17:27:03 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
type MetricsService struct {
|
2013-01-12 12:22:59 -08:00
|
|
|
gorest.RestService `root:"/api/" consumes:"application/json" produces:"application/json"`
|
2013-01-10 17:27:03 -08:00
|
|
|
|
2013-01-17 15:07:00 -08:00
|
|
|
query gorest.EndPoint `method:"GET" path:"/query?{expr:string}&{json:string}" output:"string"`
|
2013-01-15 02:30:55 -08:00
|
|
|
queryRange gorest.EndPoint `method:"GET" path:"/query_range?{expr:string}&{end:int64}&{range:int64}&{step:int64}" output:"string"`
|
2013-02-06 08:08:05 -08:00
|
|
|
metrics gorest.EndPoint `method:"GET" path:"/metrics" output:"string"`
|
|
|
|
|
|
|
|
persistence metric.MetricPersistence
|
|
|
|
time utility.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewMetricsService(p metric.MetricPersistence) *MetricsService {
|
|
|
|
return &MetricsService{
|
|
|
|
persistence: p,
|
|
|
|
}
|
2013-01-10 17:27:03 -08:00
|
|
|
}
|