Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
func NewContext(ctx context.Context, txn Transaction) context.Context
NewContext associates the transaction with the provided context. FromContext can then be used to retrieve the transaction.
Types ¶
type Provider ¶
type Provider interface { // StartTransaction starts a new Transaction with the provided name and // arguments. StartTransaction(name string, args ...Arg) Transaction // StartWebTransaction starts a new web Transaction with the provided name // and arguments. StartWebTransaction( name string, w http.ResponseWriter, r *http.Request, args ...Arg, ) (Transaction, http.ResponseWriter, *http.Request) // WrapHandle is a convenience function for wrapping an http.Handler and // adding all necessary tracing information. WrapHandle(pattern string, handler http.Handler) (string, http.Handler) }
Provider is the interface that can create Transactions.
func NewNoOpProvider ¶
func NewNoOpProvider() Provider
NewNoOpProvider returns a new provider that does nothing.
type Segment ¶
type Segment interface {
// End marks the segment as finished.
End()
}
A Segment is a part of a transaction used to instrument functions, methods, and blocks of code.
type Transaction ¶
type Transaction interface { // SetName sets the current transaction's name. SetName(name string) // AddAttributes adds any attributes after the transaction was created. AddAttributes(args ...Arg) // StartSegment creates a new Segment inside the transaction. StartSegment(name string) Segment // NoticeError associates an error with the transaction. NoticeError(err error) // End marks the transaction as finished. End() }
A Transaction represents one logical unit of work: either an inbound web request or background task.
func FromContext ¶
func FromContext(ctx context.Context) Transaction
FromContext returns the current Transaction associated with the Context.
func NewNoOpTransaction ¶
func NewNoOpTransaction() Transaction
NewNoOpTransaction returns a Transaction that does nothing. Useful for tests.
Click to show internal directories.
Click to hide internal directories.