spanstat

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package spanstat provides a mechanism to measure duration of multiple spans and add them up to a total duration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SpanStat

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

SpanStat measures the total duration of all time spent in between Start() and Stop() calls.

func Start

func Start() *SpanStat

Start creates a new SpanStat and starts it

func (*SpanStat) End

func (s *SpanStat) End(success bool) *SpanStat

End ends the current span and adds the measured duration to the total cumulated duration, and to the success or failure cumulated duration depending on the given success flag

func (*SpanStat) EndError

func (s *SpanStat) EndError(err error) *SpanStat

EndError calls End() based on the value of err

func (*SpanStat) FailureTotal

func (s *SpanStat) FailureTotal() time.Duration

FailureTotal returns the total duration of all unsuccessful spans measured

func (*SpanStat) Reset

func (s *SpanStat) Reset()

Reset rests the duration measurements

func (*SpanStat) Seconds added in v1.6.0

func (s *SpanStat) Seconds() float64

Seconds returns the number of seconds represents by the spanstat. If a span is still open, it is closed first.

func (*SpanStat) Start

func (s *SpanStat) Start() *SpanStat

Start starts a new span

func (*SpanStat) SuccessTotal

func (s *SpanStat) SuccessTotal() time.Duration

SuccessTotal returns the total duration of all successful spans measured

func (*SpanStat) Total

func (s *SpanStat) Total() time.Duration

Total returns the total duration of all spans measured, including both successes and failures

Jump to

Keyboard shortcuts

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