Documentation
¶
Overview ¶
Package heroku provides Console status providers backed by Heroku's Platform API. Provider reports the health of a Heroku app from the state of its dynos (GET /apps/{app}/dynos).
It satisfies the status.Provider interface structurally (Name + Check), so it does not import the status package and adds no coupling beyond core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures a Provider.
func WithBaseURL ¶
WithBaseURL overrides the Platform API base URL (testing / gateways).
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client.
type Provider ¶
type Provider struct {
// Token is the default Heroku API token, used when a component does not set
// "api_token". Typically sourced from the HEROKU_API_KEY env var.
Token string
// BaseURL is the Platform API base URL; defaults to Heroku's. Overridable for
// testing or a self-hosted gateway.
BaseURL string
// HTTP issues the API request. If nil, a client with a sane timeout is used.
HTTP *http.Client
}
Provider checks a Heroku app's health from the state of its dynos. The fraction of dynos reporting "up" maps to a health state.
It reads its target from core.Component.Config:
app required; the Heroku app name api_token optional; overrides the provider's default token timeout optional; API call timeout as a Go duration, default "10s"
State mapping (over the dynos returned by the API):
all dynos up (and >=1 dyno) -> StateOperational at least one up but others not -> StateDegraded zero dynos up -> StateDown API/network failure or non-2xx -> StateDown no app / token -> StateUnknown (configuration gap) zero dynos returned -> StateUnknown (no dynos)