metrics

package
v1.35.7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 13 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 added in v1.34.11

func NewHTTPClient(componentName string) *http.Client

func Run

func Run(ctx context.Context, metricsAddr string) error

func WrapHTTPClient added in v1.34.11

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