telemetry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion20220701 = "2022-07-01"
	SchemaVersionLatest   = SchemaVersion20220701
)

Variables

View Source
var Logger *logrus.Entry

Functions

This section is empty.

Types

type BufferingCfg

type BufferingCfg struct {
	// Maximum number of log events to be buffered in memory. (default: 10000, minimum: 1000, maximum: 10000)
	MaxItems uint32 `json:"maxItems"`
	// Maximum size in bytes of the log events to be buffered in memory. (default: 262144, minimum: 262144, maximum: 1048576)
	MaxBytes uint32 `json:"maxBytes"`
	// Maximum time (in milliseconds) for a batch to be buffered. (default: 1000, minimum: 100, maximum: 30000)
	TimeoutMS uint32 `json:"timeoutMs"`
}

Configuration for receiving telemetry from the Telemetry API. Telemetry will be sent to your listener when one of the conditions below is met.

type Client

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

The client used for subscribing to the Telemetry API

func NewClient

func NewClient(runtimeApi string) *Client

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, extensionId string, listenerUri string) (*SubscribeResponse, error)

Subscribes to the Telemetry API to start receiving the log events

type Destination

type Destination struct {
	Protocol   HttpProtocol `json:"protocol"`
	URI        URI          `json:"URI"`
	HttpMethod HttpMethod   `json:"method"`
	Encoding   HttpEncoding `json:"encoding"`
}

Configuration for listeners that would like to receive telemetry via HTTP

type EventType

type EventType string

Represents the type of log events in Lambda

const (
	// Used to receive log events emitted by the platform
	Platform EventType = "platform"
	// Used to receive log events emitted by the function
	Function EventType = "function"
	// Used is to receive log events emitted by the extension
	Extension EventType = "extension"
)

type HttpEncoding

type HttpEncoding string

Denotes what the content is encoded in

const (
	JSON HttpEncoding = "JSON"
)

type HttpMethod

type HttpMethod string

HttpMethod represents the HTTP method used to receive logs from Logs API

const (
	// Receive log events via POST requests to the listener
	HttpPost HttpMethod = "POST"
	// Receive log events via PUT requests to the listener
	HttpPut HttpMethod = "PUT"
)

type HttpProtocol

type HttpProtocol string

Used to specify the protocol when subscribing to Telemetry API for HTTP

const (
	HttpProto HttpProtocol = "HTTP"
)

type SchemaVersion

type SchemaVersion string

type SubscribeRequest

type SubscribeRequest struct {
	SchemaVersion SchemaVersion `json:"schemaVersion"`
	EventTypes    []EventType   `json:"types"`
	BufferingCfg  BufferingCfg  `json:"buffering"`
	Destination   Destination   `json:"destination"`
}

Request body that is sent to the Telemetry API on subscribe

type SubscribeResponse

type SubscribeResponse struct {
	// contains filtered or unexported fields
}

Response body that is received from the Telemetry API on subscribe

type TelemetryApiListener

type TelemetryApiListener struct {

	// LogEventsQueue is a synchronous queue and is used to put the received log events to be dispatched later
	LogEventsQueue *queue.Queue
	// contains filtered or unexported fields
}

Used to listen to the Telemetry API

func NewTelemetryApiListener

func NewTelemetryApiListener(isSAMLocal bool) *TelemetryApiListener

func (*TelemetryApiListener) Shutdown

func (s *TelemetryApiListener) Shutdown()

Terminates the HTTP server listening for logs

func (*TelemetryApiListener) Start

func (s *TelemetryApiListener) Start() (string, error)

Starts the server in a goroutine where the log events will be sent

type URI

type URI string

URI is used to set the endpoint where the logs will be sent to

Jump to

Keyboard shortcuts

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