http

package
v0.0.0-...-bdf9480 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const NumStatusClasses = 5

NumStatusClasses represents the number of HTTP status classes (1XX, 2XX, 3XX, 4XX, 5XX)

View Source
const RelativeAccuracy = 0.01

RelativeAccuracy defines the acceptable error in quantile values calculated by DDSketch. For example, if the actual value at p50 is 100, with a relative accuracy of 0.01 the value calculated will be between 99 and 101

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	SrcIPHigh uint64
	SrcIPLow  uint64
	SrcPort   uint16

	DstIPHigh uint64
	DstIPLow  uint64
	DstPort   uint16

	Path   string
	Method Method
}

Key is an identifier for a group of HTTP transactions

func NewKey

func NewKey(saddr, daddr util.Address, sport, dport uint16, path string, method Method) Key

NewKey generates a new Key

type Method

type Method int

Method is the type used to represent HTTP request methods

const (
	// MethodUnknown represents an unknown request method
	MethodUnknown Method = iota
	// MethodGet represents the GET request method
	MethodGet
	// MethodPost represents the POST request method
	MethodPost
	// MethodPut represents the PUT request method
	MethodPut
	// MethodDelete represents the DELETE request method
	MethodDelete
	// MethodHead represents the HEAD request method
	MethodHead
	// MethodOptions represents the OPTIONS request method
	MethodOptions
	// MethodPatch represents the PATCH request method
	MethodPatch
)

func (Method) String

func (m Method) String() string

Method returns a string representing the HTTP method of the request

type MonitorReport

type MonitorReport struct {
	Requests  map[Key]RequestStats
	Telemetry *TelemetryStats
}

MonitorReport contains requests stats along with the performance of the HTTP monitor (e.g. number of lost batches)

type RequestStats

type RequestStats [NumStatusClasses]struct {
	// Note: every time we add a latency value to the DDSketch below, it's possible for the sketch to discard that value
	// (ie if it is outside the range that is tracked by the sketch). For that reason, in order to keep an accurate count
	// the number of http transactions processed, we have our own count field (rather than relying on DDSketch.GetCount())
	Count     int
	Latencies *ddsketch.DDSketch

	// This field holds the value (in nanoseconds) of the first HTTP request
	// in this bucket. We do this as optimization to avoid creating sketches with
	// a single value. This is quite common in the context of HTTP requests without
	// keep-alives where a short-lived TCP connection is used for a single request.
	FirstLatencySample float64
}

RequestStats stores stats for HTTP requests to a particular path, organized by the class of the response code (1XX, 2XX, 3XX, 4XX, 5XX)

func (*RequestStats) AddRequest

func (r *RequestStats) AddRequest(statusClass int, latency float64)

AddRequest takes information about a HTTP transaction and adds it to the request stats

func (*RequestStats) CombineWith

func (r *RequestStats) CombineWith(newStats RequestStats)

CombineWith merges the data in 2 RequestStats objects newStats is kept as it is, while the method receiver gets mutated

type TelemetryStats

type TelemetryStats struct {
	Misses   int64 // this happens when we can't cope with the rate of events
	Dropped  int64 // this happens when httpStatKeeper reaches capacity
	Rejected int64 // this happens when a user-defined reject-filter matches a request
}

TelemetryStats contains counters of the http monitor performance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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