forked from aws/aws-lambda-runtime-interface-emulator
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtracer.go
More file actions
64 lines (52 loc) · 2.42 KB
/
Copy pathtracer.go
File metadata and controls
64 lines (52 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"context"
"encoding/json"
"github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda/appctx"
"github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda/interop"
)
type LocalStackTracer struct {
invoke *interop.Invoke
}
func (t *LocalStackTracer) Configure(invoke *interop.Invoke) {
t.invoke = invoke
}
func (t *LocalStackTracer) CaptureInvokeSegment(ctx context.Context, criticalFunction func(context.Context) error) error {
return criticalFunction(ctx)
}
func (t *LocalStackTracer) CaptureInitSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error {
return criticalFunction(ctx)
}
func (t *LocalStackTracer) CaptureInvokeSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error {
return criticalFunction(ctx)
}
func (t *LocalStackTracer) CaptureOverheadSubsegment(ctx context.Context, criticalFunction func(context.Context) error) error {
return criticalFunction(ctx)
}
func (t *LocalStackTracer) RecordInitStartTime() {}
func (t *LocalStackTracer) RecordInitEndTime() {}
func (t *LocalStackTracer) SendInitSubsegmentWithRecordedTimesOnce(ctx context.Context) {}
func (t *LocalStackTracer) SendRestoreSubsegmentWithRecordedTimesOnce(ctx context.Context) {}
func (t *LocalStackTracer) MarkError(ctx context.Context) {}
func (t *LocalStackTracer) AttachErrorCause(ctx context.Context, errorCause json.RawMessage) {}
func (t *LocalStackTracer) WithErrorCause(ctx context.Context, appCtx appctx.ApplicationContext, criticalFunction func(ctx context.Context) error) func(ctx context.Context) error {
return criticalFunction
}
func (t *LocalStackTracer) WithError(ctx context.Context, appCtx appctx.ApplicationContext, criticalFunction func(ctx context.Context) error) func(ctx context.Context) error {
return criticalFunction
}
func (t *LocalStackTracer) BuildTracingHeader() func(context.Context) string {
// extract root trace ID and parent from context and build the tracing header
return func(ctx context.Context) string {
return t.invoke.TraceID
}
}
func (t *LocalStackTracer) BuildTracingCtxForStart() *interop.TracingCtx {
return nil
}
func (t *LocalStackTracer) BuildTracingCtxAfterInvokeComplete() *interop.TracingCtx {
return nil
}
func NewLocalStackTracer() *LocalStackTracer {
return &LocalStackTracer{}
}