Documentation
¶
Index ¶
- Variables
- func GenerateKey() string
- func GetPid(pidfile string) (int, error)
- func InitPidfile(pidfile string) error
- func IsProduction() bool
- func IsRunning(pidfile string) (bool, error)
- func IsSuccessResponse(resp *http.Response, err error) bool
- func PdApiUrl() string
- func PdEventsUrl() string
- func RemovePidfile(pidfile string) error
- func TerminateProcess(pidfile string) error
- func UserAgent() string
- type Clock
- type RetryTransport
Constants ¶
This section is empty.
Variables ¶
View Source
var BaseLogger *zap.Logger
View Source
var Commit = "unavailable"
Normally set at build time.
View Source
var Date = time.Now().Format(time.RFC3339)
View Source
var ErrPidfileDoesntExist = errors.New("pidfile doesn't exist")
View Source
var ErrPidfileExists = errors.New("pidfile already exists")
View Source
var Logger *zap.SugaredLogger
View Source
var Version = "unavailable"
Functions ¶
func GenerateKey ¶
func GenerateKey() string
GenerateKey generates a random lowercase alphanumeric key.
These keys approximate the Events API's routing keys for use in testing, but may be useful more generally.
func InitPidfile ¶
func IsProduction ¶
func IsProduction() bool
func IsSuccessResponse ¶ added in v0.3.0
IsSuccessResponse returns true if the corresponding request was successful.
Per documentation this is when the server responds with a 202, but we treat any 2XX as a success.
func PdEventsUrl ¶ added in v0.4.0
func PdEventsUrl() string
func RemovePidfile ¶
func TerminateProcess ¶
Types ¶
type RetryTransport ¶ added in v0.3.0
type RetryTransport struct { MaxRetries int MaxInterval time.Duration Transport http.RoundTripper Backoff func(int, time.Duration) time.Duration IsRetryable func(*http.Response, error) bool IsSuccess func(*http.Response, error) bool // contains filtered or unexported fields }
RetryTransport provides automatic retry support as an `http.RoundTripper`.
Default cases are when a 429 or 500-series error is encountered, with an exponential backoff determined by `Backoff` and a maximum retry count of `MaxRetries`.
Example basic usage:
client := &http.Client{ Transport: NewRetryTransport(), } client.Get("https://www.pagerduty.com")
func NewRetryTransport ¶ added in v0.3.0
func NewRetryTransport() RetryTransport
Click to show internal directories.
Click to hide internal directories.