telemetry

package
v0.0.0-...-4fa2157 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Metrics
	SubscribeSuccess   = "logs_api_subscribe_success"
	SubscribeClientErr = "logs_api_subscribe_client_err"
	SubscribeServerErr = "logs_api_subscribe_server_err"
	NumSubscribers     = "logs_api_num_subscribers"
)
View Source
const (
	InitInsideInitPhase   interop.InitPhase = "init"
	InitInsideInvokePhase interop.InitPhase = "invoke"
)
View Source
const (
	InitTypeOnDemand               interop.InitType = "on-demand"
	InitTypeProvisionedConcurrency interop.InitType = "provisioned-concurrency"
	InitTypeInitCaching            interop.InitType = "snap-start"
)
View Source
const (
	RuntimeDoneSuccess = "success"
	RuntimeDoneError   = "error"
)
View Source
const (
	TraceIDKey traceContextKey = iota
	DocumentIDKey
)

Variables

View Source
var ErrTelemetryServiceOff = errors.New("ErrTelemetryServiceOff")

ErrTelemetryServiceOff returned on attempt to subscribe after telemetry service has been turned off.

Functions

func BuildFullTraceID

func BuildFullTraceID(root, parent, sample string) string

BuildFullTraceID takes individual components of X-Ray trace header and puts them together into a formatted trace header. If root is empty, returns an empty string.

func CalculateDuration

func CalculateDuration(startNs, endNs int64) float64

CalculateDuration calculates duration between two moments. The result is milliseconds with microsecond precision. Two assumptions here: 1. the passed values are nanoseconds 2. endNs > startNs

func GetEpochTimeInISO8601FormatFromMonotime

func GetEpochTimeInISO8601FormatFromMonotime(monotime int64) string

func GetRuntimeDoneInvokeMetrics

func GetRuntimeDoneInvokeMetrics(runtimeStartedTime int64, invokeResponseMetrics *interop.InvokeResponseMetrics, runtimeDoneTime int64) *interop.RuntimeDoneInvokeMetrics

func GetRuntimeDoneSpans

func GetRuntimeDoneSpans(runtimeStartedTime int64, invokeResponseMetrics *interop.InvokeResponseMetrics) []interop.Span

func InferInitType

func InferInitType(initCachingEnabled bool, sandboxType interop.SandboxType) interop.InitType

func InitPhaseFromLifecyclePhase

func InitPhaseFromLifecyclePhase(phase interop.LifecyclePhase) (interop.InitPhase, error)

func NewTraceContext

func NewTraceContext(ctx context.Context, root string, parent string) context.Context

NewTraceContext returns new derived context with trace config set for testing

func ParseTracingHeader

func ParseTracingHeader(tracingHeader string) (rootID, parentID, sampled, lineage string)

ParseTracingHeader extracts RootTraceID, ParentID, Sampled, and Lineage from a tracing header. Tracing header format is defined here: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader

Types

type NoOpEventsAPI

type NoOpEventsAPI struct{}

func (*NoOpEventsAPI) FetchTailLogs

func (s *NoOpEventsAPI) FetchTailLogs(string) (string, error)

func (*NoOpEventsAPI) GetRuntimeDoneSpans

func (s *NoOpEventsAPI) GetRuntimeDoneSpans(
	runtimeStartedTime int64,
	invokeResponseMetrics *interop.InvokeResponseMetrics,
	runtimeOverheadStartedTime int64,
	runtimeReadyTime int64,
) []interop.Span

func (*NoOpEventsAPI) SendEnd

func (s *NoOpEventsAPI) SendEnd(interop.EndData) error

func (*NoOpEventsAPI) SendExtensionInit

func (s *NoOpEventsAPI) SendExtensionInit(interop.ExtensionInitData) error

func (*NoOpEventsAPI) SendFault

func (s *NoOpEventsAPI) SendFault(interop.FaultData) error

func (*NoOpEventsAPI) SendImageErrorLog

func (s *NoOpEventsAPI) SendImageErrorLog(interop.ImageErrorLogData)

