Documentation
¶
Overview ¶
Package http contains the userspace portion of USM's HTTP monitoring code
Index ¶
Constants ¶
const (
BufferSize = 0xd0
)
Variables ¶
var ( // StringToMethod maps string representations of the methods to their enums. StringToMethod = map[string]Method{ nethttp.MethodPut: MethodPut, nethttp.MethodDelete: MethodDelete, nethttp.MethodHead: MethodHead, nethttp.MethodOptions: MethodOptions, nethttp.MethodPatch: MethodPatch, nethttp.MethodGet: MethodGet, nethttp.MethodPost: MethodPost, nethttp.MethodTrace: MethodTrace, nethttp.MethodConnect: MethodConnect, } // MethodToString maps the enums to their string representations MethodToString = map[Method]string{} )
var Interner = intern.NewStringInterner()
Interner is used to intern strings to save memory allocations.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key struct {
// this field order is intentional to help the GC pointer tracking
Path Path
types.ConnectionKey
Method Method
}
Key is an identifier for a group of HTTP transactions
func NewKey ¶
func NewKey(saddr, daddr util.Address, sport, dport uint16, path []byte, fullPath bool, method Method) Key
NewKey generates a new Key
func NewKeyWithConnection ¶
func NewKeyWithConnection(connKey types.ConnectionKey, path []byte, fullPath bool, method Method) Key
NewKeyWithConnection generates a new Key with a given connection tuple
type Method ¶
type Method uint8
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 // MethodTrace represents the TRACE request method MethodTrace // MethodConnect represents the CONNECT request method MethodConnect )
type Path ¶
type Path struct {
Content *intern.StringValue
FullPath bool
}
Path represents the HTTP path
type RequestStat ¶
type RequestStat struct {
// this field order is intentional to help the GC pointer tracking
Latencies *ddsketch.DDSketch
// Note: every time we add a latency value to the DDSketch, 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
// 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
// Tags bitfields from tags-types.h
StaticTags uint64
// Dynamic tags (if attached)
DynamicTags common.StringSet
}
RequestStat stores stats for HTTP requests to a particular path
type RequestStats ¶
type RequestStats struct {
Data map[uint16]*RequestStat
}
RequestStats stores HTTP request statistics.
func NewRequestStats ¶
func NewRequestStats() *RequestStats
NewRequestStats creates a new RequestStats object.
func (*RequestStats) AddRequest ¶
func (r *RequestStats) AddRequest(statusCode uint16, latency float64, staticTags uint64, dynamicTags common.StringSet)
AddRequest takes information about a HTTP transaction and adds it to the request stats
func (*RequestStats) Close ¶
func (r *RequestStats) Close()
Close releases internal stats resources.
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
func (*RequestStats) HalfAllCounts ¶
func (r *RequestStats) HalfAllCounts()
HalfAllCounts sets the count of all stats for each status class to half their current value. This is used to remove duplicates from the count in the context of Windows localhost traffic.
type SSLCtxPidTGID ¶
type SslReadArgs ¶
type SslReadExArgs ¶
type SslWriteArgs ¶
type SslWriteExArgs ¶
type URLQuantizer ¶
type URLQuantizer struct {
// contains filtered or unexported fields
}
URLQuantizer is responsible for quantizing URLs
func NewURLQuantizer ¶
func NewURLQuantizer() *URLQuantizer
NewURLQuantizer returns a new instance of a URLQuantizer
func (*URLQuantizer) Quantize ¶
func (q *URLQuantizer) Quantize(path []byte) []byte
Quantize path (eg /segment1/segment2/segment3) by doing the following: * If a segment contains only letters, we keep it as it is; * If a segment contains one or more digits or special characters, we replace it by '*' * If a segments represents an API version (eg. v123) we keep it as it is
Note that the quantization happens *in-place* and the supplied argument byte slice is modified, so the returned value will still point to the same underlying byte array.
Directories
¶
| Path | Synopsis |
|---|---|
|
lookup
Package lookup provides a lookup table for the protocol package.
|
Package lookup provides a lookup table for the protocol package. |
|
lookup/internal/testprogram
command
Package main provides a test program for generating lookup tables for TLS types
|
Package main provides a test program for generating lookup tables for TLS types |