telemetry

package
v0.0.0-...-65a99ba Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package telemetry defines the apis and server required to interact with the subscribe to the Telemetry API for AWS lambdas. This is to enable the trigger of specific actions such as metric flushes on certain runtime events.

More information on the Telemetry API can be found at : https://docs.aws.amazon.com/lambda/latest/dg/telemetry-api.html

Index

Constants

View Source
const (
	ApiVersion                              = "2022-07-01"
	SubscribeEndpoint        api.LambdaPath = "/" + ApiVersion + "/telemetry"
	ProtocolHTTP             string         = "HTTP"
	PlatformSubscriptionType string         = "platform"
	MinBufferingTimeoutMs    int            = 25

	RuntimeDone EventType = "platform.runtimeDone"
	// LambdaRuntimeAvailableAddr uses the sandbox hostname must be used in the lambda runtime
	// note the port component can be configured
	LambdaRuntimeAvailableAddr = "sandbox:8083"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Type is the only field we deserialise as it is used for flushing metrics
	Type EventType `json:"type"`
}

Event is the telemetry event that the lambda server pushes.

Full schema can be found here: https://docs.aws.amazon.com/lambda/latest/dg/telemetry-schema-reference.html

type EventType

type EventType string

type RuntimeDoneHook

type RuntimeDoneHook func()

func NoopHook

func NoopHook() RuntimeDoneHook

type Server

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

func NewServer

func NewServer(addr string, log logrus.FieldLogger, hook RuntimeDoneHook) *Server

func (*Server) Endpoint

func (s *Server) Endpoint() string

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

type SubscriptionBufferingConfig

type SubscriptionBufferingConfig struct {
	MaxItems  int         `json:"maxItems,omitempty"`
	MaxBytes  interface{} `json:"maxBytes,omitempty"`
	TimeoutMs int         `json:"timeoutMs,omitempty"`
}

type SubscriptionDestination

type SubscriptionDestination struct {
	Protocol string `json:"protocol,omitempty"`
	URI      string `json:"URI"`
}

type SubscriptionRequest

type SubscriptionRequest struct {
	SchemaVersion string                       `json:"schemaVersion"`
	Types         []string                     `json:"types"`
	Buffering     *SubscriptionBufferingConfig `json:"buffering,omitempty"`
	Destination   *SubscriptionDestination     `json:"destination,omitempty"`
}

Jump to

Keyboard shortcuts

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