Help us shape the future of Go! Take the 2026 Go Developer Survey

metrics

package
v2.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const UnknownOperation = "UnknownOperation"

Variables

View Source
var (
	HTTPRequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricPrefix,
		Name:      "http_requests_total",
		Help:      "The number of requests to external APIs",
	}, []string{componentLabel, hostLabel, methodLabel, operationLabel, codeLabel})

	HTTPErrorCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricPrefix,
		Name:      "http_errors_total",
		Help:      "Number of HTTP errors returned by external APIs",
	}, []string{componentLabel, hostLabel, methodLabel, operationLabel, codeLabel})

	HTTPRequestDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricPrefix,
		Name:      "http_request_duration_seconds",
		Help:      "The response times of external API requests",
	}, []string{componentLabel, hostLabel, methodLabel, operationLabel, codeLabel})
)

Functions

func NewHTTPClient

func NewHTTPClient(componentName string) *http.Client

func WrapHTTPClient

func WrapHTTPClient(client *http.Client, componentName string) *http.Client

Types

type Exporter

type Exporter struct {
}

func NewExporter

func NewExporter() *Exporter

func (*Exporter) Collect

func (e *Exporter) Collect(metrics chan<- prometheus.Metric)

func (*Exporter) Describe

func (e *Exporter) Describe(descs chan<- *prometheus.Desc)

type InstrumentedRoundTripper

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

func (*InstrumentedRoundTripper) RoundTrip

func (rt *InstrumentedRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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