stats

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 6 Imported by: 90

Documentation

Overview

Package stats provides a simple method for exporting statistics to HTTP.

Index

Constants

This section is empty.

Variables

View Source
var S = &Stats{vars: map[string]*Stat{}}

S is a Stats singleton.

Functions

This section is empty.

Types

type Stat

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

Stat provides a method of exporting a single named variable.

func (*Stat) Increment

func (s *Stat) Increment()

Increment increments this stat by 1.

func (*Stat) IncrementBy

func (s *Stat) IncrementBy(delta int64)

IncrementBy increments this stat by the given delta.

func (*Stat) NanoTimer

func (s *Stat) NanoTimer() func()

func (*Stat) Set

func (s *Stat) Set(val int64)

Set sets the value of this stat to the given val.

type Stats

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

Stats provides a mapping of named variables.

func (*Stats) Get

func (s *Stats) Get(name string) *Stat

Get returns the stat with the given name, creating it if necessary.

func (*Stats) ServeHTTP

func (s *Stats) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP makes Stats an http.Handler.

Jump to

Keyboard shortcuts

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