http

package
v0.2.3-test.28 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterOption

type CounterOption func(*prometheus.CounterOpts)

CounterOption lets you add options to Counter metrics using With* functions.

func WithCounterConstLabels

func WithCounterConstLabels(labels prometheus.Labels) CounterOption

WithCounterConstLabels allows you to add ConstLabels to Counter metrics.

func WithGaugeConstLabels

func WithGaugeConstLabels(labels prometheus.Labels) CounterOption

WithGaugeConstLabels allows you to add ConstLabels to Gauge metrics.

func WithSummaryConstLabels

func WithSummaryConstLabels(labels prometheus.Labels) CounterOption

WithSummaryConstLabels allows you to add ConstLabels to Summary metrics.

type GaugeOption

type GaugeOption func(opts *prometheus.GaugeOpts)

GaugeOption lets you add options to gauge metrics using With* functions.

type HistogramOption

type HistogramOption func(*prometheus.HistogramOpts)

HistogramOption lets you add options to Histogram metrics using With* functions.

func WithHistogramBuckets

func WithHistogramBuckets(buckets []float64) HistogramOption

WithHistogramBuckets allows you to specify custom bucket ranges for histograms if EnableHandlingTimeHistogram is on.

func WithHistogramConstLabels

func WithHistogramConstLabels(labels prometheus.Labels) HistogramOption

WithHistogramConstLabels allows you to add custom ConstLabels to histograms metrics.

type ServerMetrics

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

ServerMetrics represents a collection of metrics to be registered on a Prometheus metrics registry for an HTTP server.

func NewRegisteredServerMetrics

func NewRegisteredServerMetrics(registry prometheus.Registerer, opts ...ServerMetricsOption) *ServerMetrics

NewRegisteredServerMetrics returns a custom ServerMetrics object registered with the user's registry and registers some common metrics associated with every instance.

func NewServerMetrics

func NewServerMetrics(opts ...ServerMetricsOption) *ServerMetrics

NewServerMetrics returns an instance of ServerMetrics

func (*ServerMetrics) Collect

func (m *ServerMetrics) Collect(ch chan<- prometheus.Metric)

Collect is called by the Prometheus registry when collecting metrics. The implementation sends each collected metric via the provided channel and returns once the last metric has been sent.

func (*ServerMetrics) Describe

func (m *ServerMetrics) Describe(ch chan<- *prometheus.Desc)

Describe sends the super-set of all possible descriptors of metrics collected by this Collector to the provided channel and returns once the last descriptor has been sent.

func (*ServerMetrics) InstrumentationHandler

func (m *ServerMetrics) InstrumentationHandler(next http.Handler) http.Handler

InstrumentationHandler initializes all metrics, with their appropriate null value, for all HTTP methods registered on an HTTP server. This is useful, to ensure that all metrics exist when collecting and querying.

func (*ServerMetrics) MustRegister

func (m *ServerMetrics) MustRegister(registry prometheus.Registerer)

MustRegister registers the metrics with the registry Panic if any error occurs much like DefaultRegisterer of Prometheus.

func (*ServerMetrics) Register

func (m *ServerMetrics) Register(registry prometheus.Registerer) error

Register registers the metrics with the registry.

type ServerMetricsOption

type ServerMetricsOption func(*serverMetricsConfig)

func WithServerCounterOptions

func WithServerCounterOptions(opts ...CounterOption) ServerMetricsOption

WithServerCounterOptions adds options to counter

type SummaryOption

type SummaryOption func(opts *prometheus.SummaryOpts)

SummaryOption lets you add options to gauge metrics using With* functions.

Jump to

Keyboard shortcuts

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