Documentation
¶
Overview ¶
Package apiconnect implements the experimental ConnectRPC-based Alertmanager API. It is always mounted alongside API v2. Connect and gRPC-Web use the version-neutral /api/ prefix, while native gRPC uses the server root. Each service is independently versioned (e.g. status.v3alpha); the package itself carries no umbrella version.
Index ¶
- type API
- func (api *API) GetStatus(ctx context.Context, _ *connect.Request[statusv3alpha.GetStatusRequest]) (*connect.Response[statusv3alpha.GetStatusResponse], error)
- func (api *API) Handler(opts ...connect.HandlerOption) http.Handler
- func (api *API) Procedures() []string
- func (api *API) Shutdown()
- func (api *API) Update(cfg *config.Config)
- type Options
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 implements the ConnectRPC service handlers for the Connect API.
func NewAPI ¶
NewAPI returns a new Connect API handler. Peer may be nil when clustering is disabled.
func (*API) GetStatus ¶
func (api *API) GetStatus(ctx context.Context, _ *connect.Request[statusv3alpha.GetStatusRequest]) (*connect.Response[statusv3alpha.GetStatusResponse], error)
GetStatus returns the Alertmanager instance and cluster status.
func (*API) Handler ¶
func (api *API) Handler(opts ...connect.HandlerOption) http.Handler
Handler returns an http.Handler serving every ConnectRPC service exposed by the Connect API: the versioned application services, the gRPC Health Checking Protocol (grpc.health.v1.Health), and gRPC server reflection (v1 and v1alpha, for tools such as grpcurl). Procedures are fully-qualified, so the returned handler is mounted at a single prefix.
func (*API) Procedures ¶
Procedures returns the fully-qualified URL paths for every procedure registered by Handler. Callers use it to bound metric and trace labels. Handler rejects every request path that is not in this list.
type Options ¶
type Options struct {
// Peer provides cluster status. A nil value disables clustering.
Peer cluster.ClusterPeer
// Registerer registers API metrics. A nil value keeps usable metrics without
// registering them.
Registerer prometheus.Registerer
// UnaryConcurrency limits Connect unary RPCs independently. Non-positive
// values use GOMAXPROCS or 8, whichever is larger.
UnaryConcurrency int
// StreamConcurrency limits Connect streams independently. Non-positive
// values use GOMAXPROCS or 8, whichever is larger.
StreamConcurrency int
// UnaryTimeout limits Connect unary RPCs, including request reads.
// Non-positive values disable the timeout.
UnaryTimeout time.Duration
// StreamIdleTimeout limits the time between messages on a Connect stream.
// Non-positive values disable the timeout.
StreamIdleTimeout time.Duration
// StreamLifetime limits the total lifetime of a Connect stream.
// Non-positive values disable the timeout.
StreamLifetime time.Duration
// ReadMaxBytes limits each incoming protobuf message. Non-positive values do
// not set a limit.
ReadMaxBytes int
// SendMaxBytes limits each outgoing protobuf message. Non-positive values do
// not set a limit.
SendMaxBytes int
// MaxRequestBodyBytes limits a unary request body before decoding.
// Non-positive values do not set a limit.
MaxRequestBodyBytes int64
}
Options configures the Connect API.