MCPcopy
hub / github.com/prometheus/client_golang / retryAfterDuration

Function retryAfterDuration

exp/api/remote/remote_api.go:353–364  ·  view source on GitHub ↗

retryAfterDuration returns the duration for the Retry-After header. In case of any errors, it returns 0 as if the header was never supplied.

(t string)

Source from the content-addressed store, hash-verified

351// retryAfterDuration returns the duration for the Retry-After header. In case of any errors, it
352// returns 0 as if the header was never supplied.
353func retryAfterDuration(t string) time.Duration {
354 parsedDuration, err := time.Parse(http.TimeFormat, t)
355 if err == nil {
356 return time.Until(parsedDuration)
357 }
358 // The duration can be in seconds.
359 d, err := strconv.Atoi(t)
360 if err != nil {
361 return 0
362 }
363 return time.Duration(d) * time.Second
364}
365
366// writeStorage represents the storage for RemoteWriteHandler.
367// This interface is intentionally private due its experimental state.

Callers 2

attemptWriteMethod · 0.85
TestRetryAfterDurationFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestRetryAfterDurationFunction · 0.68