MCPcopy
hub / github.com/grafana/tempo / NewFrontendAPIUnaryTimeout

Function NewFrontendAPIUnaryTimeout

modules/frontend/interceptor/interceptor.go:14–24  ·  view source on GitHub ↗
(timeout time.Duration)

Source from the content-addressed store, hash-verified

12const streamingQuerierPrefix = "/tempopb.StreamingQuerier/"
13
14func NewFrontendAPIUnaryTimeout(timeout time.Duration) grpc.UnaryServerInterceptor {
15 return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
16 if strings.HasPrefix(info.FullMethod, streamingQuerierPrefix) {
17 var cancel context.CancelFunc
18 ctx, cancel = context.WithTimeout(ctx, timeout)
19 defer cancel()
20 }
21
22 return handler(ctx, req)
23 }
24}
25
26func NewFrontendAPIStreamTimeout(timeout time.Duration) grpc.StreamServerInterceptor {
27 return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {

Callers 2

initServerMethod · 0.92

Calls 1

handlerStruct · 0.85