func (*NoOpEventsAPI) SendInitReport

func (s *NoOpEventsAPI) SendInitReport(interop.InitReportData) error

func (*NoOpEventsAPI) SendInitRuntimeDone

func (s *NoOpEventsAPI) SendInitRuntimeDone(interop.InitRuntimeDoneData) error

func (*NoOpEventsAPI) SendInitStart

func (s *NoOpEventsAPI) SendInitStart(interop.InitStartData) error

func (*NoOpEventsAPI) SendInvokeRuntimeDone

func (s *NoOpEventsAPI) SendInvokeRuntimeDone(interop.InvokeRuntimeDoneData) error

func (*NoOpEventsAPI) SendInvokeStart

func (s *NoOpEventsAPI) SendInvokeStart(interop.InvokeStartData) error

func (*NoOpEventsAPI) SendReport

func (s *NoOpEventsAPI) SendReport(interop.ReportData) error

func (*NoOpEventsAPI) SendReportSpan

func (s *NoOpEventsAPI) SendReportSpan(interop.Span) error

func (*NoOpEventsAPI) SendRestoreRuntimeDone

func (s *NoOpEventsAPI) SendRestoreRuntimeDone(interop.RestoreRuntimeDoneData) error

func (*NoOpEventsAPI) SetCurrentRequestID

func (s *NoOpEventsAPI) SetCurrentRequestID(interop.RequestID)

type NoOpLogsEgressAPI

type NoOpLogsEgressAPI struct{}

func (*NoOpLogsEgressAPI) GetExtensionSockets

func (s *NoOpLogsEgressAPI) GetExtensionSockets() (io.Writer, io.Writer, error)

func (*NoOpLogsEgressAPI) GetRuntimeSockets

func (s *NoOpLogsEgressAPI) GetRuntimeSockets() (io.Writer, io.Writer, error)

type NoOpSubscriptionAPI

type NoOpSubscriptionAPI struct{}

func (*NoOpSubscriptionAPI) Clear

func (m *NoOpSubscriptionAPI) Clear()

func (*NoOpSubscriptionAPI) FlushMetrics

func (*NoOpSubscriptionAPI) GetEndpointURL

func (m *NoOpSubscriptionAPI) GetEndpointURL() string

func (*NoOpSubscriptionAPI) GetServiceClosedErrorMessage

func (m *NoOpSubscriptionAPI) GetServiceClosedErrorMessage() string

func (*NoOpSubscriptionAPI) GetServiceClosedErrorType

func (m *NoOpSubscriptionAPI) GetServiceClosedErrorType() string

func (*NoOpSubscriptionAPI) RecordCounterMetric

func (m *NoOpSubscriptionAPI) RecordCounterMetric(metricName string, count int)

func (*NoOpSubscriptionAPI) Subscribe

func (m *NoOpSubscriptionAPI) Subscribe(agentName string, body io.Reader, headers map[string][]string, remoteAddr string) ([]byte, int, map[string][]string, error)

Subscribe writes response to a shared memory

func (*NoOpSubscriptionAPI) TurnOff

func (m *NoOpSubscriptionAPI) TurnOff()

type NoOpTracer

type NoOpTracer struct{}

func NewNoOpTracer

func NewNoOpTracer() *NoOpTracer

func (*NoOpTracer) AttachErrorCause

func (t *NoOpTracer) AttachErrorCause(ctx context.Context, errorCause json.RawMessage)

func (*NoOpTracer) BuildTracingCtxAfterInvokeComplete

func (t *NoOpTracer) BuildTracingCtxAfterInvokeComplete() *interop.TracingCtx

func (*NoOpTracer) BuildTracingCtxForStart

func (t *NoOpTracer) BuildTracingCtxForStart() *interop.TracingCtx

func (*NoOpTracer) BuildTracingHeader

func (t *NoOpTracer) BuildTracingHeader() func(context.Context) string

func (*NoOpTracer) CaptureInitSubsegment

