(ctx context.Context, req *tempopb.QueryRangeRequest)
| 49 | } |
| 50 | |
| 51 | func (q *Querier) queryBlock(ctx context.Context, req *tempopb.QueryRangeRequest) (*tempopb.QueryRangeResponse, error) { |
| 52 | tenantID, err := validation.ExtractValidTenantID(ctx) |
| 53 | if err != nil { |
| 54 | return nil, fmt.Errorf("error extracting org id in Querier.queryBlock: %w", err) |
| 55 | } |
| 56 | |
| 57 | blockID, err := backend.ParseUUID(req.BlockID) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | |
| 62 | dc, err := backend.DedicatedColumnsFromTempopb(req.DedicatedColumns) |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | |
| 67 | meta := &backend.BlockMeta{ |
| 68 | Version: req.Version, |
| 69 | TenantID: tenantID, |
| 70 | StartTime: time.Unix(0, int64(req.Start)), |
| 71 | EndTime: time.Unix(0, int64(req.End)), |
| 72 | BlockID: blockID, |
| 73 | Size_: req.Size_, |
| 74 | FooterSize: req.FooterSize, |
| 75 | DedicatedColumns: dc, |
| 76 | } |
| 77 | |
| 78 | opts := common.DefaultSearchOptions() |
| 79 | opts.StartPage = int(req.StartPage) |
| 80 | opts.TotalPages = int(req.PagesToSearch) |
| 81 | |
| 82 | // Parse without optimizations to read hints; optimizations are applied by CompileMetricsQueryRange. |
| 83 | expr, err := traceql.ParseNoOptimizations(req.Query) |
| 84 | if err != nil { |
| 85 | return nil, err |
| 86 | } |
| 87 | |
| 88 | var compileOpts []traceql.CompileOption |
| 89 | |
| 90 | unsafe := q.limits.UnsafeQueryHints(tenantID) |
| 91 | if unsafe { |
| 92 | compileOpts = append(compileOpts, traceql.WithUnsafeHints(true)) |
| 93 | } |
| 94 | for _, name := range req.SkipASTTransformations { |
| 95 | compileOpts = append(compileOpts, traceql.WithSkipOptimization(name)) |
| 96 | } |
| 97 | |
| 98 | if v, ok := expr.Hints.GetFloat(traceql.HintTimeOverlapCutoff, unsafe); ok && v >= 0 && v <= 1.0 { |
| 99 | // Use valid hint from query. |
| 100 | compileOpts = append(compileOpts, traceql.WithTimeOverlapCutoff(v)) |
| 101 | } else { |
| 102 | // Use default. |
| 103 | compileOpts = append(compileOpts, traceql.WithTimeOverlapCutoff(q.cfg.Metrics.TimeOverlapCutoff)) |
| 104 | } |
| 105 | |
| 106 | if p := q.limits.MetricsSpanOnlyFetch(tenantID); p != nil { |
| 107 | compileOpts = append(compileOpts, traceql.WithSpanOnlyFetch(*p)) |
| 108 | } |
no test coverage detected