middleware

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggressivePollingOptions

func AggressivePollingOptions() *runtime.PollUntilDoneOptions

AggressivePollingOptions is a very aggressive set of poller options

func DefaultArmOpts

func DefaultArmOpts(userAgent string, logCollector ArmRequestMetricCollector, customPerCallPolicies ...policy.Policy) *arm.ClientOptions

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient returns a shared http client, and transport leveraging armbalancer for clientside loadbalancing, so we can leverage HTTP/2, and not get throttled by arm at the instance level.

func DefaultRetryOpts

func DefaultRetryOpts() policy.RetryOptions

func DefaultTelemetryOpts

func DefaultTelemetryOpts(userAgent string) policy.TelemetryOptions

Types

type ArmError

type ArmError struct {
	Code    ArmErrorCode `json:"code"`
	Message string       `json:"message"`
}

ArmError is unified Error Experience across AzureResourceManager, it contains Code Message.

type ArmErrorCode added in v0.1.2

type ArmErrorCode string
const (
	ArmErrorCodeCastToArmResponseErrorFailed ArmErrorCode = "CastToArmResponseErrorFailed"
	ArmErrorCodeTransportError               ArmErrorCode = "TransportError"
	ArmErrorCodeUnexpectedTransportError     ArmErrorCode = "UnexpectedTransportError"
	ArmErrorCodeContextCanceled              ArmErrorCode = "ContextCanceled"
	ArmErrorCodeContextDeadlineExceeded      ArmErrorCode = "ContextDeadlineExceeded"
)

type ArmRequestMetricCollector

type ArmRequestMetricCollector interface {
	// RequestStarted is called when a request is about to be sent.
	// context is not provided, get it from RequestInfo.Request.Context()
	RequestStarted(*RequestInfo)

	// RequestCompleted is called when a request is finished
	// context is not provided, get it from RequestInfo.Request.Context()
	// if an error occurred, ResponseInfo.Error will be populated
	RequestCompleted(*RequestInfo, *ResponseInfo)
}

ArmRequestMetricCollector is a interface that collectors need to implement. TODO: use *policy.Request or *http.Request?

type ArmRequestMetricPolicy

type ArmRequestMetricPolicy struct {
	Collector ArmRequestMetricCollector
}

ArmRequestMetricPolicy is a policy that collects metrics/telemetry for ARM requests.

func (*ArmRequestMetricPolicy) Do

Do implements the azcore/policy.Policy interface.

type HttpConnTracking

type HttpConnTracking struct {
	TotalLatency string
	DnsLatency   string
	ConnLatency  string
	TlsLatency   string
	Protocol     string
	ReqConnInfo  *httptrace.GotConnInfo
}

type QueryParameterPolicy added in v0.1.3

type QueryParameterPolicy struct {
	Name    string
	Value   string
	Replace bool
}

func (*QueryParameterPolicy) Do added in v0.1.3

type RequestInfo

type RequestInfo struct {
	Request  *http.Request
	ArmResId *arm.ResourceID
}

type ResponseInfo

type ResponseInfo struct {
	Response      *http.Response
	Error         *ArmError
	Latency       time.Duration
	RequestId     string
	CorrelationId string
	ConnTracking  *HttpConnTracking
}

Jump to

Keyboard shortcuts

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