endpoint

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package endpoint implements the HTTP endpoints of Ayd such as status page.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthzEndpoint

func HealthzEndpoint(s Store) http.HandlerFunc

HealthzEndpoint is the http.HandlerFunc for /healthz page.

func LogCSVEndpoint

func LogCSVEndpoint(s Store) http.HandlerFunc

func LogJsonEndpoint

func LogJsonEndpoint(s Store) http.HandlerFunc

func LogTSVEndpoint

func LogTSVEndpoint(s Store) http.HandlerFunc

func MetricsEndpoint

func MetricsEndpoint(s Store) http.HandlerFunc

MetricsEndpoint implements Prometheus metrics endpoint. This endpoint follows both of Prometheus specification and OpenMetrics specification.

func New

func New(s Store) http.Handler

New makes new http.Handler

func StatusHTMLEndpoint

func StatusHTMLEndpoint(s Store) http.HandlerFunc

func StatusJSONEndpoint

func StatusJSONEndpoint(s Store) http.HandlerFunc

func StatusTextEndpoint

func StatusTextEndpoint(s Store) http.HandlerFunc

func TargetsJSONEndpoint added in v0.12.0

func TargetsJSONEndpoint(s Store) http.HandlerFunc

TargetsJSONEndpoint replies target list in json format.

func TargetsTextEndpoint added in v0.12.0

func TargetsTextEndpoint(s Store) http.HandlerFunc

TargetsTextEndpoint replies target list in text.

func WithBasicAuth added in v0.12.0

func WithBasicAuth(handler http.Handler, userinfo string) http.Handler

WithBasicAuth wraps http.Handler with a BasicAuth.

Types

type BasicAuth

type BasicAuth struct {
	Handler            http.Handler
	Username, Password string
}

BasicAuth is a http.Handler wrapper that handles Basic Authorization. It supports only one pair of username and password.

func (BasicAuth) ServeHTTP

func (a BasicAuth) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LogFilter

type LogFilter struct {
	Scanner LogScanner
	Targets []string
}

func (LogFilter) Bytes

func (f LogFilter) Bytes() []byte

func (LogFilter) Close

func (f LogFilter) Close() error

func (LogFilter) Record

func (f LogFilter) Record() api.Record

func (LogFilter) Scan

func (f LogFilter) Scan() bool

type LogGenerator

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

func NewLogGenerator

func NewLogGenerator(s Store, since, until time.Time) *LogGenerator

func (*LogGenerator) Bytes

func (g *LogGenerator) Bytes() []byte

func (*LogGenerator) Close

func (g *LogGenerator) Close() error

func (LogGenerator) Len

func (g LogGenerator) Len() int

func (LogGenerator) Less

func (g LogGenerator) Less(i, j int) bool

func (*LogGenerator) Record

func (g *LogGenerator) Record() api.Record

func (*LogGenerator) Scan

func (g *LogGenerator) Scan() bool

func (LogGenerator) Swap

func (g LogGenerator) Swap(i, j int)

type LogReader

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

func NewLogReader

func NewLogReader(path string, since, until time.Time) (*LogReader, error)

func NewLogReaderFromReader

func NewLogReaderFromReader(f io.ReadCloser, since, until time.Time) *LogReader

func (*LogReader) Bytes

func (r *LogReader) Bytes() []byte

func (*LogReader) Close

func (r *LogReader) Close() error

func (*LogReader) Record

func (r *LogReader) Record() api.Record

func (*LogReader) Scan

func (r *LogReader) Scan() bool

type LogScanner

type LogScanner interface {
	Close() error
	Scan() bool
	Bytes() []byte
	Record() api.Record
}

func NewLogScanner

func NewLogScanner(s Store, since, until time.Time) (LogScanner, error)

type Store added in v0.12.0

type Store interface {
	// Path returns path to log file.
	Path() string

	// Targets returns target URLs include inactive target.
	Targets() []string

	// ProbeHistory returns a slice of ProbeHistory.
	ProbeHistory() []api.ProbeHistory

	// MakeReport creates ayd.Report for exporting for endpoint.
	MakeReport() api.Report

	// ReportInternalError reports Ayd internal error.
	ReportInternalError(scope, message string)

	// Errors returns a list of internal (critical) errors.
	Errors() (healthy bool, messages []string)

	// IncidentCount returns the count of incident causes.
	IncidentCount() int
}

Jump to

Keyboard shortcuts

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