Documentation
¶
Index ¶
- Variables
- func CreateInitialSpan(method, uri string) *tracing.Span
- type Context
- func (c *Context) AppendJob(job *async.Job)
- func (c *Context) AppendMetrics(metrics *response.Metric)
- func (c *Context) AsyncCreationTime() *time.Time
- func (c *Context) AsyncElapsed() time.Duration
- func (c *Context) AsyncEndTime() *time.Time
- func (c *Context) AsyncStatus() string
- func (c *Context) Elapsed() time.Duration
- func (c *Context) EndTime() time.Time
- func (c *Context) SetError(err error)
- func (c *Context) SetValue(key string, value interface{})
- func (c *Context) SnapshotForLogging() *Context
- func (c *Context) Value(key string) (interface{}, bool)
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKey = contextKey("context")
View Source
var ErrorKey = errorKey("error")
Functions ¶
func CreateInitialSpan ¶
CreateInitialSpan constructs the first span for the trace.
Types ¶
type Context ¶
type Context struct {
Method string `json:"method,omitempty"`
URI string `json:"uri,omitempty"`
StatusCode int `json:"statusCode,omitempty"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
ElapsedMs int `json:"elapsedMs,omitempty"`
StartTime time.Time `json:"startTime,omitempty"`
Auth *jwt.Claims `json:"auth,omitempty"`
Header map[string]string `json:"header,omitempty"`
Metrics response.Metrics `json:"metrics,omitempty"`
TraceID string `json:"traceId,omitempty"`
Trace *tracing.Trace `json:"-"`
IgnoreEmptyQueryParameters bool `json:"-"`
// contains filtered or unexported fields
}
Context represents an execution context
func GetContext ¶
func NewContext ¶
NewContext creates a new context
func (*Context) AppendMetrics ¶
func (*Context) AsyncCreationTime ¶
func (*Context) AsyncElapsed ¶
func (*Context) AsyncEndTime ¶
func (*Context) AsyncStatus ¶
func (*Context) SnapshotForLogging ¶
SnapshotForLogging creates a concurrency-safe snapshot of the context that can be used for logging and tracing without holding internal locks. It performs a shallow copy of the Context and deep copies of maps/slices that are traversed by JSON marshalling or ToSpans.
Click to show internal directories.
Click to hide internal directories.