package prometheus
import "github.com/prometheus/client_golang/api/prometheus"
Package prometheus provides bindings to the Prometheus HTTP API: http://prometheus.io/docs/querying/api/
Index ¶
- Constants
- type CancelableTransport
- type Client
- type Config
- type Error
- type ErrorType
- type QueryAPI
- type Range
Constants ¶
const ( // The different API error types. ErrBadData ErrorType = "bad_data" ErrTimeout = "timeout" ErrCanceled = "canceled" ErrExec = "execution" ErrBadResponse = "bad_response" )
Types ¶
type CancelableTransport ¶
type CancelableTransport interface { http.RoundTripper CancelRequest(req *http.Request) }
CancelableTransport is like net.Transport but provides per-request cancelation functionality.
var DefaultTransport CancelableTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, Dial: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).Dial, TLSHandshakeTimeout: 10 * time.Second, }
type Client ¶
type Client interface {
// contains filtered or unexported methods
}
func New ¶
New returns a new Client.
It is safe to use the returned Client from multiple goroutines.
type Config ¶
type Config struct { // The address of the Prometheus to connect to. Address string // Transport is used by the Client to drive HTTP requests. If not // provided, DefaultTransport will be used. Transport CancelableTransport }
Config defines configuration parameters for a new client.
type Error ¶
Error is an error returned by the API.
func (*Error) Error ¶
type ErrorType ¶
type ErrorType string
type QueryAPI ¶
type QueryAPI interface { // Query performs a query for the given time. Query(ctx context.Context, query string, ts time.Time) (model.Value, error) // Query performs a query for the given range. QueryRange(ctx context.Context, query string, r Range) (model.Value, error) }
QueryAPI provides bindings the Prometheus's query API.
func NewQueryAPI ¶
NewQueryAPI returns a new QueryAPI for the client.
It is safe to use the returned QueryAPI from multiple goroutines.
type Range ¶
type Range struct { // The boundaries of the time range. Start, End time.Time // The maximum time between two slices within the boundaries. Step time.Duration }
Range represents a sliced time range.
Source Files ¶
- Version
- v0.8.0
- Published
- Aug 17, 2016
- Platform
- darwin/amd64
- Imports
- 13 packages
- Last checked
- 4 weeks ago –
Tools for package owners.