Documentation ¶
Overview ¶
Package net implements a backend that communicates over a network. It uses HTTP and protocol buffers for communication.
Index ¶
- type Backend
- func (b Backend) Contains(targets []string) bool
- func (b Backend) Find(ctx context.Context, request types.FindRequest) (types.Matches, error)
- func (b Backend) Info(ctx context.Context, request types.InfoRequest) ([]types.Info, error)
- func (b Backend) Logger() *zap.Logger
- func (b *Backend) Probe()
- func (b Backend) Render(ctx context.Context, request types.RenderRequest) ([]types.Metric, error)
- type Config
- type ErrHTTPCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend represents a host that accepts requests for metrics over HTTP.
type Config ¶
type Config struct { Address string // The backend address. // Optional fields Client *http.Client // The client to use to communicate with backend. Defaults to http.DefaultClient. Timeout time.Duration // Set request timeout. Defaults to no timeout. Limit int // Set limit of concurrent requests to backend. Defaults to no limit. PathCacheExpirySec uint32 // Set time in seconds before items in path cache expire. Defaults to 10 minutes. Logger *zap.Logger // Logger to use. Defaults to a no-op logger. }
Config configures an HTTP backend.
The only required field is Address, which must be of the form "address[:port]", where address is an IP address or a hostname. Address must be a point that can accept HTTP requests.
type ErrHTTPCode ¶
type ErrHTTPCode int
ErrHTTPCode is a custom error type to distinguish HTTP errors
func (ErrHTTPCode) Error ¶
func (e ErrHTTPCode) Error() string
Click to show internal directories.
Click to hide internal directories.