TrimToBefore shortens the query window to only include before the given time. Request must be in unix nanoseconds already.
(req *tempopb.QueryRangeRequest, before time.Time)
| 126 | // TrimToBefore shortens the query window to only include before the given time. |
| 127 | // Request must be in unix nanoseconds already. |
| 128 | func TrimToBefore(req *tempopb.QueryRangeRequest, before time.Time) { |
| 129 | wasInstant := IsInstant(req) |
| 130 | beforeNs := uint64(before.UnixNano()) |
| 131 | |
| 132 | req.Start = min(req.Start, beforeNs) |
| 133 | req.End = min(req.End, beforeNs) |
| 134 | // if has no instant query indicator param, restore step |
| 135 | if !req.HasInstant() && wasInstant && !IsInstant(req) { |
| 136 | req.Step = req.End - req.Start |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | // TrimToAfter shortens the query window to only include after the given time. |
| 141 | // Request must be in unix nanoseconds already. |
no test coverage detected