Categorygithub.com/emitter-io/stats
modulepackage
1.0.3
Repository: https://github.com/emitter-io/stats.git
Documentation: pkg.go.dev

# README

Emitter Stats

This golang package is used for monitoring emitter.io cluster. This provides a tight binary compression and a single histogram/counter abstraction in order to deal with various kinds of system monitoring. This package is compatible with GopherJS (snapshot-only) and hence can also be compiled to javascript. Documentation is available on go doc.

Join the chat at https://gitter.im/emitter-io/public Build status Coverage Status Go Report Card

Installation

go get -u github.com/emitter-io/stats

Quick Start

The package itself provides a general-purpose monitoring capabilities, with tight encoding using our binary codec. While it's primarily have been built for emitter, it can be used anywhere.

Typical usage consists of creating a metric container, measuring various metrics and sending snapshots over the wire.

rand.Seed(time.Now().UnixNano())

// Create a container
m := stats.New()

// Measure few metrics
m.Measure("my.metric.1", rand.Int31n(1000))
m.Measure("my.metric.2", rand.Int31n(1000))

// Create a snapshot which can be transferred over the wire
bytes := m.Snapshot()

// Restore a snapshot from binary
v, err := stats.Restore(bytes)

// Get the values back
percentiles := v[0].Quantile(50, 90, 95, 99)
average := v[0].Mean()
count := v[0].Count()

# Packages

No description provided by the author

# Functions

New creates a new monitor.
NewMetric creates a new metric.
NewNoop creates a new no-op monitor.
Restore restores a snapshot into a read-only histogram format.

# Structs

Bin represents a bin of a histogram.
Metric maintains a combination of a gauge and a statistically-significant selection of the values from a stream.
Monitor represents a monitoring registry.
Noop represents a no-op monitor.
Snapshot is a read-only copy of another Sample.

# Interfaces

Measurer represents a monitoring contract.
Snapshotter represents a snapshotting contract.

# Type aliases

Snapshots represents a set of snapshots.