client_golang: github.com/prometheus/client_golang/api Index | Files | Directories

package api

import "github.com/prometheus/client_golang/api"

Package api provides clients for the HTTP APIs.

Index

Package Files

client.go

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.

type Client Uses

type Client interface {
    URL(ep string, args map[string]string) *url.URL
    Do(context.Context, *http.Request) (*http.Response, []byte, Warnings, error)
}

Client is the interface for an API client.

func NewClient Uses

func NewClient(cfg Config) (Client, error)

NewClient returns a new Client.

It is safe to use the returned Client from multiple goroutines.

type Config Uses

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 Warnings Uses

type Warnings []string

func DoGetFallback Uses

func DoGetFallback(c Client, ctx context.Context, u *url.URL, args url.Values) (*http.Response, []byte, Warnings, error)

DoGetFallback will attempt to do the request as-is, and on a 405 it will fallback to a GET request.

Directories

PathSynopsis
prometheus/v1Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/

Package api imports 8 packages (graph) and is imported by 70 packages. Updated 2019-10-15. Refresh now. Tools for package owners.