http

package
v0.0.2-0...-4ce78c8 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0, 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
}

Key is an identifier for a group of HTTP transactions

func NewKey

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

NewKey generates a new Key

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 milliseconds) 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

Jump to

Keyboard shortcuts

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