api

package
v1.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 1,444 modules, 1,417 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api provides clients for the HTTP APIs.

Index

Constants

This section is empty.

Variables

View Source
var DefaultRoundTripper http.RoundTripper = &http.Transport{
	Proxy: http.ProxyFromEnvironment,
	DialContext: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	}).DialContext,
	ForceAttemptHTTP2:     true,
	MaxIdleConns:          100,
	IdleConnTimeout:       90 * time.Second,
	TLSHandshakeTimeout:   10 * time.Second,
	ExpectContinueTimeout: 1 * time.Second,
}

DefaultRoundTripper is used if no RoundTripper is set in Config. refer https://github.com/golang/go/blob/master/src/net/http/transport.go#L46

Functions

This section is empty.

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

func NewClient(cfg Config) (Client, error)

NewClient returns a new Client.

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

type CloseIdler added in v1.21.0

type CloseIdler interface {
	CloseIdleConnections()
}

type Config

type Config struct {
	// The address of the Prometheus to connect to.
	Address string

	// Client is used by the Client to drive HTTP requests. If not provided,
	// a new one based on the provided RoundTripper (or DefaultRoundTripper) will be used.
	Client *http.Client

	// 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.

Directories

Path Synopsis
prometheus
v1
Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/
Package v1 provides bindings to the Prometheus HTTP API v1: http://prometheus.io/docs/querying/api/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL