Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtocolToSystem ¶ added in v0.0.90
ProtocolToSystem converts the request protocol to the format used by the OpenTelemetry semantic convention for RPC systems.
func SplitProcedure ¶ added in v0.0.90
SplitProcedure splits the RPC procedure into RPC service and RPC method components.
Types ¶
type Config ¶
type Config struct {
Host string `koanf:"host" default:"localhost"`
Port uint16 `koanf:"port" default:"5000"`
EnablePprof bool `koanf:"enablepprof"`
}
Config contains the configuration for creating a Server instance.
type Handler ¶
type Handler interface {
Register(*http.ServeMux, []connect.HandlerOption)
}
Handler implementations can register themselves to be hosted by the server.
type Recoverer ¶
type Recoverer struct {
// contains filtered or unexported fields
}
Recoverer handles the recovery from panics and should be used with connect.WithRecover.
When a panic occurs, the following are performed:
- A log record is produced containing the panic value and stacktrace.
- If available, the current span's status is set to error and the panic value is recorded as an event.
- The "rpc.server.panics" counter metric is incremented. This metric includes the "rpc.service" and "rpc.method" attributes.
func NewRecoverer ¶
func NewRecoverer(options ...RecovererOption) (*Recoverer, error)
NewRecoverer creates a Recoverer.
type RecovererOption ¶ added in v0.0.123
type RecovererOption interface {
// contains filtered or unexported methods
}
...
func WithMeterProvider ¶ added in v0.0.123
func WithMeterProvider(provider metric.MeterProvider) RecovererOption
...
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides a HTTP/2 server for one or more HTTP handlers.
func New ¶
func New( host string, port uint16, enablePprof bool, handlers []Handler, opts []connect.HandlerOption, ) *Server
New creates a new Server instance.
func NewFromConfig ¶
func NewFromConfig(config Config, handlers []Handler, opts []connect.HandlerOption) *Server
New creates a new Server instance from the given configuration.