Documentation
¶
Index ¶
- type Collector
- type Common
- type Coverage
- func (c *Coverage) HasFailures() bool
- func (c *Coverage) LoadSpec(r io.Reader) (err error)
- func (c *Coverage) ReportFailure(endpoint common.Endpoint, method common.Method, req *http.Request, err error)
- func (c *Coverage) ReportMet(endpoint common.Endpoint, method common.Method, req *http.Request, ...)
- func (c *Coverage) ReportSkipped(endpoint common.Endpoint, method common.Method, req *http.Request, ...)
- func (c *Coverage) ReportTiming(endpoint common.Endpoint, method common.Method, req *http.Request, ...)
- func (c *Coverage) ReportUnmet(endpoint common.Endpoint, method common.Method, req *http.Request, ...)
- func (c *Coverage) SpecCoverage() (*Spec, error)
- type Endpoint
- type Failure
- type Met
- type Method
- type Skip
- type Spec
- type SpecMethod
- type SpecPath
- type Timing
- type TimingStats
- type Timings
- type TraceTiming
- type Unmet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector interface {
LoadSpec(r io.Reader) (err error)
ReportFailure(endpoint common.Endpoint, method common.Method, req *http.Request, err error)
ReportUnmet(endpoint common.Endpoint, method common.Method, req *http.Request, exp common.Expectation, err error)
ReportMet(endpoint common.Endpoint, method common.Method, req *http.Request, exp common.Expectation)
ReportSkipped(endpoint common.Endpoint, method common.Method, req *http.Request, exp common.Expectation)
ReportTiming(endpoint common.Endpoint, method common.Method, req *http.Request, dur time.Duration, tt *TraceTiming)
HasFailures() bool
}
Collector is the interface for collecting coverage information
func NewNullCoverage ¶
func NewNullCoverage() Collector
type Coverage ¶
type Coverage struct {
Endpoints map[string]*Endpoint
OAS *chioas.Definition
Common
// contains filtered or unexported fields
}
Coverage is the default coverage information
func NewCoverage ¶
func NewCoverage() *Coverage
func (*Coverage) HasFailures ¶
func (*Coverage) ReportFailure ¶
func (*Coverage) ReportSkipped ¶
func (*Coverage) ReportTiming ¶
func (*Coverage) ReportUnmet ¶
func (*Coverage) SpecCoverage ¶
type Failure ¶
type Failure struct {
Endpoint common.Endpoint
Method common.Method
Request *http.Request
Error error
}
Failure provides coverage information about a failure
type Met ¶
type Met struct {
Endpoint common.Endpoint
Method common.Method
Request *http.Request
Expectation common.Expectation
}
Met provides coverage information about a met expectation
type Skip ¶
type Skip struct {
Endpoint common.Endpoint
Method common.Method
Request *http.Request
Expectation common.Expectation
}
Skip provides coverage information about a skipped expectation
type Spec ¶
type Spec struct {
CoveredPaths map[string]*SpecPath
NonCoveredPaths map[string]*SpecPath
UnknownPaths map[string]*SpecPath
}
Spec provides coverage information against a supplied OAS
func (*Spec) MethodsCovered ¶
type SpecPath ¶
type SpecPath struct {
Path string
PathDef *chioas.Path
CoveredMethods map[string]*SpecMethod
NonCoveredMethods map[string]*SpecMethod
UnknownMethods map[string]*SpecMethod
}
type Timing ¶
type Timing struct {
Endpoint common.Endpoint
Method common.Method
Request *http.Request
Duration time.Duration
Trace *TraceTiming
}
Timing provides coverage information about an individual endpoint+method call
type TimingStats ¶
type TimingStats struct {
// Mean is the mean average response time. Gives a sense of typical latency under the current test conditions
Mean time.Duration
// StdDev is the standard deviation - how much individual response times deviate from the mean.
//
// A small StdDev means responses are consistent; a large one means erratic latency
StdDev time.Duration // sqrt(Variance)
// Variance is how much response times vary - in squared seconds.
//
// The lower the value, the better. A high value indicates jitter and inconsistent response times
Variance float64 // in seconds²
// Minimum is the fastest observed response time. Indicates best-case performance
Minimum time.Duration
// Maximum is the slowest observed response time. Often reveals worst-case outliers (e.g., cold starts, timeouts)
Maximum time.Duration
// P50 is the median response time - half the runs were faster, half slower.
//
// Unlike Mean, it’s robust to outliers. Indicates “Typical” latency.
P50 time.Duration
// P90 is the 90th percentile of response times - 9 out of 10 runs were this fast or faster.
//
// Useful for SLO/SLA checks.
P90 time.Duration
// P99 is the 99th percentile of response times - highlights rare but serious tail latencies.
P99 time.Duration
// Count is how many timings the stats are based on.
//
// Important for trustworthiness: low counts mean less reliable percentiles.
Count int
// Sample is whether the Variance / StdDev were computed using sample (n-1) or population (n) denominator — mostly for internal correctness.
Sample bool
}
TimingStats is the timing statistics (as returned by Timings.Stats)
type Timings ¶
type Timings []Timing
Timings is a slice of Timing
func (Timings) Outliers ¶
Outliers returns the subset of timings whose Duration is at or above the given percentile threshold (upper-tail). For example, p=0.99 returns the slowest ~1% of requests. If timings is empty, returns nil. Percentile is clamped into [0,1]. p==0 returns all, p==1 returns only the max(es).
Returned timings are sorted - slowest appearing last
type TraceTiming ¶
type TraceTiming struct {
Start time.Time
DNSStart, DNSDone time.Time
ConnStart, ConnDone time.Time
TLSStart, TLSDone time.Time
WroteReq time.Time
FirstByte time.Time
ReusedConn bool
TTFB time.Duration
}
TraceTiming is used for more precise timing information (use with.TraceTimings to collect this information)