Documentation ¶
Index ¶
- Constants
- func NewHAR(ctx core.Context) (core.OutputFormat, error)
- func NewInputFormat(ctx core.Context) (core.InputFormat, error)
- func NewMetricsOutput() *flow.Output
- func NewOutputFormat(ctx core.Context) (core.OutputFormat, error)
- type Correlator
- type HAR
- type Message
- type MessageType
- type Metrics
- type Request
- type Response
Constants ¶
const ( // TypeRequest is an HTTP request. TypeRequest = '0' // TypeResponse is an HTTP response. TypeResponse = '1' )
Variables ¶
This section is empty.
Functions ¶
func NewHAR ¶
func NewHAR(ctx core.Context) (core.OutputFormat, error)
NewHAR creates a mew HAR format.
func NewInputFormat ¶
func NewInputFormat(ctx core.Context) (core.InputFormat, error)
NewInputFormat creates an HTTP input formatter.
func NewMetricsOutput ¶
NewMetricsOutput creates a new *output.Pipe for calculating HTTP metrics
func NewOutputFormat ¶
func NewOutputFormat(ctx core.Context) (core.OutputFormat, error)
NewOutputFormat creates an HTTP output format.
Types ¶
type Correlator ¶
type Correlator struct { Messages chan Message Exchanges chan *Request // contains filtered or unexported fields }
Correlator aggregates HTTP requests and responses and creates a full exchange once a request's response is recieved. Requests that live longer than the timeout without a corresponding response are considered as not having a response and returned as-is.
func NewCorrelator ¶
func NewCorrelator(timeout time.Duration) *Correlator
NewCorrelator creates a new correlator.
func (*Correlator) Start ¶
func (c *Correlator) Start(ctx core.Context)
Start starts the correlator. Goroutines are now spawned internally within this method.
type HAR ¶
type HAR struct {
// contains filtered or unexported fields
}
HAR is an HTTP Archive. https://w3c.github.io/web-performance/specs/HAR/Overview.html http://www.softwareishard.com/blog/har-12-spec/
type Message ¶
type Message interface { GetConnectionID() string GetExchangeID() string SetCreated(time.Time) SetSessionID(string) }
Message is an HTTP message.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is a format that calculates HTTP metrics for Prometheus monitoring Note that this format does not modify data passing through it, it merely extracts metrics. Also note that this is a "dead end" format: its output io.Reader is never updated and remains empty.
type Request ¶
type Request struct { ConnectionID string `json:"connection_id,omitempty"` ExchangeID string `json:"exchange_id,omitempty"` Created time.Time `json:"created,omitempty"` Method string `json:"method,omitempty"` URL *url.URL `json:"url,omitempty"` Proto string `json:"proto,omitempty"` ProtoMajor int `json:"proto_major,omitempty"` ProtoMinor int `json:"proto_minor,omitempty"` Header http.Header `json:"header,omitempty"` MimeType string `json:"mimetype,omitempty"` PostForm url.Values `json:"postform,omitempty"` Cookies []*http.Cookie `json:"cookies,omitempty"` Body string `json:"body,omitempty"` ContentLength int64 `json:"content_length,omitempty"` TransferEncoding []string `json:"transfer_encoding,omitempty"` Host string `json:"host,omitempty"` Trailer http.Header `json:"trailer,omitempty"` RemoteAddr string `json:"remote_addr,omitempty"` RequestURI string `json:"request_uri,omitempty"` Response *Response `json:"response,omitempty"` SessionID string `json:"session_id,omitempty"` ClientAddr string `json:"client_addr,omitempty"` ClientPort string `json:"client_port,omitempty"` ServerAddr string `json:"server_addr,omitempty"` ServerPort string `json:"server_port,omitempty"` }
Request represents an HTTP request.
func NewRequest ¶
func NewRequest(b *bufio.Reader, connectionID string, exchangeID string, m *core.Meta) (*Request, error)
NewRequest creates a new Request.
func (*Request) GetConnectionID ¶
GetConnectionID gets a connection ID.
func (*Request) GetExchangeID ¶
GetExchangeID gets an exchange ID.
func (*Request) SetCreated ¶
SetCreated sets the created timestamp
func (*Request) SetSessionID ¶
SetSessionID sets the session ID
func (*Request) StdRequest ¶
StdRequest converts a Request into an *http.Request.
type Response ¶
type Response struct { ConnectionID string `json:"connection_id,omitempty"` ExchangeID string `json:"exchange_id"` Created time.Time `json:"created,omitempty"` Status string `json:"status,omitempty"` StatusCode int `json:"status_code,omitempty"` Proto string `json:"proto,omitempty"` ProtoMajor int `json:"proto_major,omitempty"` ProtoMinor int `json:"proto_minor,omitempty"` Header http.Header `json:"header,omitempty"` Cookies []*http.Cookie `json:"cookies,omitempty"` Body string `json:"body,omitempty"` ContentLength int64 `json:"content_length,omitempty"` TransferEncoding []string `json:"transfer_encoding,omitempty"` Close bool `json:"close,omitempty"` Uncompressed bool `json:"uncompressed,omitempty"` Trailer http.Header `json:"trailer,omitempty"` SessionID string `json:"session_id,omitempty"` Location string `json:"location,omitempty"` ClientAddr string `json:"client_addr,omitempty"` ClientPort string `json:"client_port,omitempty"` ServerAddr string `json:"server_addr,omitempty"` ServerPort string `json:"server_port,omitempty"` }
Response represents an HTTP response.
func NewResponse ¶
NewResponse creates a new Response.
func (*Response) GetConnectionID ¶
GetConnectionID gets a connection ID.
func (*Response) GetExchangeID ¶
GetExchangeID gets an exchange ID.
func (*Response) SetCreated ¶
SetCreated sets the created timestamp
func (*Response) SetSessionID ¶
SetSessionID sets the session ID