Documentation ¶
Index ¶
- Constants
- type BufferingCfg
- type Client
- func (e *Client) InitError(ctx context.Context, extensionId string, errorType FunctionErrorType, ...) error
- func (e *Client) NextEvent(ctx context.Context, extensionId string) (ExtensionEventType, []byte, error)
- func (e *Client) Register(ctx context.Context, filename string) (string, *RegisterResponse, error)
- func (c *Client) Subscribe(ctx context.Context, logTypes []string, bufferingCfg BufferingCfg, ...) error
- type DefaultClient
- type Destination
- type EventType
- type ExtensionEventType
- type FunctionErrorType
- type HttpProtocol
- type InvokeEvent
- type LambdaError
- type LambdaEvent
- type NextEvent
- type RegisterResponse
- type SchemaVersion
- type ShutdownEvent
- type ShutdownReasonType
- type StatusResponse
- type SubscribeRequest
- type Tracing
- type URI
Constants ¶
const ( LambdaTelemetryEndpoint = "2022-07-01/telemetry" LambdaExtensionEndpoint = "2020-01-01/extension" )
const ( SchemaVersion20220701 = "2022-07-01" SchemaVersionLatest = SchemaVersion20220701 )
const ( InitTimeout = 5 * time.Second ShutdownTimeout = 1500 * time.Millisecond KillTimeout = 100 * time.Millisecond )
const DefaultHttpListenerPort = "6060"
DefaultHttpListenerPort is used to set the URL where the logs will be sent by Telemetry API
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferingCfg ¶
type BufferingCfg struct { // MaxItems is the maximum number of events to be buffered in memory. (default: 10000, minimum: 1000, maximum: 10000) MaxItems uint32 `json:"maxItems"` // MaxBytes is the maximum size in bytes of the logs to be buffered in memory. (default: 262144, minimum: 262144, maximum: 1048576) MaxBytes uint32 `json:"maxBytes"` // TimeoutMS is the maximum time (in milliseconds) for a batch to be buffered. (default: 1000, minimum: 100, maximum: 30000) TimeoutMS uint32 `json:"timeoutMs"` }
BufferingCfg is the configuration set for receiving logs from Logs API. Whichever of the conditions below is met first, the logs will be sent
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client used to interact with the Lambda API Endpoints
func (*Client) InitError ¶
func (e *Client) InitError(ctx context.Context, extensionId string, errorType FunctionErrorType, lambdaError LambdaError) error
InitError is used to report an Initialization Error to lambda
func (*Client) NextEvent ¶
func (e *Client) NextEvent(ctx context.Context, extensionId string) (ExtensionEventType, []byte, error)
NextEvent blocks while long polling for the next lambda invoke or shutdown
type DefaultClient ¶
type DefaultClient struct {
// contains filtered or unexported fields
}
func NewAWSClient ¶
func NewAWSClient(region string) (*DefaultClient, error)
func (*DefaultClient) GetFunction ¶ added in v0.0.3
func (c *DefaultClient) GetFunction(functionARN string) (*lambda.GetFunctionOutput, error)
type Destination ¶
type Destination struct { Protocol HttpProtocol `json:"protocol"` URI URI `json:"URI"` }
Destination is the configuration for listeners who would like to receive logs with HTTP
type EventType ¶
type EventType string
const ( PlatformInitStart EventType = "platform.initStart" PlatformInitRuntimeDone EventType = "platform.initRuntimeDone" PlatformInitReport EventType = "platform.initReport" PlatformStart EventType = "platform.start" PlatformRuntimeDone EventType = "platform.runtimeDone" // RuntimeDone event is sent when lambda function is finished it's execution PlatformReport EventType = "platform.report" PlatformRestoreStart EventType = "platform.restoreStart" PlatformRestoreRuntimeDone EventType = "platform.restoreRuntimeDone" PlatformRestoreReport EventType = "platform.restoreReport" PlatformTelemetrySubscription EventType = "platform.telemetrySubscription" PlatformLogsDropped EventType = "platform.logsDropped" Function EventType = "function" Extension EventType = "extension" )
type ExtensionEventType ¶
type ExtensionEventType string
ExtensionEventType represents the type of events recieved from /event/next
const ( // Invoke is a lambda invoke Invoke ExtensionEventType = "INVOKE" // Shutdown is a shutdown event for the environment Shutdown ExtensionEventType = "SHUTDOWN" )
type FunctionErrorType ¶
type FunctionErrorType string
const ( SubscribeError FunctionErrorType = "Extension.SubscribeError" RegisterError FunctionErrorType = "Extension.RegisterError" ConfigError FunctionErrorType = "Extension.ConfigError" ClientError FunctionErrorType = "Extension.ClientError" )
type HttpProtocol ¶
type HttpProtocol string
HttpProtocol is used to specify the protocol when subscribing to Logs API for HTTP
const (
HttpProto HttpProtocol = "HTTP"
)
type InvokeEvent ¶
type InvokeEvent struct { DeadlineMs int64 `json:"deadlineMs"` RequestID string `json:"requestId"` InvokedFunctionArn string `json:"invokedFunctionArn"` Tracing Tracing `json:"tracing"` }
func GetInvokeEvent ¶
func GetInvokeEvent(body []byte) (*InvokeEvent, error)
type LambdaError ¶
type LambdaEvent ¶
type NextEvent ¶
type NextEvent struct {
EventType ExtensionEventType `json:"eventType"`
}
NextEvent is the response for /event/next
type RegisterResponse ¶
type RegisterResponse struct { FunctionName string `json:"functionName"` FunctionVersion string `json:"functionVersion"` Handler string `json:"handler"` AccountID string `json:"accountId"` }
RegisterResponse is the body of the response for /register
type SchemaVersion ¶
type SchemaVersion string
type ShutdownEvent ¶
type ShutdownEvent struct { DeadlineMs int64 `json:"deadlineMs"` ShutdownReason ShutdownReasonType `json:"shutdownReason"` }
func GetShutdownEvent ¶
func GetShutdownEvent(body []byte) (*ShutdownEvent, error)
type ShutdownReasonType ¶
type ShutdownReasonType string
const ( Spindown ShutdownReasonType = "spindown" Timeout ShutdownReasonType = "timeout" Failure ShutdownReasonType = "failure" )
type StatusResponse ¶
type StatusResponse struct {
Status string `json:"status"`
}
StatusResponse is the body of the response for /init/error and /exit/error
type SubscribeRequest ¶
type SubscribeRequest struct { SchemaVersion SchemaVersion `json:"schemaVersion"` LogTypes []string `json:"types"` BufferingCfg BufferingCfg `json:"buffering"` Destination Destination `json:"destination"` }
SubscribeRequest is the request body that is sent to Logs API on subscribe