Documentation
¶
Index ¶
- Constants
- Variables
- func BuildInvokeAppError(err error, invokeTimeout time.Duration) model.AppError
- func NewInvokeMetrics(logger servicelogs.Logger, counter Counter) *invokeMetrics
- func NewRuntimeError(ctx context.Context, request *http.Request, invokeID interop.InvokeID, ...) runtimeError
- func NewRuntimeResponse(ctx context.Context, request *http.Request, invokeID interop.InvokeID) runtimeResponse
- type Counter
- type ErrorForInvoker
- type InvokeBodyResponseStatus
- type InvokeResponseSender
- type InvokeRouter
- func (ir *InvokeRouter) AbortRunningInvokes(metrics interop.ShutdownMetrics, err model.AppError)
- func (ir *InvokeRouter) GetIdleRuntimesCount() int
- func (ir *InvokeRouter) GetRunningInvokesCount() int
- func (ir *InvokeRouter) Invoke(ctx context.Context, initData interop.InitStaticDataProvider, ...) (err model.AppError, wasResponseSent bool)
- func (ir *InvokeRouter) RuntimeError(ctx context.Context, runtimeErrReq RuntimeErrorRequest) model.AppError
- func (ir *InvokeRouter) RuntimeNext(ctx context.Context, runtimeReq http.ResponseWriter) (model.RuntimeNextWaiter, model.AppError)
- func (ir *InvokeRouter) RuntimeResponse(ctx context.Context, runtimeRespReq RuntimeResponseRequest) model.AppError
- type MockCounter
- type MockErrorForInvoker
- type MockInvokeResponseSender
- func (_m *MockInvokeResponseSender) ErrorPayloadSizeBytes() int
- func (_m *MockInvokeResponseSender) SendError(_a0 ErrorForInvoker, _a1 interop.InitStaticDataProvider)
- func (_m *MockInvokeResponseSender) SendErrorTrailers(_a0 ErrorForInvoker, _a1 InvokeBodyResponseStatus)
- func (_m *MockInvokeResponseSender) SendRuntimeResponseBody(ctx context.Context, runtimeResp RuntimeResponseRequest, ...) SendResponseBodyResult
- func (_m *MockInvokeResponseSender) SendRuntimeResponseHeaders(initData interop.InitStaticDataProvider, contentType string, ...)
- func (_m *MockInvokeResponseSender) SendRuntimeResponseTrailers(_a0 RuntimeResponseRequest)
- type MockResponderFactoryFunc
- type MockRuntimeErrorRequest
- func (_m *MockRuntimeErrorRequest) ContentType() string
- func (_m *MockRuntimeErrorRequest) ErrorCategory() model.ErrorCategory
- func (_m *MockRuntimeErrorRequest) ErrorDetails() string
- func (_m *MockRuntimeErrorRequest) ErrorType() model.ErrorType
- func (_m *MockRuntimeErrorRequest) GetError() model.AppError
- func (_m *MockRuntimeErrorRequest) GetXrayErrorCause() json.RawMessage
- func (_m *MockRuntimeErrorRequest) InvokeID() string
- func (_m *MockRuntimeErrorRequest) IsRuntimeError(_a0 model.AppError) bool
- func (_m *MockRuntimeErrorRequest) ReturnCode() int
- type MockRuntimeResponseRequest
- func (_m *MockRuntimeResponseRequest) BodyReader() io.Reader
- func (_m *MockRuntimeResponseRequest) ContentType() string
- func (_m *MockRuntimeResponseRequest) InvokeID() string
- func (_m *MockRuntimeResponseRequest) ParsingError() model.AppError
- func (_m *MockRuntimeResponseRequest) ResponseMode() string
- func (_m *MockRuntimeResponseRequest) TrailerError() ErrorForInvoker
- type ResponderFactoryFunc
- type RuntimeErrorRequest
- type RuntimeResponseRequest
- type SendResponseBodyResult
Constants ¶
View Source
const ( СontentTypeHeader = "content-type" FunctionErrorTypeTrailer = "lambda-runtime-function-error-type" FunctionErrorBodyTrailer = "lambda-runtime-function-error-body" ResponseModeHeader = "invoke-response-mode" TraceIdHeader = "x-amzn-trace-id" )
View Source
const ( ResponseLatencySpanName = "responseLatency" ResponseDurationSpanName = "responseDuration" )
View Source
const ( InvokeTimeoutProperty = "InvokeTimeoutSeconds" RequestResponseModeDimension = "RequestMode" ResponseModeDimension = "ResponseMode" RequestSendDurationMetric = "RequestSendDuration" RequestPayloadReadDurationMetric = "RequestPayloadReadDuration" RequestPayloadWriteDurationMetric = "RequestPayloadWriteDuration" ResponseLatencyMetric = "ResponseLatency" ResponseDurationMetric = "ResponseDuration" FunctionDurationMetric = "FunctionDuration" RequestPayloadSizeBytesMetric = "RequestPayloadSizeBytes" ResponsePayloadSizeBytesMetric = "ResponsePayloadSizeBytes" ResponsePayloadReadDurationMetric = "ResponsePayloadReadDuration" ResponsePayloadWriteDurationMetric = "ResponsePayloadWriteDuration" ErrorPayloadSizeBytesMetric = "ErrorPayloadSizeBytes" ResponseThrottledDurationMetric = "ResponseThrottledDuration" ResponseThroughputMetric = "ResponseThroughput" InflightRequestCountMetric = "InflightRequestCount" IdleRuntimesCountMetric = "IdleRuntimesCount" )
View Source
const ( RuntimeErrorTypeHeader = "Lambda-Runtime-Function-Error-Type" RuntimeErrorCategory = "Error.Runtime" LambdaXRayErrorCauseHeader = "Lambda-Runtime-Function-XRay-Error-Cause" )
View Source
const ( RuntimeContentTypeHeader = "Content-Type" RuntimeRequestIdHeader = "Lambda-Runtime-Aws-Request-Id" RuntimeDeadlineHeader = "Lambda-Runtime-Deadline-Ms" RuntimeFunctionArnHeader = "Lambda-Runtime-Invoked-Function-Arn" RuntimeTraceIdHeader = "Lambda-Runtime-Trace-Id" RuntimeClientContextHeader = "Lambda-Runtime-Client-Context" RuntimeCognitoIdentifyHeader = "Lambda-Runtime-Cognito-Identity" )
View Source
const (
RuntimeResponseModeHeader = "Lambda-Runtime-Function-Response-Mode"
)
Variables ¶
View Source
var ( ErrInvokeIdAlreadyExists = errors.New("invoke ID already exists") ErrInvokeNoReadyRuntime = errors.New("no idle runtimes") )
Functions ¶
func BuildInvokeAppError ¶
func NewInvokeMetrics ¶
func NewInvokeMetrics(logger servicelogs.Logger, counter Counter) *invokeMetrics
func NewRuntimeError ¶
Types ¶
type ErrorForInvoker ¶
type InvokeBodyResponseStatus ¶
type InvokeBodyResponseStatus string
const ( InvokeBodyResponseComplete InvokeBodyResponseStatus = "Complete" InvokeBodyResponseTruncated InvokeBodyResponseStatus = "Truncated" )
type InvokeResponseSender ¶
type InvokeResponseSender interface {
SendRuntimeResponseHeaders(initData interop.InitStaticDataProvider, contentType, responseMode string)
SendRuntimeResponseBody(ctx context.Context, runtimeResp RuntimeResponseRequest, functionTimeout time.Duration) SendResponseBodyResult
SendRuntimeResponseTrailers(RuntimeResponseRequest)
SendError(ErrorForInvoker, interop.InitStaticDataProvider)
SendErrorTrailers(ErrorForInvoker, InvokeBodyResponseStatus)
ErrorPayloadSizeBytes() int
}
type InvokeRouter ¶
type InvokeRouter struct {
// contains filtered or unexported fields
}
func NewInvokeRouter ¶
func NewInvokeRouter( maxIdleRuntimesQueueSize int, telemetryEventsApi interop.EventsAPI, responderFactoryFunc ResponderFactoryFunc, timeoutCache timeoutCache, ) *InvokeRouter
func (*InvokeRouter) AbortRunningInvokes ¶
func (ir *InvokeRouter) AbortRunningInvokes(metrics interop.ShutdownMetrics, err model.AppError)
func (*InvokeRouter) GetIdleRuntimesCount ¶
func (ir *InvokeRouter) GetIdleRuntimesCount() int
func (*InvokeRouter) GetRunningInvokesCount ¶
func (ir *InvokeRouter) GetRunningInvokesCount() int
func (*InvokeRouter) Invoke ¶
func (ir *InvokeRouter) Invoke(ctx context.Context, initData interop.InitStaticDataProvider, invokeReq interop.InvokeRequest, metrics interop.InvokeMetrics) (err model.AppError, wasResponseSent bool)
func (*InvokeRouter) RuntimeError ¶
func (ir *InvokeRouter) RuntimeError(ctx context.Context, runtimeErrReq RuntimeErrorRequest) model.AppError
func (*InvokeRouter) RuntimeNext ¶
func (ir *InvokeRouter) RuntimeNext(ctx context.Context, runtimeReq http.ResponseWriter) (model.RuntimeNextWaiter, model.AppError)
func (*InvokeRouter) RuntimeResponse ¶
func (ir *InvokeRouter) RuntimeResponse(ctx context.Context, runtimeRespReq RuntimeResponseRequest) model.AppError
type MockCounter ¶
func NewMockCounter ¶
func NewMockCounter(t interface {
mock.TestingT
Cleanup(func())
}) *MockCounter
func (*MockCounter) AddInvoke ¶
func (_m *MockCounter) AddInvoke(proxiedBytes uint64)
type MockErrorForInvoker ¶
func NewMockErrorForInvoker ¶
func NewMockErrorForInvoker(t interface {
mock.TestingT
Cleanup(func())
}) *MockErrorForInvoker
func (*MockErrorForInvoker) ErrorCategory ¶
func (_m *MockErrorForInvoker) ErrorCategory() model.ErrorCategory
func (*MockErrorForInvoker) ErrorDetails ¶
func (_m *MockErrorForInvoker) ErrorDetails() string
func (*MockErrorForInvoker) ErrorType ¶
func (_m *MockErrorForInvoker) ErrorType() model.ErrorType
func (*MockErrorForInvoker) ReturnCode ¶
func (_m *MockErrorForInvoker) ReturnCode() int
type MockInvokeResponseSender ¶
func NewMockInvokeResponseSender ¶
func NewMockInvokeResponseSender(t interface {
mock.TestingT
Cleanup(func())
}) *MockInvokeResponseSender
func (*MockInvokeResponseSender) ErrorPayloadSizeBytes ¶
func (_m *MockInvokeResponseSender) ErrorPayloadSizeBytes() int
func (*MockInvokeResponseSender) SendError ¶
func (_m *MockInvokeResponseSender) SendError(_a0 ErrorForInvoker, _a1 interop.InitStaticDataProvider)
func (*MockInvokeResponseSender) SendErrorTrailers ¶
func (_m *MockInvokeResponseSender) SendErrorTrailers(_a0 ErrorForInvoker, _a1 InvokeBodyResponseStatus)
func (*MockInvokeResponseSender) SendRuntimeResponseBody ¶
func (_m *MockInvokeResponseSender) SendRuntimeResponseBody(ctx context.Context, runtimeResp RuntimeResponseRequest, functionTimeout time.Duration) SendResponseBodyResult
func (*MockInvokeResponseSender) SendRuntimeResponseHeaders ¶
func (_m *MockInvokeResponseSender) SendRuntimeResponseHeaders(initData interop.InitStaticDataProvider, contentType string, responseMode string)
func (*MockInvokeResponseSender) SendRuntimeResponseTrailers ¶
func (_m *MockInvokeResponseSender) SendRuntimeResponseTrailers(_a0 RuntimeResponseRequest)
type MockResponderFactoryFunc ¶
func NewMockResponderFactoryFunc ¶
func NewMockResponderFactoryFunc(t interface {
mock.TestingT
Cleanup(func())
}) *MockResponderFactoryFunc
func (*MockResponderFactoryFunc) Execute ¶
func (_m *MockResponderFactoryFunc) Execute(_a0 context.Context, _a1 interop.InvokeRequest) InvokeResponseSender
type MockRuntimeErrorRequest ¶
func NewMockRuntimeErrorRequest ¶
func NewMockRuntimeErrorRequest(t interface {
mock.TestingT
Cleanup(func())
}) *MockRuntimeErrorRequest
func (*MockRuntimeErrorRequest) ContentType ¶
func (_m *MockRuntimeErrorRequest) ContentType() string
func (*MockRuntimeErrorRequest) ErrorCategory ¶
func (_m *MockRuntimeErrorRequest) ErrorCategory() model.ErrorCategory
func (*MockRuntimeErrorRequest) ErrorDetails ¶
func (_m *MockRuntimeErrorRequest) ErrorDetails() string
func (*MockRuntimeErrorRequest) ErrorType ¶
func (_m *MockRuntimeErrorRequest) ErrorType() model.ErrorType
func (*MockRuntimeErrorRequest) GetError ¶
func (_m *MockRuntimeErrorRequest) GetError() model.AppError
func (*MockRuntimeErrorRequest) GetXrayErrorCause ¶
func (_m *MockRuntimeErrorRequest) GetXrayErrorCause() json.RawMessage
func (*MockRuntimeErrorRequest) InvokeID ¶
func (_m *MockRuntimeErrorRequest) InvokeID() string
func (*MockRuntimeErrorRequest) IsRuntimeError ¶
func (_m *MockRuntimeErrorRequest) IsRuntimeError(_a0 model.AppError) bool
func (*MockRuntimeErrorRequest) ReturnCode ¶
func (_m *MockRuntimeErrorRequest) ReturnCode() int
type MockRuntimeResponseRequest ¶
func NewMockRuntimeResponseRequest ¶
func NewMockRuntimeResponseRequest(t interface {
mock.TestingT
Cleanup(func())
}) *MockRuntimeResponseRequest
func (*MockRuntimeResponseRequest) BodyReader ¶
func (_m *MockRuntimeResponseRequest) BodyReader() io.Reader
func (*MockRuntimeResponseRequest) ContentType ¶
func (_m *MockRuntimeResponseRequest) ContentType() string
func (*MockRuntimeResponseRequest) InvokeID ¶
func (_m *MockRuntimeResponseRequest) InvokeID() string
func (*MockRuntimeResponseRequest) ParsingError ¶
func (_m *MockRuntimeResponseRequest) ParsingError() model.AppError
func (*MockRuntimeResponseRequest) ResponseMode ¶
func (_m *MockRuntimeResponseRequest) ResponseMode() string
func (*MockRuntimeResponseRequest) TrailerError ¶
func (_m *MockRuntimeResponseRequest) TrailerError() ErrorForInvoker
type ResponderFactoryFunc ¶
type ResponderFactoryFunc func(context.Context, interop.InvokeRequest) InvokeResponseSender
type RuntimeErrorRequest ¶
type RuntimeResponseRequest ¶
type SendResponseBodyResult ¶
type SendResponseBodyResult struct {
Metrics interop.InvokeResponseMetrics
Err model.AppError
}
Source Files
¶
- consts.go
- invoke_router.go
- metrics.go
- mock_counter.go
- mock_error_for_invoker.go
- mock_invoke_response_sender.go
- mock_responder_factory_func.go
- mock_running_invoke.go
- mock_runtime_error_request.go
- mock_runtime_response_request.go
- mock_timeout_cache.go
- running_invoke.go
- runtime_error_request.go
- runtime_response_request.go
- runtime_response_sender.go
- utils.go
Click to show internal directories.
Click to hide internal directories.