Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API represents all APIs of Alertmanager.
func New ¶
New creates a new API object combining all API versions. Note that an Update call is also needed to get the APIs into an operational state.
func (*API) Register ¶
Register API. As APIv2 works on the http.Handler level, this method also creates a new http.ServeMux and then uses it to register both the provided router (to handle "/") and APIv2 (to handle "<routePrefix>/api/v2"). The method returns the newly created http.ServeMux. If a timeout has been set on construction of API, it is enforced for all HTTP request going through this mux. The same is true for the concurrency limit, with the exception that it is only applied to GET requests.
type Options ¶
type Options struct { // Alerts to be used by the API. Mandatory. Alerts provider.Alerts // Silences to be used by the API. Mandatory. Silences *silence.Silences // AlertStatusFunc is used be the API to retrieve the AlertStatus of an // alert. Mandatory. AlertStatusFunc func(model.Fingerprint) types.AlertStatus // GroupMutedFunc is used be the API to know if an alert is muted. // Mandatory. GroupMutedFunc func(routeID, groupKey string) ([]string, bool) // Peer from the gossip cluster. If nil, no clustering will be used. Peer cluster.ClusterPeer // Timeout for all HTTP connections. The zero value (and negative // values) result in no timeout. Timeout time.Duration // Concurrency limit for GET requests. The zero value (and negative // values) result in a limit of GOMAXPROCS or 8, whichever is // larger. Status code 503 is served for GET requests that would exceed // the concurrency limit. Concurrency int // Logger is used for logging, if nil, no logging will happen. Logger log.Logger // Registry is used to register Prometheus metrics. If nil, no metrics // registration will happen. Registry prometheus.Registerer // GroupFunc returns a list of alert groups. The alerts are grouped // according to the current active configuration. Alerts returned are // filtered by the arguments provided to the function. GroupFunc func(func(*dispatch.Route) bool, func(*types.Alert, time.Time) bool) (dispatch.AlertGroups, map[model.Fingerprint][]string) }
Options for the creation of an API object. Alerts, Silences, AlertStatusFunc and GroupMutedFunc are mandatory. The zero value for everything else is a safe default.
type V1DeprecationRouter ¶
type V1DeprecationRouter struct {
// contains filtered or unexported fields
}
V1DeprecationRouter is the router to signal v1 users that the API v1 is now removed.
func NewV1DeprecationRouter ¶
func NewV1DeprecationRouter(l log.Logger) *V1DeprecationRouter
NewV1DeprecationRouter returns a new V1DeprecationRouter.
func (*V1DeprecationRouter) Register ¶
func (dr *V1DeprecationRouter) Register(r *route.Router)
Register registers all the API v1 routes with an endpoint that returns a JSON deprecation notice and a logs a warning.