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

Function NewAdjustStartEndWare

modules/frontend/pipeline/async_adjust_start_end.go:37–46  ·  view source on GitHub ↗

NewAdjustStartEndWare creates middleware that adjusts the "end" parameter of incoming requests. It is assumed that all request pipelines it exists in expect a "start" and "end" parameter. Traditionally some of these endpoints supported no start/end parameter which simply meant "search all recent dat

(defStart time.Duration, endBuffer time.Duration, sendNanos bool)

Source from the content-addressed store, hash-verified

35// This prevents queries from using "now" as an end time, which may hit incomplete data.
36// - sendNanos: If true, times are encoded as Unix nanoseconds. Otherwise, Unix seconds are used.
37func NewAdjustStartEndWare(defStart time.Duration, endBuffer time.Duration, sendNanos bool) AsyncMiddleware[combiner.PipelineResponse] {
38 return AsyncMiddlewareFunc[combiner.PipelineResponse](func(next AsyncRoundTripper[combiner.PipelineResponse]) AsyncRoundTripper[combiner.PipelineResponse] {
39 return &adjustStartEndWare{
40 next: next,
41 defStart: defStart,
42 endBuffer: endBuffer,
43 sendNanos: sendNanos,
44 }
45 })
46}
47
48func (c adjustStartEndWare) RoundTrip(req Request) (Responses[combiner.PipelineResponse], error) {
49 var (

Callers 2

NewFunction · 0.92
TestAdjustStartEndWareFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestAdjustStartEndWareFunction · 0.68