metrics

package
v0.0.0-...-2714d10 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Runtime = "host"

This variable is set at compile time to allow the default local address to change.

Functions

func CreateMetricsListener

func CreateMetricsListener(listeners *gracenet.Net, laddr string) (net.Listener, error)

CreateMetricsListener will create a new net.Listener by using an known set of ports when the default address is passed with the fallback of choosing a random port when none is available.

In case the provided address is not the default one then it will be used as is.

func GetMetricsDefaultAddress

func GetMetricsDefaultAddress(runtimeType string) string

func GetMetricsKnownAddresses

func GetMetricsKnownAddresses(runtimeType string) []string

GetMetricsKnownAddresses returns the addresses used by the metrics server to bind at startup time to allow a semi-deterministic approach to know where the server is listening at. The ports were selected because at the time we are in 2024 and they do not collide with any know/registered port according https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers.

func RegisterBuildInfo

func RegisterBuildInfo(buildType, buildTime, version string)

func ServeMetrics

func ServeMetrics(
	l net.Listener,
	ctx context.Context,
	config Config,
	log *zerolog.Logger,
) (err error)

Types

type Config

type Config struct {
	ReadyServer         *ReadyServer
	DiagnosticHandler   *diagnostic.Handler
	QuickTunnelHostname string
	Orchestrator        orchestrator

	ShutdownTimeout time.Duration
}

type HistogramConfig

type HistogramConfig struct {
	BucketsStart float64
	BucketsWidth float64
	BucketsCount int
}

type ReadyServer

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

ReadyServer serves HTTP 200 if the tunnel can serve traffic. Intended for k8s readiness checks.

func NewReadyServer

func NewReadyServer(
	clientID uuid.UUID,
	tracker *tunnelstate.ConnTracker,
) *ReadyServer

NewReadyServer initializes a ReadyServer and starts listening for dis/connection events.

func (*ReadyServer) ServeHTTP

func (rs *ReadyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP responds with HTTP 200 if the tunnel is connected to the edge.

Jump to

Keyboard shortcuts

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