Documentation
¶
Index ¶
- func FuncsDot(r *monkit.Registry, w io.Writer) (err error)
- func FuncsJSON(r *monkit.Registry, w io.Writer) (err error)
- func FuncsText(r *monkit.Registry, w io.Writer) (err error)
- func HTTP(r *monkit.Registry) http.Handler
- func SpansDot(r *monkit.Registry, w io.Writer) error
- func SpansJSON(r *monkit.Registry, w io.Writer) (err error)
- func SpansText(r *monkit.Registry, w io.Writer) (err error)
- func SpansToJSON(w io.Writer, spans []*collect.FinishedSpan) error
- func SpansToSVG(w io.Writer, spans []*collect.FinishedSpan) error
- func StatsJSON(r *monkit.Registry, w io.Writer) (err error)
- func StatsOld(r *monkit.Registry, w io.Writer) (err error)
- func StatsText(r *monkit.Registry, w io.Writer) (err error)
- func TraceQueryJSON(reg *monkit.Registry, w io.Writer, matcher func(*monkit.Span) bool) (write_err error)
- func TraceQuerySVG(reg *monkit.Registry, w io.Writer, matcher func(*monkit.Span) bool) error
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FuncsDot ¶
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 ¶
FuncsJSON finds all of the Funcs known by Registry r and writes information about them in the JSON format to w.
func FuncsText ¶
FuncsText finds all of the Funcs known by Registry r and writes information about them in a plain text format to w.
func HTTP ¶
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 ¶
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 ¶
SpansJSON finds all of the current Spans known by Registry r and writes information about them in the JSON format to w.
func SpansText ¶
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 ¶
StatsJSON writes all of the name/value statistics pairs the Registry knows to w in a JSON format.
func StatsOld ¶
StatsOld writes all of the name/value statistics pairs the Registry knows to w in a text format.
func StatsText ¶
StatsText writes all of the name/value statistics pairs the Registry knows to w in a text format.
Types ¶
type Result ¶
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.