hdrhistogram

package
v0.0.0-...-f912f6f Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

package hdrhistogram is a small library that wraps github.com/codahale/hdrhistogram.WindowedHistogram to make WindowedHistogram synchronized and provides registry structure to simplify using multiple histograms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HDRHistogram

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

HDRHistogram is a synchronized wrapper over github.com/codahale/hdrhistogram.WindowedHistogram

func NewHDRHistogram

func NewHDRHistogram(name string, nHistograms int, minValue, maxValue int64, sigfigs int, quantiles []float64, quantity string) *HDRHistogram

NewHDRHistogram creates new HDRHistogram.

func (*HDRHistogram) LoadValues

func (h *HDRHistogram) LoadValues() map[string]int64

LoadValues allows to export map of histogram values - both current and merged.

func (*HDRHistogram) MergedSnapshot

func (h *HDRHistogram) MergedSnapshot() *hdr.Histogram

MergedSnapshot allows to get snapshot of merged histogram in a thread-safe way.

func (*HDRHistogram) RecordMicroseconds

func (h *HDRHistogram) RecordMicroseconds(value time.Duration) error

RecordMicroseconds allows to record time.Duration value as microseconds.

func (*HDRHistogram) RecordValue

func (h *HDRHistogram) RecordValue(value int64) error

RecordValue is wrapper over github.com/codahale/hdrhistogram.WindowedHistogram.RecordValue with extra mutex protection to allow concurrent writes.

func (*HDRHistogram) Rotate

func (h *HDRHistogram) Rotate()

Rotate histogram.

func (*HDRHistogram) Snapshot

func (h *HDRHistogram) Snapshot() *hdr.Histogram

Snapshot allows to get snapshot of current histogram in a thread-safe way.

type HDRHistogramRegistry

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

HDRHistogramRegistry is a wrapper to deal with several HDRHistogram instances. After it has been initialized you only can write values into histograms and extract data - do not register histograms dinamically after initial setup.

func NewHDRHistogramRegistry

func NewHDRHistogramRegistry() *HDRHistogramRegistry

NewHDRHistogramRegistry creates new HDRHistogramRegistry.

func (*HDRHistogramRegistry) LoadValues

func (r *HDRHistogramRegistry) LoadValues(names ...string) map[string]int64

LoadValues allows to get union of metric values over registered histograms - both for current and merged over all buckets. If names not provided then return values for all registered histograms.

func (*HDRHistogramRegistry) RecordMicroseconds

func (r *HDRHistogramRegistry) RecordMicroseconds(name string, value time.Duration) error

RecordMicroseconds into histogram with provided name. Panics if name not registered.

func (*HDRHistogramRegistry) RecordValue

func (r *HDRHistogramRegistry) RecordValue(name string, value int64) error

RecordValue into histogram with provided name. Panics if name not registered.

func (*HDRHistogramRegistry) Register

func (r *HDRHistogramRegistry) Register(h *HDRHistogram)

Register allows to register HDRHistogram in registry so you can use its name later to record values over registry instance using RecordValue and RecordMicroseconds methods.

func (*HDRHistogramRegistry) Rotate

func (r *HDRHistogramRegistry) Rotate()

Rotate all registered histograms.

Jump to

Keyboard shortcuts

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