present

package
v2.0.0-...-0981395 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: Apache-2.0 Imports: 16 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Deprecated, look in gopkg.in/spacemonkeygo/monkit.v2/collect
	// for these utilities
	NewSpanCollector = collect.NewSpanCollector
	WatchForSpans    = collect.WatchForSpans
	CollectSpans     = collect.CollectSpans
)

Functions

func FilteredStatsJSON

func FilteredStatsJSON(r *monkit.Registry, w io.Writer, prefix string) (
	err error)

FilteredStatsJSON writes all of the name/value statistics pairs the Registry knows where the name has the given prefix to w in a JSON format.

func FilteredStatsText

func FilteredStatsText(r *monkit.Registry, w io.Writer, prefix string) (
	err error)

FilteredStatsText writes all of the name/value statistics pairs the Registry knows where the name has the given prefix to w in a text format.

func FuncsDot

func FuncsDot(r *monkit.Registry, w io.Writer) (err error)

FuncsDot finds all of the Funcs known by Registry r and writes information about them in the dot graphics file format to w.

func FuncsJSON

func FuncsJSON(r *monkit.Registry, w io.Writer) (err error)

FuncsJSON finds all of the Funcs known by Registry r and writes information about them in the JSON format to w.

func FuncsText

func FuncsText(r *monkit.Registry, w io.Writer) (err error)

FuncsText finds all of the Funcs known by Registry r and writes information about them in a plain text format to w.

func HTTP

func HTTP(r *monkit.Registry) http.Handler

HTTP makes an http.Handler out of a Registry. It serves paths using this package's FromRequest request router. Usually HTTP is called with the Default registry.

func SpansDot

func SpansDot(r *monkit.Registry, w io.Writer) error

SpansDot finds all of the current Spans known by Registry r and writes information about them in the dot graphics file format to w.

func SpansJSON

func SpansJSON(r *monkit.Registry, w io.Writer) (err error)

SpansJSON finds all of the current Spans known by Registry r and writes information about them in the JSON format to w.

func SpansText

func SpansText(r *monkit.Registry, w io.Writer) (err error)

SpansText finds all of the current Spans known by Registry r and writes information about them in a plain text format to w.

func SpansToJSON

func SpansToJSON(w io.Writer, spans []*collect.FinishedSpan) error

SpansToJSON turns a list of FinishedSpans into JSON format.

func SpansToSVG

func SpansToSVG(w io.Writer, spans []*collect.FinishedSpan) error

SpansToSVG takes a list of FinishedSpans and writes them to w in SVG format. It draws a trace using the Spans where the Spans are ordered by start time.

func StatsJSON

func StatsJSON(r *monkit.Registry, w io.Writer) (err error)

StatsJSON writes all of the name/value statistics pairs the Registry knows to w in a JSON format.

func StatsText

func StatsText(r *monkit.Registry, w io.Writer) (err error)

StatsText writes all of the name/value statistics pairs the Registry knows to w in a text format.

func TraceQueryJSON

func TraceQueryJSON(reg *monkit.Registry, w io.Writer,
	matcher func(*monkit.Span) bool) (write_err error)

TraceQueryJSON uses WatchForSpans to write all Spans from 'reg' matching 'matcher' to 'w' in JSON format.

func TraceQuerySVG

func TraceQuerySVG(reg *monkit.Registry, w io.Writer,
	matcher func(*monkit.Span) bool) error

TraceQuerySVG uses WatchForSpans to write all Spans from 'reg' matching 'matcher' to 'w' in SVG format.

Types

type Result

type Result func(io.Writer) error

Result writes the expected data to io.Writer and returns any errors if found.

func FromRequest

func FromRequest(reg *monkit.Registry, path string, query url.Values) (
	f Result, contentType string, err error)

FromRequest takes a registry (usually the Default registry), an incoming path, and optional query parameters, and returns a Result if possible.

FromRequest understands the following paths:

  • /ps, /ps/text - returns the result of SpansText
  • /ps/dot - returns the result of SpansDot
  • /ps/json - returns the result of SpansJSON
  • /funcs, /funcs/text - returns the result of FuncsText
  • /funcs/dot - returns the result of FuncsDot
  • /funcs/json - returns the result of FuncsJSON
  • /stats, /stats/text - returns the result of StatsText
  • /stats/json - returns the result of StatsJSON
  • /trace/svg - returns the result of TraceQuerySVG
  • /trace/json - returns the result of TraceQueryJSON

The last two paths are worth discussing in more detail, as they take query parameters. All trace endpoints require at least one of the following two query parameters:

  • regex - If provided, the very next Span that crosses a Func that has a name that matches this regex will start a trace until that triggering Span ends, provided the trace_id matches.
  • trace_id - If provided, the very next Span on a trace with the given trace id will start a trace until the triggering Span ends, provided the regex matches. NOTE: the trace_id will be parsed in hex.

By default, regular expressions are matched ahead of time against all known Funcs, but perhaps the Func you want to trace hasn't been observed by the process yet, in which case the regex will fail to match anything. You can turn off this preselection behavior by providing preselect=false as an additional query param. Be advised that until a trace completes, whether or not it has started, it adds a small amount of overhead (a comparison or two) to every monitored function.

Jump to

Keyboard shortcuts

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