Documentation
¶
Index ¶
- Constants
- Variables
- func BuildFullTraceID(root, parent, sample string) string
- func CalculateDuration(startNs, endNs int64) float64
- func GetEpochTimeInISO8601FormatFromMonotime(monotime int64) string
- func GetRuntimeDoneInvokeMetrics(runtimeStartedTime int64, invokeResponseMetrics *interop.InvokeResponseMetrics, ...) *interop.RuntimeDoneInvokeMetrics
- func GetRuntimeDoneSpans(runtimeStartedTime int64, invokeResponseMetrics *interop.InvokeResponseMetrics) []interop.Span
- func InferInitType(initCachingEnabled bool, sandboxType interop.SandboxType) interop.InitType
- func InitPhaseFromLifecyclePhase(phase interop.LifecyclePhase) (interop.InitPhase, error)
- func NewTraceContext(ctx context.Context, root string, parent string) context.Context
- func ParseTracingHeader(tracingHeader string) (rootID, parentID, sampled, lineage string)
- type NoOpEventsAPI
- func (s *NoOpEventsAPI) FetchTailLogs(string) (string, error)
- func (s *NoOpEventsAPI) GetRuntimeDoneSpans(runtimeStartedTime int64, invokeResponseMetrics *interop.InvokeResponseMetrics, ...) []interop.Span
- func (s *NoOpEventsAPI) SendEnd(interop.EndData) error
- func (s *NoOpEventsAPI) SendExtensionInit(interop.ExtensionInitData) error
- func (s *NoOpEventsAPI) SendFault(interop.FaultData) error
- func (s *NoOpEventsAPI) SendImageErrorLog(interop.ImageErrorLogData)
- func (s *NoOpEventsAPI) SendInitReport(interop.InitReportData) error
- func (s *NoOpEventsAPI) SendInitRuntimeDone(interop.InitRuntimeDoneData) error
- func (s *NoOpEventsAPI) SendInitStart(interop.InitStartData) error
- func (s *NoOpEventsAPI) SendInvokeRuntimeDone(interop.InvokeRuntimeDoneData) error
- func (s *NoOpEventsAPI) SendInvokeStart(interop.InvokeStartData) error
- func (s *NoOpEventsAPI) SendReport(interop.ReportData) error
- func (s *NoOpEventsAPI) SendReportSpan(interop.Span) error
- func (s *NoOpEventsAPI) SendRestoreRuntimeDone(interop.RestoreRuntimeDoneData) error
- func (s *NoOpEventsAPI) SetCurrentRequestID(interop.RequestID)
- type NoOpLogsEgressAPI
- type NoOpSubscriptionAPI
- func (m *NoOpSubscriptionAPI) Clear()
- func (m *NoOpSubscriptionAPI) FlushMetrics() interop.TelemetrySubscriptionMetrics
- func (m *NoOpSubscriptionAPI) GetEndpointURL() string
- func (m *NoOpSubscriptionAPI) GetServiceClosedErrorMessage() string
- func (m *NoOpSubscriptionAPI) GetServiceClosedErrorType() string
- func (m *NoOpSubscriptionAPI) RecordCounterMetric(metricName string, count int)
- func (m *NoOpSubscriptionAPI) Subscribe(agentName string, body io.Reader, headers map[string][]string, ...) ([]byte, int, map[string][]string, error)
- func (m *NoOpSubscriptionAPI) TurnOff()
- type NoOpTracer
- func (t *NoOpTracer) AttachErrorCause(ctx context.Context, errorCause json.RawMessage)
- func (t *NoOpTracer) BuildTracingCtxAfterInvokeComplete() *interop.TracingCtx
- func (t *NoOpTracer) BuildTracingCtxForStart() *interop.TracingCtx
- func (t *NoOpTracer) BuildTracingHeader() func(context.Context) string
- func (t *NoOpTracer) CaptureInitSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error
- func (t *NoOpTracer) CaptureInvokeSegment(ctx context.Context, criticalFunction func(context.Context) error) error
- func (t *NoOpTracer) CaptureInvokeSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error
- func (t *NoOpTracer) CaptureOverheadSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error
- func (t *NoOpTracer) Configure(invoke *interop.Invoke)
- func (t *NoOpTracer) MarkError(ctx context.Context)
- func (t *NoOpTracer) RecordInitEndTime()
- func (t *NoOpTracer) RecordInitStartTime()
- func (t *NoOpTracer) SendInitSubsegmentWithRecordedTimesOnce(ctx context.Context)
- func (t *NoOpTracer) SendRestoreSubsegmentWithRecordedTimesOnce(ctx context.Context)
- func (t *NoOpTracer) WithError(ctx context.Context, appCtx appctx.ApplicationContext, ...) func(ctx context.Context) error
- func (t *NoOpTracer) WithErrorCause(ctx context.Context, appCtx appctx.ApplicationContext, ...) func(ctx context.Context) error
- type StdLogsEgressAPI
- type SubscriptionAPI
- type Tracer
Constants ¶
const ( // Metrics SubscribeSuccess = "logs_api_subscribe_success" SubscribeClientErr = "logs_api_subscribe_client_err" SubscribeServerErr = "logs_api_subscribe_server_err" NumSubscribers = "logs_api_num_subscribers" )
const ( InitInsideInitPhase interop.InitPhase = "init" InitInsideInvokePhase interop.InitPhase = "invoke" )
const ( InitTypeOnDemand interop.InitType = "on-demand" InitTypeProvisionedConcurrency interop.InitType = "provisioned-concurrency" InitTypeInitCaching interop.InitType = "snap-start" )
const ( RuntimeDoneSuccess = "success" RuntimeDoneError = "error" )
const ( TraceIDKey traceContextKey = iota DocumentIDKey )
Variables ¶
var ErrTelemetryServiceOff = errors.New("ErrTelemetryServiceOff")
ErrTelemetryServiceOff returned on attempt to subscribe after telemetry service has been turned off.
Functions ¶
func BuildFullTraceID ¶
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 ¶
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 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 ¶
NewTraceContext returns new derived context with trace config set for testing
func ParseTracingHeader ¶
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) SendExtensionInit ¶
func (s *NoOpEventsAPI) SendExtensionInit(interop.ExtensionInitData) 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 (*NoOpLogsEgressAPI) GetRuntimeSockets ¶
type NoOpSubscriptionAPI ¶
type NoOpSubscriptionAPI struct{}
func (*NoOpSubscriptionAPI) Clear ¶
func (m *NoOpSubscriptionAPI) Clear()
func (*NoOpSubscriptionAPI) FlushMetrics ¶
func (m *NoOpSubscriptionAPI) FlushMetrics() interop.TelemetrySubscriptionMetrics
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 (*NoOpTracer) CaptureInvokeSegment ¶
func (*NoOpTracer) CaptureInvokeSubsegment ¶
func (*NoOpTracer) CaptureOverheadSubsegment ¶
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) WithErrorCause ¶
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
}