agg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2014 License: Apache-2.0 Imports: 4 Imported by: 10

README

Agg

A small library for aggregating statistics about arbitrary actions

Usage

There's two public functions, Agg and Print. Read the comments on them for their usage.

For printing I've been using the following code:

go func() {
    log.Println("Waiting for signal")
    c := make(chan os.Signal, 1)
    signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT)
    <-c
    log.Println("Got SIG")
    agg.Print(1)
    time.Sleep(500 * time.Millisecond)
    os.Exit(0)
}()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Agg

func Agg(name string, n float64)

Agg sends the given value and adds it to the statistics for the given name

func Print

func Print(div float64)

Prints the current aggregation stats to stdout, dividing each by the given float. The dividing is so you can change the units that your statistics are being shown in, put in 1 if you want them as they were aggregated. Use 0 if you want your program to panic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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