2016-09-12 19:43:01 +00:00
|
|
|
package mrfusion
|
|
|
|
|
2016-09-21 22:03:07 +00:00
|
|
|
import "golang.org/x/net/context"
|
2016-09-12 19:43:01 +00:00
|
|
|
|
2016-09-21 15:47:01 +00:00
|
|
|
// Query retrieves a Response from a TimeSeries.
|
|
|
|
type Query struct {
|
2016-09-21 22:11:29 +00:00
|
|
|
Command string // Command is the query itself
|
|
|
|
DB string // DB is optional and if empty will not be used.
|
|
|
|
RP string // RP is a retention policy and optional; if empty will not be used.
|
2016-09-21 15:47:01 +00:00
|
|
|
}
|
2016-09-12 19:43:01 +00:00
|
|
|
|
|
|
|
// Response is the result of a query against a TimeSeries
|
|
|
|
type Response interface {
|
2016-09-21 22:03:07 +00:00
|
|
|
MarshalJSON() ([]byte, error)
|
2016-09-12 19:43:01 +00:00
|
|
|
}
|
|
|
|
|
2016-09-15 16:28:51 +00:00
|
|
|
// MonitoredService is a service sending monitoring data to a `TimeSeries`
|
|
|
|
type MonitoredService struct {
|
|
|
|
TagKey string `json:"tagKey"`
|
|
|
|
TagValue string `json:"tagValue"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
}
|
|
|
|
|
2016-09-12 19:43:01 +00:00
|
|
|
// Represents a queryable time series database.
|
|
|
|
type TimeSeries interface {
|
|
|
|
// Query retrieves time series data from the database.
|
|
|
|
Query(context.Context, Query) (Response, error)
|
2016-09-15 16:28:51 +00:00
|
|
|
// MonitoredServices retrieves all services sending monitoring data to this `TimeSeries`
|
|
|
|
MonitoredServices(context.Context) ([]MonitoredService, error)
|
2016-09-12 19:43:01 +00:00
|
|
|
}
|