http_server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_HANDLE_MONITOR = 0 // handler for monitor
	HTTP_HANDLE_RELOAD  = 1 // handler for reload
	HTTP_HANDLE_METRIC  = 2 // handler for metric
)

type of web handler

Variables

This section is empty.

Functions

func ParamsMultiValueGet

func ParamsMultiValueGet(params map[string][]string, key string) ([]string, error)

ParamsMultiValueGet gets values for given key in params

func ParamsValueGet

func ParamsValueGet(params map[string][]string, key string) (string, error)

ParamsValueGet gets one (the first) value for given key in params

func RegisterHandlers

func RegisterHandlers(wh *HttpHandlers, hType int, ht map[string]interface{}) error

RegisterHandlers registers handlers in handler-table to WebHandlers

Params:

  • wh : WebHandlers
  • hType : hanlder type, WEB_HANDLE_MONITOR or WEB_HANDLE_RELOAD
  • ht : handler table

Types

type GroupMetrics

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

func (*GroupMetrics) Counter

func (gm *GroupMetrics) Counter(prefix string, tags map[string]string) metrics.Counter

func (*GroupMetrics) Gauge

func (gm *GroupMetrics) Gauge(prefix string, tags map[string]string) metrics.Gauge

func (*GroupMetrics) Histogram

func (gm *GroupMetrics) Histogram(prefix string, tags map[string]string) metrics.Histogram

func (*GroupMetrics) HistogramWithBucket

func (gm *GroupMetrics) HistogramWithBucket(prefix string, tags map[string]string, buckets metrics.Buckets) metrics.Histogram

func (*GroupMetrics) IntegerGauge

func (gm *GroupMetrics) IntegerGauge(prefix string, tags map[string]string) metrics.IntegerGauge

func (*GroupMetrics) Timer

func (gm *GroupMetrics) Timer(prefix string, tags map[string]string) metrics.Timer

type HttpHandlerMap

type HttpHandlerMap map[string]interface{}

func NewHttpHandlerMap

func NewHttpHandlerMap() *HttpHandlerMap

NewWebHandlerMap creates new WebHandlerMap

type HttpHandlers

type HttpHandlers struct {
	Handlers map[int]*HttpHandlerMap
}

func NewWebHandlers

func NewWebHandlers() *HttpHandlers

NewWebHandlers creates new WebHandlers

func (*HttpHandlers) GetHandler

func (wh *HttpHandlers) GetHandler(hType int, command string) (interface{}, error)

GetHandler gets handler list for given callback point

func (*HttpHandlers) RegisterHandler

func (wh *HttpHandlers) RegisterHandler(hType int, command string, f interface{}) error

RegisterHandler adds filter to given callback point

type HttpServer

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

func NewHttpServer

func NewHttpServer(name string, version string, port int) *HttpServer

func (*HttpServer) GetPromMetrics

func (srv *HttpServer) GetPromMetrics() *PromMetrics

func (*HttpServer) HandlersSet

func (srv *HttpServer) HandlersSet(handlers *HttpHandlers)

func (*HttpServer) ListenAndServe

func (srv *HttpServer) ListenAndServe() error

ListenAndServe start embeded web server

func (*HttpServer) RegisterHandler

func (srv *HttpServer) RegisterHandler(hType int, command string, f interface{}) error

func (*HttpServer) RegisterHandlers

func (srv *HttpServer) RegisterHandlers(hType int, ht map[string]interface{}) error

func (*HttpServer) Start

func (srv *HttpServer) Start()

Start starts embeded web server

type PromMetrics

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

func (*PromMetrics) RegistryGroup

func (pm *PromMetrics) RegistryGroup(prefix string, tags map[string]string, interval time.Duration) *GroupMetrics

Jump to

Keyboard shortcuts

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