MCPcopy Create free account
hub / github.com/cortexproject/cortex / writeServiceTimingHeader

Function writeServiceTimingHeader

pkg/frontend/transport/handler.go:656–663  ·  view source on GitHub ↗
(queryResponseTime time.Duration, headers http.Header, stats *querier_stats.QueryStats)

Source from the content-addressed store, hash-verified

654}
655
656func writeServiceTimingHeader(queryResponseTime time.Duration, headers http.Header, stats *querier_stats.QueryStats) {
657 if stats != nil {
658 parts := make([]string, 0)
659 parts = append(parts, statsValue("querier_wall_time", stats.LoadWallTime()))
660 parts = append(parts, statsValue("response_time", queryResponseTime))
661 headers.Set(ServiceTimingHeaderName, strings.Join(parts, ", "))
662 }
663}
664
665func statsValue(name string, d time.Duration) string {
666 durationInMs := strconv.FormatFloat(float64(d)/float64(time.Millisecond), 'f', -1, 64)

Callers 1

ServeHTTPMethod · 0.85

Calls 4

statsValueFunction · 0.85
LoadWallTimeMethod · 0.80
JoinMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected