http

package module
v5.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 30 Imported by: 1

README

Documentation

Index

Constants

View Source
const (
	// PluginName declares plugin name.
	PluginName        = "http"
	MB         uint64 = 1024 * 1024

	// RrMode RR_HTTP env variable key (internal) if the HTTP presents
	RrMode     = "RR_MODE"
	RrModeHTTP = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Informer

type Informer interface {
	Workers() []*process.State
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin manages pool, http servers. The main http plugin structure

func (*Plugin) AddWorker

func (p *Plugin) AddWorker() error

func (*Plugin) Collects

func (p *Plugin) Collects() []*dep.In

Collects collecting http middlewares

func (*Plugin) Init

func (p *Plugin) Init(cfg common.Configurer, log common.Logger, srv common.Server) error

Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.

func (*Plugin) MetricsCollector

func (p *Plugin) MetricsCollector() []prometheus.Collector

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns endure.Named interface implementation

func (*Plugin) Ready

func (p *Plugin) Ready() (*status.Status, error)

Ready return readiness status of the particular plugin

func (*Plugin) RemoveWorker

func (p *Plugin) RemoveWorker(ctx context.Context) error

func (*Plugin) Reset

func (p *Plugin) Reset() error

Reset destroys the old pool and replaces it with new one, waiting for old pool to die

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

Serve serves the svc.

func (*Plugin) ServeHTTP

func (p *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles connection using set of middleware and pool PSR-7 server.

func (*Plugin) Status

func (p *Plugin) Status() (*status.Status, error)

Status return status of the particular plugin

func (*Plugin) Stop

func (p *Plugin) Stop(ctx context.Context) error

Stop stops the http.

func (*Plugin) Workers

func (p *Plugin) Workers() []*process.State

Workers returns slice with the process states for the workers

type StatsExporter

type StatsExporter struct {
	TotalMemoryDesc  *prometheus.Desc
	StateDesc        *prometheus.Desc
	WorkerMemoryDesc *prometheus.Desc
	TotalWorkersDesc *prometheus.Desc

	WorkersReady   *prometheus.Desc
	WorkersWorking *prometheus.Desc
	WorkersInvalid *prometheus.Desc

	Workers Informer
}

func (*StatsExporter) Collect

func (s *StatsExporter) Collect(ch chan<- prometheus.Metric)

func (*StatsExporter) Describe

func (s *StatsExporter) Describe(d chan<- *prometheus.Desc)

type StdLogAdapter

type StdLogAdapter struct {
	// contains filtered or unexported fields
}

StdLogAdapter can be passed to the http.Server or any place which required standard logger to redirect output to the logger plugin

func NewStdAdapter

func NewStdAdapter(log *zap.Logger) *StdLogAdapter

NewStdAdapter constructs StdLogAdapter

func (*StdLogAdapter) Write

func (s *StdLogAdapter) Write(p []byte) (n int, err error)

Write io.Writer interface implementation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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