prome

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: MIT Imports: 8 Imported by: 0

README

prome

Prometheus Client for easy use.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ServiceName string
	Path        string

	// Enable metrics of runtime. Default enabled.
	EnableRuntime bool

	// Labels which will always be attached to metrics.
	ConstLabels prometheus.Labels
	// contains filtered or unexported fields
}

Client represents the client for prometheus server to pull data from.

func NewClient

func NewClient(serviceName string, path string) *Client

NewClient creates and returns a new Client instance.

func (*Client) AddCounter

func (c *Client) AddCounter(opts prometheus.CounterOpts) prometheus.Counter

func (*Client) AddCounterVec

func (c *Client) AddCounterVec(
	opts prometheus.CounterOpts, labelNames []string,
) *prometheus.CounterVec

func (*Client) AddGauge

func (c *Client) AddGauge(opts prometheus.GaugeOpts) prometheus.Gauge

func (*Client) AddGaugeVec

func (c *Client) AddGaugeVec(
	opts prometheus.GaugeOpts, labelNames []string,
) *prometheus.GaugeVec

func (*Client) AddHistogram

func (c *Client) AddHistogram(opts prometheus.HistogramOpts) prometheus.Histogram

func (*Client) AddHistogramVec

func (c *Client) AddHistogramVec(
	opts prometheus.HistogramOpts, labelNames []string,
) *prometheus.HistogramVec

func (*Client) AddSummary

func (c *Client) AddSummary(opts prometheus.SummaryOpts) prometheus.Summary

func (*Client) AddSummaryVec

func (c *Client) AddSummaryVec(
	opts prometheus.SummaryOpts, labelNames []string,
) *prometheus.SummaryVec

func (*Client) DurationMiddleware added in v0.0.2

func (c *Client) DurationMiddleware(
	metricsName string, objectives map[float64]float64,
) gin.HandlerFunc

DurationMiddleware returns a gin handler which can be used as middleware to capture API duration summary.

func (*Client) Handler added in v0.0.2

func (c *Client) Handler() http.Handler

Handler returns the http handler which can be used for fetch metrics data.

func (*Client) ListenAndServe

func (c *Client) ListenAndServe(addr string) error

ListenAndServe listen on the addr and provide access for prometheus server to pull data.

func (*Client) QPSMiddleware added in v0.0.2

func (c *Client) QPSMiddleware(metricsName string) gin.HandlerFunc

QPSMiddleware returns a gin HandlerFunc which can be used as middleware to capture QPS counter.

Directories

Path Synopsis
examples
gin

Jump to

Keyboard shortcuts

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