apiconnect

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

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

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

func NewAPI(opts Options) *API

NewAPI returns a new Connect API handler. Peer may be nil when clustering is disabled.

func (*API) GetStatus

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

func (api *API) Procedures() []string

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.

func (*API) Shutdown

func (api *API) Shutdown()

Shutdown rejects new RPCs and cancels active RPCs.

func (*API) Update

func (api *API) Update(cfg *config.Config)

Update swaps in the currently loaded configuration. It is safe for concurrent use with the RPC handlers.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL