logsapi

package
v0.0.0-nl1687530930 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// HTTPProtocol is the protocol that we receive logs over
	HTTPProtocol Protocol = "HTTP"

	// PlatformLog events originate from the Lambda Runtime
	PlatformLog LogType = "platform"
	// FunctionLog events originate from Lambda Functions
	FunctionLog LogType = "function"
)

Variables

This section is empty.

Functions

func StartLogsReceiver

func StartLogsReceiver(port int, client eventCreator)

StartLogsReceiver starts a small HTTP server on the specified port. The server receives log messages in AWS Lambda's Logs API message format (JSON array of messages) and the handler will send them to Honeycomb as events with the eventCreator provided as client.

When running in Lambda, the extension's subscription to log types will result in the Lambda Logs API publishing log messages to this receiver.

When running in localMode, the server will be started for manual posting of log messages to the specified port for testing.

Types

type BufferingOptions

type BufferingOptions struct {
	TimeoutMS uint   `json:"timeoutMs"`
	MaxBytes  uint64 `json:"maxBytes"`
	MaxItems  uint64 `json:"maxItems"`
}

BufferingOptions contains buffering configuration options for the lambda platform

type Client

type Client struct {
	ExtensionID string
	// contains filtered or unexported fields
}

Client is used to communicate with the Logs API

type Destination

type Destination struct {
	Protocol Protocol `json:"protocol"`
	URI      string   `json:"URI"`
}

Destination is where the runtime should send logs to

type LogMessage

type LogMessage struct {
	Type   string      `json:"type"`
	Time   string      `json:"time"`
	Record interface{} `json:"record"`
}

LogMessage is a message sent from the Logs API

type LogType

type LogType string

LogType represents the types of log messages that are supported by the logs API

type Protocol

type Protocol string

Protocol represents the protocol that this extension should receive logs by

type SubscribeRequest

type SubscribeRequest struct {
	Dest      Destination      `json:"destination"`
	Types     []LogType        `json:"types"`
	Buffering BufferingOptions `json:"buffering"`
}

SubscribeRequest is the request to /logs

type SubscribeResponse

type SubscribeResponse struct {
	Message string
}

SubscribeResponse is the response from /logs subscribe message

func Subscribe

func Subscribe(ctx context.Context, config extension.Config, extensionID string) (*SubscribeResponse, error)

Subscribe wraps the logic of creating a client for the AWS Lambda Logs API and using the client to subscribe the extension to the configured log type streams.

Jump to

Keyboard shortcuts

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