http

package
v0.0.0-...-551a65d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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