Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bketelsen/trace
/ functions
Functions
40 in github.com/bketelsen/trace
⨍
Functions
40
◇
Types & classes
6
↓ 8 callers
Method
Finish
Finish declares that this trace is complete. The trace should not be used after calling this method.
trace.go:104
↓ 5 callers
Function
NewContext
NewContext returns a new context.Context and Trace with the given family and title. The trace will be stored in the context.
context.go:48
↓ 5 callers
Method
Printf
Printf formats its arguments with fmt.Sprintf and adds the result to the event log.
events.go:24
↓ 5 callers
Method
SetError
SetError declares that this trace resulted in an error.
trace.go:76
↓ 4 callers
Method
String
()
log.go:83
↓ 3 callers
Function
DumpMetrics
DumpMetrics returns the metrics prometheus would return when collected as a string, for fun and testing
metrics.go:103
↓ 3 callers
Function
KeyValue
KeyValue creates a Key/Value pair that is suitable for use in the LogMessage() function
log.go:34
↓ 2 callers
Method
LazyLog
LazyLog adds x to the event log. It will be evaluated each time the debug/requests page is rendered. Any memory referenced by x will be pinned until t
trace.go:61
↓ 2 callers
Method
LazyPrintf
LazyPrintf evaluates its arguments with fmt.Sprintf each time the debug/requests page is rendered. Any memory referenced by a will be pinned until the
trace.go:69
↓ 2 callers
Function
LogMessage
LogMessage creates a message that complies with fmt.Stringer but also includes a message and key/value pairs for structured logging. Use it in trace.L
log.go:43
↓ 2 callers
Function
incrError
(t *trace)
metrics.go:63
↓ 2 callers
Function
newTrace
(family, title string)
trace.go:34
↓ 2 callers
Function
randomID
()
trace.go:115
↓ 2 callers
Function
toString
(x interface{})
log.go:111
↓ 1 callers
Method
Finish
Finish declares that this event log is complete. The event log should not be used after calling this method.
events.go:38
↓ 1 callers
Function
addEvent
(t *EventLog, format string, a ...interface{})
log.go:76
↓ 1 callers
Function
addTrace
(t *trace, format string, a ...interface{})
log.go:68
↓ 1 callers
Method
child
(title string)
trace.go:46
↓ 1 callers
Function
contextWithTrace
(ctx context.Context, trace *trace)
context.go:14
↓ 1 callers
Function
duration
(t *trace)
metrics.go:68
↓ 1 callers
Function
incr
(t *trace)
metrics.go:58
↓ 1 callers
Function
logMessageWithTrace
(t *trace, message string, keyvals ...keyval)
log.go:47
↓ 1 callers
Function
parentOrChildFromContext
(ctx context.Context, family, title string)
context.go:28
↓ 1 callers
Function
search
(ctx context.Context, root string, pattern string)
examples/gogrep/gogrep.go:16
↓ 1 callers
Function
traceFromContext
(ctx context.Context)
context.go:20
Method
Errorf
Errorf is like Printf, but it marks this event as an error.
events.go:31
Function
New
New returns a new Trace with the specified family and title.
trace.go:30
Function
NewEventLog
NewEventLog returns an initialized EventLog with the given family and title.
events.go:13
Function
PushMetrics
PushMetrics sends the metrics collected to the prometheus push gateway at the url in `gatewayURL` with the job name of `task` Should be called in a de
metrics.go:85
Method
ServeHTTP
Inside the handler, use traces to capture request specific events and timings and the el member to log service specific events - like failures
examples/service/main.go:20
Function
ServeMetrics
ServeMetrics serves Prometheus metrics endpoint on the provided net.Listener Use for long-running services. For cli tools, use PushMetrics instead.
metrics.go:77
Function
SetAuthRequest
SetAuthRequest sets the AuthRequest function for the underlying trace HTTP listener, which determines whether a specific request is permitted to load
trace.go:25
Function
SetLogger
SetLogger replaces the default logger with a new one that writes to 'out', has 'prefix', and flags 'flag'
log.go:18
Method
SetMaxEvents
SetMaxEvents sets the maximum number of events that will be stored in the trace. This has no effect if any events have already been added to the trace
trace.go:98
Method
SetRecycler
SetRecycler sets a recycler for the trace. f will be called for each event passed to LazyLog at a time when it is no longer required, whether while th
trace.go:85
Method
SetTraceInfo
SetTraceInfo sets the trace info for the trace. This is currently unused.
trace.go:91
Function
TitleFromContext
TitleFromContext is a convenience function that returns the Trace's title from a context or an empty string if none exists
context.go:38
Function
init
()
metrics.go:19
Function
main
()
examples/service/main.go:30
Function
main
()
examples/gogrep/main.go:14