Documentation
¶
Index ¶
- Constants
- func ProcessPlatformReport(metadataContainer *apmproxy.MetadataContainer, ...) (apmproxy.AgentData, error)
- type BufferingCfg
- type Client
- type ClientOption
- type Destination
- type EventType
- type LogEvent
- type LogEventRecord
- type MetricsContainer
- type PlatformMetrics
- type SchemaVersion
- type SubEventType
- type SubscribeRequest
Constants ¶
const ( SchemaVersion20210318 = "2021-03-18" SchemaVersionLatest = SchemaVersion20210318 )
Variables ¶
This section is empty.
Functions ¶
func ProcessPlatformReport ¶
func ProcessPlatformReport(metadataContainer *apmproxy.MetadataContainer, functionData *extension.NextEventResponse, platformReport LogEvent) (apmproxy.AgentData, error)
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 subscribe to the Logs API.
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient returns a new Client with the given URL.
func (*Client) ProcessLogs ¶
func (lc *Client) ProcessLogs( ctx context.Context, requestID string, apmClient *apmproxy.Client, metadataContainer *apmproxy.MetadataContainer, runtimeDoneSignal chan struct{}, prevEvent *extension.NextEventResponse, ) error
ProcessLogs consumes events until a RuntimeDone event corresponding to requestID is received, or ctx is canceled, and then returns.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a config option for a Client.
func WithListenerAddress ¶
func WithListenerAddress(s string) ClientOption
WithListenerAddress sets the listener address of the server listening for logs event.
func WithLogBuffer ¶
func WithLogBuffer(size int) ClientOption
WithLogBuffer sets the size of the buffer storing queued logs for processing.
func WithLogger ¶
func WithLogger(logger *zap.SugaredLogger) ClientOption
WithLogger sets the logger.
func WithLogsAPIBaseURL ¶
func WithLogsAPIBaseURL(s string) ClientOption
WithLogsAPIBaseURL sets the logs api base url.
type Destination ¶
type Destination struct {
Protocol string `json:"protocol"`
URI string `json:"URI"`
HTTPMethod string `json:"method"`
Encoding string `json:"encoding"`
}
Destination is the configuration for listeners who would like to receive logs with HTTP
type LogEvent ¶
type LogEvent struct {
Time time.Time `json:"time"`
Type SubEventType `json:"type"`
StringRecord string
Record LogEventRecord
}
LogEvent represents an event received from the Logs API
func (*LogEvent) UnmarshalJSON ¶
type LogEventRecord ¶
type LogEventRecord struct {
RequestID string `json:"requestId"`
Status string `json:"status"`
Metrics PlatformMetrics `json:"metrics"`
}
LogEventRecord is a sub-object in a Logs API event
type MetricsContainer ¶
func (MetricsContainer) Add ¶
func (mc MetricsContainer) Add(name string, value float64)
Add adds a metric with the given name, labels, and value, The labels are expected to be sorted lexicographically.
func (MetricsContainer) MarshalFastJSON ¶
func (mc MetricsContainer) MarshalFastJSON(json *fastjson.Writer) error
type PlatformMetrics ¶
type SchemaVersion ¶
type SchemaVersion string
SchemaVersion is the Lambda runtime API schema version
type SubEventType ¶
type SubEventType string
SubEventType is a Logs API sub event type
const ( // RuntimeDone event is sent when lambda function is finished it's execution RuntimeDone SubEventType = "platform.runtimeDone" Fault SubEventType = "platform.fault" Report SubEventType = "platform.report" Start SubEventType = "platform.start" )
type SubscribeRequest ¶
type SubscribeRequest struct {
SchemaVersion SchemaVersion `json:"schemaVersion"`
EventTypes []EventType `json:"types"`
BufferingCfg BufferingCfg `json:"buffering"`
Destination Destination `json:"destination"`
}
SubscribeRequest is the request body that is sent to Logs API on subscribe