v1 - ActiveState ActiveGo 1.8
...

Package v1

import "github.com/prometheus/client_golang/api/prometheus/v1"
Overview
Index

Overview ▾

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

type API

API provides bindings for Prometheus's v1 API.

type API interface {
    // Query performs a query for the given time.
    Query(ctx context.Context, query string, ts time.Time) (model.Value, error)
    // QueryRange performs a query for the given range.
    QueryRange(ctx context.Context, query string, r Range) (model.Value, error)
    // LabelValues performs a query for the values of the given label.
    LabelValues(ctx context.Context, label string) (model.LabelValues, error)
}

func NewAPI

func NewAPI(c api.Client) API

NewAPI returns a new API for the client.

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

type Error

Error is an error returned by the API.

type Error struct {
    Type ErrorType
    Msg  string
}

func (*Error) Error

func (e *Error) Error() string

type ErrorType

ErrorType models the different API error types.

type ErrorType string

Possible values for ErrorType.

const (
    ErrBadData     ErrorType = "bad_data"
    ErrTimeout               = "timeout"
    ErrCanceled              = "canceled"
    ErrExec                  = "execution"
    ErrBadResponse           = "bad_response"
)

type Range

Range represents a sliced time 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
}