callstat

package
v0.0.0-...-2e8e066 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package callstat provides a few convenient types for tracking function call statistics. It is useful for any system that tracks local or remote procedure call durations or automatically retries failed calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	// Description is a textual description of the call.
	Description string
	// Start is the time at which the call started.
	Start time.Time
	// End is the time at which the call ended or timed out.
	End time.Time
	// Err is the error returned from unsuccessful calls.
	Err error
	// Inner is the set of internal subcalls that were made as part of the call.
	Inner []Call
}

Call represents information about a function call.

func (*Call) Add

func (c *Call) Add(inner *Call)

Add adds the given call as inner call.

func (*Call) Begin

func (c *Call) Begin(description string)

Begin sets the call description and records the current time as the start of the call.

func (*Call) Complete

func (c *Call) Complete(err error)

Complete sets the call error state and records the current time as the end of the call.

If the call was not previously started, Complete assumes that the start and end times of the call are equal.

func (*Call) Duration

func (c *Call) Duration() time.Duration

Duration is the total wall time it took to make the call.

func (Call) String

func (c Call) String() string

String returns a string representation of the call data.

Jump to

Keyboard shortcuts

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