metrics

package
v0.9.16 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPMetrics

type HTTPMetrics struct {
	Methods map[string]*Metrics `json:"methods"`
	Status  map[int]*Metrics    `json:"status"`
	Sizes   map[int]*Metrics    `json:"sizes"`
}

func (*HTTPMetrics) AddMethodRequest

func (h *HTTPMetrics) AddMethodRequest(method string)

func (*HTTPMetrics) AddMethodResponse

func (h *HTTPMetrics) AddMethodResponse(method string)

func (*HTTPMetrics) AddSize

func (h *HTTPMetrics) AddSize(size int)

func (*HTTPMetrics) AddStatus

func (h *HTTPMetrics) AddStatus(status int)

func (*HTTPMetrics) MethodMetrics

func (h *HTTPMetrics) MethodMetrics(method string) *Metrics

func (*HTTPMetrics) SizeMetrics

func (h *HTTPMetrics) SizeMetrics(size int) *Metrics

func (*HTTPMetrics) StatusMetrics

func (h *HTTPMetrics) StatusMetrics(status int) *Metrics

type MemorySnapshot added in v0.9.1

type MemorySnapshot struct {
	Alloc        uint64 `json:"alloc"`
	TotalAlloc   uint64 `json:"totalAlloc"`
	Sys          uint64 `json:"sys"`
	Lookups      uint64 `json:"lookups"`
	Mallocs      uint64 `json:"mallocs"`
	Frees        uint64 `json:"frees"`
	HeapAlloc    uint64 `json:"heapAlloc"`
	HeapSys      uint64 `json:"heapSys"`
	HeapIdle     uint64 `json:"heapIdle"`
	HeapInuse    uint64 `json:"heapInuse"`
	HeapReleased uint64 `json:"heapReleased"`
	HeapObjects  uint64 `json:"heapObjects"`
	NumGC        uint32 `json:"numGC"`
}

type Metrics

type Metrics struct {
	Requests  uint64        `json:"requests,omitempty"`
	Responses uint64        `json:"responses,omitempty"`
	Latencies map[int64]int `json:"latencies,omitempty"`
}

func (*Metrics) AddLatency

func (h *Metrics) AddLatency(latency time.Duration)

func (*Metrics) AddRequest

func (h *Metrics) AddRequest()

func (*Metrics) AddResponse

func (h *Metrics) AddResponse()

type MetricsManager

type MetricsManager struct {
	sync.RWMutex `json:"-"`
	*Snapshot
	Segment *analytics.Client  `json:"-"`
	Logger  logrus.FieldLogger `json:"-"`
	// contains filtered or unexported fields
}

func NewMetricsManager

func NewMetricsManager(l logrus.FieldLogger) *MetricsManager

func (*MetricsManager) CommitTelemetry

func (sw *MetricsManager) CommitTelemetry()

func (*MetricsManager) RegisterSegment

func (sw *MetricsManager) RegisterSegment(version, hash, buildTime string)

func (*MetricsManager) ServeHTTP

func (sw *MetricsManager) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*MetricsManager) TickKeepAlive

func (sw *MetricsManager) TickKeepAlive()

type PathMetrics

type PathMetrics struct {
	*Metrics
	*HTTPMetrics
}

type Snapshot

type Snapshot struct {
	sync.RWMutex
	*Metrics
	*HTTPMetrics
	Paths  map[string]*PathMetrics `json:"paths"`
	ID     string                  `json:"id"`
	UpTime int64                   `json:"uptime"`

	MemorySnapshot *MemorySnapshot `json:"memory"`
	// contains filtered or unexported fields
}

func (*Snapshot) GetUpTime added in v0.9.1

func (sw *Snapshot) GetUpTime() int64

func (*Snapshot) Path

func (s *Snapshot) Path(path string) *PathMetrics

func (*Snapshot) Update added in v0.9.1

func (sw *Snapshot) Update()

Jump to

Keyboard shortcuts

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