metricsx

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(value string) string

func Retry

func Retry(logger logrus.FieldLogger, maxWait time.Duration, failAfter time.Duration, f func() error) (err error)

Types

type MemoryStatistics

type MemoryStatistics struct {
	sync.Mutex
	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"`
}

func (*MemoryStatistics) ToMap

func (ms *MemoryStatistics) ToMap() map[string]interface{}

func (*MemoryStatistics) Update

func (ms *MemoryStatistics) Update()

type MetricsManager

type MetricsManager struct {
	sync.RWMutex `json:"-"`

	Segment analytics.Client   `json:"-"`
	Logger  logrus.FieldLogger `json:"-"`

	ID               string            `json:"id"`
	UpTime           int64             `json:"uptime"`
	MemoryStatistics *MemoryStatistics `json:"memory"`
	BuildVersion     string            `json:"buildVersion"`
	BuildHash        string            `json:"buildHash"`
	BuildTime        string            `json:"buildTime"`
	InstanceID       string            `json:"instanceId"`
	ServiceName      string            `json:"serviceName"`
	// contains filtered or unexported fields
}

func NewMetricsManager

func NewMetricsManager(
	id string,
	enable bool,
	writeKey string,
	whitelistedURLs []string,
	logger logrus.FieldLogger,
	serviceName string,
	sampling float64,
	endpoint string,
) *MetricsManager

func NewMetricsManagerWithConfig

func NewMetricsManagerWithConfig(
	id string,
	enable bool,
	writeKey string,
	whitelistedURLs []string,
	logger logrus.FieldLogger,
	serviceName string,
	sampling float64,
	config analytics.Config,
) *MetricsManager

func (*MetricsManager) CommitMemoryStatistics

func (sw *MetricsManager) CommitMemoryStatistics()

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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