/
xray_build.go
41 lines (36 loc) · 1.11 KB
/
xray_build.go
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
//go:build !lambdabinary
// +build !lambdabinary
package interceptor
import (
"container/ring"
"context"
"encoding/json"
sparta "github.com/mweagle/Sparta/v3"
"github.com/rs/zerolog"
)
func (xri *xrayInterceptor) Begin(ctx context.Context, msg json.RawMessage) context.Context {
return ctx
}
func (xri *xrayInterceptor) BeforeSetup(ctx context.Context, msg json.RawMessage) context.Context {
return ctx
}
func (xri *xrayInterceptor) AfterSetup(ctx context.Context, msg json.RawMessage) context.Context {
logger, loggerOk := ctx.Value(sparta.ContextKeyLogger).(*zerolog.Logger)
if loggerOk {
// Empty assignment to satisfy linters...
xri.zerologXRayHandler = &zerologXRayHandler{
logRing: ring.New(logRingSize),
originalLevel: logger.GetLevel(),
}
}
return ctx
}
func (xri *xrayInterceptor) BeforeDispatch(ctx context.Context, msg json.RawMessage) context.Context {
return ctx
}
func (xri *xrayInterceptor) AfterDispatch(ctx context.Context, msg json.RawMessage) context.Context {
return ctx
}
func (xri *xrayInterceptor) Complete(ctx context.Context, msg json.RawMessage) context.Context {
return ctx
}