stats

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package stats provides stats reporting and storing abstractions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stats

type Stats struct {
	*expvar.Map
	// contains filtered or unexported fields
}

Stats is the statistics reporting entity of the downloader. It wraps an expvar.Map and acts as a deamon that reports stats using the provided reportfunc on the specified interval.

func New

func New(id string, interval time.Duration, report func(*expvar.Map)) *Stats

New accepts an custom identifier for the thing being monitored, an interval on which to report the metrics and the report function.

func (*Stats) Run

func (s *Stats) Run(ctx context.Context)

Run calls the report function of Stats using the specified interval/ It shuts down when the provided context is cancelled

Jump to

Keyboard shortcuts

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