http

package
v2.19.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointFromMethodAndURL

func EndpointFromMethodAndURL(method, url string) string

func SessionsSetRequestsToEndpointsSet

func SessionsSetRequestsToEndpointsSet(ss SessionSet) map[string]Endpoints

func SliceIntToString

func SliceIntToString(s []int) []string

func StatusPartsToFullStatus

func StatusPartsToFullStatus(status int, subStatus string) string

Types

type Endpoint

type Endpoint struct {
	Method   string
	URL      string
	Statuses Statuses
}

func (*Endpoint) AddStatus

func (ep *Endpoint) AddStatus(status int, subStatus string, dt time.Time)

type Endpoints

type Endpoints struct {
	EndpointsMap map[string]Endpoint
}

Endpoints writes a CSV with request data. Use Endpoints.Add(), Endpoints.Inflate() and then Endpoints.WriteCSV()

func NewEndpoints

func NewEndpoints() Endpoints

func SessionToEndpoints

func SessionToEndpoints(ses Session) Endpoints

func (*Endpoints) Add

func (eps *Endpoints) Add(method, url string, status int, subStatus string, dt time.Time)

Add. time is optional.

func (*Endpoints) AllFullStatusCodes

func (eps *Endpoints) AllFullStatusCodes() []string

func (*Endpoints) Inflate

func (eps *Endpoints) Inflate()

func (*Endpoints) WriteCSV

func (eps *Endpoints) WriteCSV(filename string) error

WriteCSV outputs a summary status table with a response status distribution for URL requests.

type Request

type Request struct {
	Method        string
	URL           string
	URLPattern    string
	StatusCode    int
	SubStatusCode string
	Time          time.Time
	OperationID   string // OpenAPI spec OperationID
	SessionID     string // native SessionID
	RequestID     string // native RequestID, typically UID
	RawData       any
	RawDataString string
}

func (*Request) Endpoint

func (req *Request) Endpoint() string

func (*Request) FullStatus

func (req *Request) FullStatus() string

type RequestSet

type RequestSet struct {
	LastStatusCode int
	Requests       []Request
}

func NewRequestSet

func NewRequestSet() RequestSet

func (*RequestSet) BuildLastStatusCode

func (rs *RequestSet) BuildLastStatusCode() int

func (*RequestSet) Inflate

func (rs *RequestSet) Inflate()

func (*RequestSet) SortByTime

func (rs *RequestSet) SortByTime()

type Session

type Session struct {
	SessionID  string
	RequestSet RequestSet
}

func NewSession

func NewSession(sessionID string) Session

func (*Session) RequestsByEndpoint

func (ses *Session) RequestsByEndpoint() map[string]RequestSet

type SessionSet

type SessionSet struct {
	SessionMap map[string]Session
}

func NewSessionSet

func NewSessionSet() SessionSet

func (*SessionSet) AddRequest

func (ss *SessionSet) AddRequest(r Request)

type StatusInfo

type StatusInfo struct {
	Status             int
	SubStatus          string
	RequestCount       int
	StatusDistribution float64     // This status vs. all statuses
	Times              []time.Time // This is optional. Can be used by manually adding to RequestCount
}

func (*StatusInfo) FullStatus

func (si *StatusInfo) FullStatus() string

func (*StatusInfo) Inflate

func (si *StatusInfo) Inflate()

func (*StatusInfo) StatusText

func (si *StatusInfo) StatusText() string

type StatusTime

type StatusTime struct {
	Method     string
	RequestURL string
	Status     int
	Time       time.Time
}

func StatusMapToTimesArray

func StatusMapToTimesArray(statuses map[string]StatusInfo) []StatusTime

type StatusTimeSlice

type StatusTimeSlice []StatusTime

type Statuses

type Statuses struct {
	StatusMap map[string]StatusInfo
}

func NewStatuses

func NewStatuses() Statuses

func (*Statuses) AllRequestCount

func (st *Statuses) AllRequestCount() int

func (*Statuses) Inflate

func (st *Statuses) Inflate()

Jump to

Keyboard shortcuts

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