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

Function TrimToBefore

pkg/traceql/engine_metrics.go:128–138  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

126// TrimToBefore shortens the query window to only include before the given time.
127// Request must be in unix nanoseconds already.
128func 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.

Callers 1

backendRequestsMethod · 0.92

Calls 2

IsInstantFunction · 0.85
HasInstantMethod · 0.80

Tested by

no test coverage detected