backend

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryAfter

func IsRetryAfter(resp *http.Response) (string, bool)

isRetryAfter returns true along with a number of seconds if the server instructed us to wait before retrying.

func WithRequestContextAssociatedData

func WithRequestContextAssociatedData(parent context.Context, data *RequestContextAssociatedData) context.Context

WithRequestContextAssociatedData attaches the specified RequestContextAssociatedData instance to the request context.

Types

type Client

type Client interface {
	Do(*http.Request) (*http.Response, error)
}

Client sends a given request to the server, and returns the response from the server.

type ClientFunc

type ClientFunc func(*http.Request) (*http.Response, error)

func (ClientFunc) Do

func (f ClientFunc) Do(r *http.Request) (*http.Response, error)

type GotConnInfo

type GotConnInfo struct {
	// RemoteAddr returns the remote network address, if known.
	RemoteAddr string

	// Reused is whether this connection has been previously
	// used for another HTTP request.
	Reused bool

	// WasIdle is whether this connection was obtained from an
	// idle pool.
	WasIdle bool

	// IdleTime reports how long the connection was previously
	// idle, if WasIdle is true.
	IdleTime time.Duration
}

GotConnInfo similar to net/http GotConnInfo without the connection object

func (GotConnInfo) String

func (ci GotConnInfo) String() string

type HostNameDecoder

type HostNameDecoder interface {
	Decode(string) string
}

HostNameDecoder is responsible for decoding the APIServerIdentity into the human readable hostname.

type HostNameDecoderWithRunner

type HostNameDecoderWithRunner interface {
	HostNameDecoder
	Run(stop context.Context) (done context.Context)
}

HostNameDecoderWithRunner is a HostNameDecoder and also have a Run method that runs asynchronously in order to get the host name(s) from the cluster.

type LoadBalancerType

type LoadBalancerType string
const (
	ExternalLoadBalancerType LoadBalancerType = "external-lb"
	InternalLoadBalancerType LoadBalancerType = "internal-lb"
	ServiceNetworkType       LoadBalancerType = "service-network"
	LocalhostType            LoadBalancerType = "localhost"
)

func ParseStringToLoadBalancerType

func ParseStringToLoadBalancerType(input string) LoadBalancerType

type ProtocolType

type ProtocolType string
const (
	ProtocolHTTP1 ProtocolType = "http1"
	ProtocolHTTP2 ProtocolType = "http2"
)

type RequestContextAssociatedData

type RequestContextAssociatedData struct {
	// GotConnInfo is the data obtained from the GotConn client
	// connection trace for this request.
	GotConnInfo *GotConnInfo

	// DNSErr is set if the there was an error during DNS lookup,
	// this is obtained from the DNSDone client connection trace.
	DNSErr error

	// RoundTripDuration is the latency incurred in the
	// round trip for this request.
	RoundTripDuration time.Duration

	// ResponseBody is the stored bytes that was obtained from reading
	// off the body of the response received from the server
	ResponseBody []byte
	// ResponseBodyReadErr is set if any error occurs while reading the
	// body of the response, or while closing the underlying stream.
	ResponseBodyReadErr error

	// ShutdownResponse holds the result of parsing the 'X-OpenShift-Disruption'
	// response header, it will be nil if ShutdownResponseHeaderParseErr is set.
	ShutdownResponse *ShutdownResponse
	// ShutdownResponseHeaderParseErr is set if there was an error parsing the
	// 'X-OpenShift-Disruption' response header
	ShutdownResponseHeaderParseErr error

	// Source contains pod name if incluster monitor is used
	Source string
}

RequestContextAssociatedData holds the data that is associated with the request context, each round tripper utilizes this association to attach relevant diagnostic data associated with the request.

func RequestContextAssociatedDataFrom

func RequestContextAssociatedDataFrom(ctx context.Context) *RequestContextAssociatedData

RequestContextAssociatedDataFrom retrieves the associated RequestContextAssociatedData instance from the request context.

type RequestResponse

type RequestResponse struct {
	// Request and Response associated with this backend sample.
	// NOTE: the body of the response will have been read and closed
	//  immediately after getting the response from the server.
	// Request may be nil if the sampler fails to create a new request
	// Response may be nil in case the server returned an error
	Request  *http.Request
	Response *http.Response

	// RequestContextAssociatedData holds the data
	// stored in the request context.
	RequestContextAssociatedData
}

RequestResponse holds the given HTTP request, HTTP Response sent from the server, and request scoped diagnostic data attached by round trippers

func (RequestResponse) ConnectionReused

func (rr RequestResponse) ConnectionReused() string

func (RequestResponse) Fields

func (rr RequestResponse) Fields() map[string]interface{}

func (RequestResponse) GetAuditID

func (rr RequestResponse) GetAuditID() string

func (RequestResponse) IsRetryAfter

func (rr RequestResponse) IsRetryAfter() (string, bool)

func (RequestResponse) Protocol

func (rr RequestResponse) Protocol() string

func (RequestResponse) RetryAfter

func (rr RequestResponse) RetryAfter() string

func (RequestResponse) ShutdownInProgress

func (rr RequestResponse) ShutdownInProgress() bool

func (RequestResponse) StatusCode

func (rr RequestResponse) StatusCode() string

func (RequestResponse) String

func (rr RequestResponse) String() string

type SampleResult

type SampleResult struct {
	RequestResponse
	Sample *sampler.Sample
}

SampleResult holds the result of a request (sample) sent to the server

func (SampleResult) AggregateErr

func (s SampleResult) AggregateErr() error

func (SampleResult) Err

func (s SampleResult) Err() error

func (SampleResult) Error

func (s SampleResult) Error() string

func (SampleResult) Succeeded

func (s SampleResult) Succeeded() bool

type ShutdownResponse

type ShutdownResponse struct {
	// ShutdownInProgress is true if a graceful shutdown was in
	// progress when the request was received by the server,
	// otherwise this is false.
	ShutdownInProgress bool

	// ShutdownDelayDuration is the value of the --shutdown-delay-duration
	// server run option in use.
	ShutdownDelayDuration time.Duration

	// Elapsed is the amount of time elapsed since the server has
	// received the TERM signal, if the server is not shutting
	// down then this value is zero.
	Elapsed time.Duration

	// Hostname is the hostname of the apiserver process
	Hostname string
}

ShutdownResponse holds the result of parsing the 'X-OpenShift-Disruption' response header:

format: shutdown=%t shutdown-delay-duration=%s elapsed=%s host=%s

func (ShutdownResponse) Fields

func (sr ShutdownResponse) Fields() map[string]interface{}

func (ShutdownResponse) String

func (sr ShutdownResponse) String() string

type TestDescriptor

type TestDescriptor interface {
	Name() string
	DisruptionLocator() monitorapi.Locator
	ShutdownLocator() monitorapi.Locator
	GetLoadBalancerType() LoadBalancerType
	GetProtocol() ProtocolType
	GetConnectionType() monitorapi.BackendConnectionType
	GetTargetServerName() string
}

TestDescriptor describes a backend disruption test

type WantEventRecorderAndMonitorRecorder

type WantEventRecorderAndMonitorRecorder interface {
	SetEventRecorder(events.EventRecorder)
	SetMonitorRecorder(monitorRecorder monitorapi.RecorderWriter)
}

WantEventRecorderAndMonitorRecorder allows the test driver to pass on the shared event recorder and the monitor instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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