prometheus

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access string
const (
	Proxy   Access = "proxy"
	Browser Access = "direct"
)

type Exemplar

type Exemplar struct {
	// The name of the field in the labels object that should be used to get the traceID.
	LabelName string `json:"name"`

	// The data source the exemplar is going to navigate to.
	// Set this value for internal exemplar links.
	DatasourceUID string `json:"datasourceUid"`

	// The URL of the trace backend the user would go to see its trace.
	// Set this value for external exemplar links.
	URL string `json:"url,omitempty"`
}

type Option

type Option func(datasource *Prometheus) error

func AccessMode

func AccessMode(mode Access) Option

AccessMode controls how requests to the data source will be handled. Proxy should be the preferred way if nothing else is stated. Browser will let your browser send the requests (deprecated).

func BasicAuth

func BasicAuth(username string, password string) Option

BasicAuth configures basic authentication for this datasource.

func Default

func Default() Option

Default configures this datasource to be the default one.

func Exemplars

func Exemplars(exemplars ...Exemplar) Option

Exemplars configures a list of exemplars on this datasource.

func ForwardCookies

func ForwardCookies(cookies ...string) Option

ForwardCookies configures a list of cookies that should be forwarded to the datasource.

func ForwardOauthIdentity

func ForwardOauthIdentity() Option

ForwardOauthIdentity forward the user's upstream OAuth identity to the data source (Their access token gets passed along).

func HTTPMethod

func HTTPMethod(method string) Option

HTTPMethod sets the method used to query Prometheus. POST is the recommended method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network.

func QueryTimeout

func QueryTimeout(timeout time.Duration) Option

QueryTimeout sets the timeout for queries. Defaults to 60s

func ScrapeInterval

func ScrapeInterval(interval time.Duration) Option

ScrapeInterval configures the scrape and evaluation interval. Should be set to the typical value in Prometheus (defaults to 15s).

func SkipTLSVerify

func SkipTLSVerify() Option

SkipTLSVerify disables verification of SSL certificates.

func WithCertificate

func WithCertificate(certificate string) Option

WithCertificate sets a self-signed certificate that can be verified against.

func WithCredentials

func WithCredentials() Option

WithCredentials joins credentials such as cookies or auth headers to cross-site requests.

type Prometheus

type Prometheus struct {
	// contains filtered or unexported fields
}

func New

func New(name string, url string, options ...Option) (Prometheus, error)

func (Prometheus) MarshalJSON

func (datasource Prometheus) MarshalJSON() ([]byte, error)

func (Prometheus) Name

func (datasource Prometheus) Name() string

Jump to

Keyboard shortcuts

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