| 12 | const streamingQuerierPrefix = "/tempopb.StreamingQuerier/" |
| 13 | |
| 14 | func 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 | |
| 26 | func NewFrontendAPIStreamTimeout(timeout time.Duration) grpc.StreamServerInterceptor { |
| 27 | return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { |