metrics

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metrics sets and initializes Prometheus metrics.

Index

Constants

View Source
const (
	NF_TYPE_LABEL = "nf_type"
)

Variables

This section is empty.

Functions

func InboundMetrics

func InboundMetrics() gin.HandlerFunc

InboundMetrics is a Gin middleware that counts and times each request.

func Init

func Init(initMetrics InitMetrics) *prometheus.Registry

Init initializes all Prometheus metrics

Types

type InitMetrics

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

func NewInitMetrics

func NewInitMetrics(
	_metrics Metrics,
	_nfName string,
	_metricsEnabled map[utils.MetricTypeEnabled]bool,
	_customCollectors map[utils.MetricTypeEnabled][]prometheus.Collector,
) InitMetrics

func (InitMetrics) GetCustomCollectors

func (initMetrics InitMetrics) GetCustomCollectors() map[utils.MetricTypeEnabled][]prometheus.Collector

func (InitMetrics) GetMetricsEnabled

func (initMetrics InitMetrics) GetMetricsEnabled() map[utils.MetricTypeEnabled]bool

func (InitMetrics) GetMetricsInfo

func (initMetrics InitMetrics) GetMetricsInfo() Metrics

func (InitMetrics) GetNfName

func (initMetrics InitMetrics) GetNfName() string

type Metrics

type Metrics struct {
	Scheme      string `yaml:"scheme"`
	BindingIPv4 string `yaml:"bindingIPv4,omitempty"` // IP used to run the server in the node.
	Port        int    `yaml:"port,omitempty"`
	Tls         Tls    `yaml:"tls,omitempty"`
	Namespace   string `yaml:"namespace"`
}

type Server

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

func NewServer

func NewServer(initMetrics InitMetrics, tlsKeyLogPath string, nfLogger *logrus.Entry) (*Server, error)

Initializes a new HTTP server instance and associate the prometheus handler to it

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

Configure the server to handle http requests

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS()

Configure the server to handle https requests

func (*Server) Run

func (s *Server) Run(wg *sync.WaitGroup)

func (*Server) Stop

func (s *Server) Stop()

type Tls

type Tls struct {
	Pem string `yaml:"pem,omitempty" valid:"type(string),minstringlength(1),required"`
	Key string `yaml:"key,omitempty" valid:"type(string),minstringlength(1),required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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