monitor

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPMeasurement

type HTTPMeasurement struct {
	Host      string
	Up        bool
	Code      int
	Latency   time.Duration
	IsTLS     bool
	TLSExpiry time.Duration
}

func (HTTPMeasurement) LogValue

func (m HTTPMeasurement) LogValue() slog.Value

type HTTPMetrics

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

func NewHTTPMetrics

func NewHTTPMetrics() *HTTPMetrics

func (HTTPMetrics) Collect

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

func (HTTPMetrics) Describe

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

func (HTTPMetrics) Observe

func (m HTTPMetrics) Observe(measurement HTTPMeasurement)

type HTTPObserver

type HTTPObserver interface {
	Observe(httpMetrics HTTPMeasurement)
}

type Monitor

type Monitor struct {
	http.Handler
	// contains filtered or unexported fields
}

func New

func New(metrics *HTTPMetrics, httpClient *http.Client) *Monitor

type Request

type Request struct {
	Target     string
	Method     string
	ValidCodes set.Set[int]
	Interval   time.Duration
}

func ParseRequest

func ParseRequest(r *http.Request) (Request, error)

func (Request) Encode

func (r Request) Encode() string

func (Request) Equals

func (r Request) Equals(other Request) bool

func (Request) LogValue

func (r Request) LogValue() slog.Value

Jump to

Keyboard shortcuts

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