package api
import "github.com/prometheus/client_golang/api"
Package api provides clients for the HTTP APIs.
Index ¶
- Variables
- type Client
- type Config
- type Error
- func DoGetFallback(c Client, ctx context.Context, u *url.URL, args url.Values) (*http.Response, []byte, Error)
- func NewErrorAPI(err error, warnings []string) Error
- type ErrorAPI
Variables ¶
var DefaultRoundTripper http.RoundTripper = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, TLSHandshakeTimeout: 10 * time.Second, }
DefaultRoundTripper is used if no RoundTripper is set in Config.
Types ¶
type Client ¶
type Client interface { URL(ep string, args map[string]string) *url.URL Do(context.Context, *http.Request) (*http.Response, []byte, Error) }
Client is the interface for an API client.
func NewClient ¶
NewClient 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 // RoundTripper is used by the Client to drive HTTP requests. If not // provided, DefaultRoundTripper will be used. RoundTripper http.RoundTripper }
Config defines configuration parameters for a new client.
type Error ¶
type Error interface { error // Err returns the underlying error. Err() error // Warnings returns a list of warnings. Warnings() []string }
Error encapsulates an error + warning
func DoGetFallback ¶
func DoGetFallback(c Client, ctx context.Context, u *url.URL, args url.Values) (*http.Response, []byte, Error)
DoGetFallback will attempt to do the request as-is, and on a 405 it will fallback to a GET request.
func NewErrorAPI ¶
type ErrorAPI ¶
type ErrorAPI struct {
// contains filtered or unexported fields
}
func (*ErrorAPI) Err ¶
func (*ErrorAPI) Error ¶
func (*ErrorAPI) Warnings ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
api/prometheus | |
api/prometheus/v1 | Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/ |
- Version
- v0.9.4
- Published
- Jun 7, 2019
- Platform
- darwin/amd64
- Imports
- 8 packages
- Last checked
- 3 weeks ago –
Tools for package owners.