func (t *NoOpTracer) CaptureInitSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error

func (*NoOpTracer) CaptureInvokeSegment

func (t *NoOpTracer) CaptureInvokeSegment(ctx context.Context, criticalFunction func(context.Context) error) error

func (*NoOpTracer) CaptureInvokeSubsegment

func (t *NoOpTracer) CaptureInvokeSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error

func (*NoOpTracer) CaptureOverheadSubsegment

func (t *NoOpTracer) CaptureOverheadSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error

func (*NoOpTracer) Configure

func (t *NoOpTracer) Configure(invoke *interop.Invoke)

func (*NoOpTracer) MarkError

func (t *NoOpTracer) MarkError(ctx context.Context)

func (*NoOpTracer) RecordInitEndTime

func (t *NoOpTracer) RecordInitEndTime()

func (*NoOpTracer) RecordInitStartTime

func (t *NoOpTracer) RecordInitStartTime()

func (*NoOpTracer) SendInitSubsegmentWithRecordedTimesOnce

func (t *NoOpTracer) SendInitSubsegmentWithRecordedTimesOnce(ctx context.Context)

func (*NoOpTracer) SendRestoreSubsegmentWithRecordedTimesOnce

func (t *NoOpTracer) SendRestoreSubsegmentWithRecordedTimesOnce(ctx context.Context)

func (*NoOpTracer) WithError

func (t *NoOpTracer) WithError(ctx context.Context, appCtx appctx.ApplicationContext, criticalFunction func(ctx context.Context) error) func(ctx context.Context) error

func (*NoOpTracer) WithErrorCause

func (t *NoOpTracer) WithErrorCause(ctx context.Context, appCtx appctx.ApplicationContext, criticalFunction func(ctx context.Context) error) func(ctx context.Context) error

type StdLogsEgressAPI

type StdLogsEgressAPI interface {
	GetExtensionSockets() (io.Writer, io.Writer, error)
	GetRuntimeSockets() (io.Writer, io.Writer, error)
}

StdLogsEgressAPI is the interface that wraps the basic methods required to setup logs channels for Runtime's stdout/stderr and Extension's stdout/stderr.

Implementation should return a Writer implementor for stdout and another for stderr on success and an error on failure.

type SubscriptionAPI

type SubscriptionAPI interface {
	Subscribe(agentName string, body io.Reader, headers map[string][]string, remoteAddr string) (resp []byte, status int, respHeaders map[string][]string, err error)
	RecordCounterMetric(metricName string, count int)
	FlushMetrics() interop.TelemetrySubscriptionMetrics
	Clear()
	TurnOff()
	GetEndpointURL() string
	GetServiceClosedErrorMessage() string
	GetServiceClosedErrorType() string
}

SubscriptionAPI represents interface that implementations of Telemetry API have to satisfy to be RAPID-compatible

type Tracer

type Tracer interface {
	Configure(invoke *interop.Invoke)
	CaptureInvokeSegment(ctx context.Context, criticalFunction func(context.Context) error) error
	CaptureInitSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error
	CaptureInvokeSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error
	CaptureOverheadSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error
	RecordInitStartTime()
	RecordInitEndTime()
	SendInitSubsegmentWithRecordedTimesOnce(ctx context.Context)
	SendRestoreSubsegmentWithRecordedTimesOnce(ctx context.Context)
	MarkError(ctx context.Context)
	AttachErrorCause(ctx context.Context, errorCause json.RawMessage)
	WithErrorCause(ctx context.Context, appCtx appctx.ApplicationContext, criticalFunction func(ctx context.Context) error) func(ctx context.Context) error
	WithError(ctx context.Context, appCtx appctx.ApplicationContext, criticalFunction func(ctx context.Context) error) func(ctx context.Context) error
	BuildTracingHeader() func(context.Context) string
	BuildTracingCtxForStart() *interop.TracingCtx
	BuildTracingCtxAfterInvokeComplete() *interop.TracingCtx
}

Jump to

Keyboard shortcuts

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