Documentation
¶
Overview ¶
The call package helps support tracking latency and other metrics for calls.
Index ¶
- type Info
- func (info *Info) AddArgs(ctx context.Context, args ...logf.Marshaler)
- func (info *Info) End(ctx context.Context)
- func (info *Info) MarshalLog(addField func(key string, value interface{}))
- func (info *Info) ReportLatency(ctx context.Context)
- func (info *Info) SetStatus(ctx context.Context, err error)
- func (info *Info) Start(ctx context.Context, name string)
- type Tracker
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { Name string Type Type Kind metrics.CallKind Args []logf.Marshaler events.Times events.Durations ErrInfo *events.ErrorInfo }
Info tracks information about an ongoing synchronous call.
func (*Info) MarshalLog ¶
MarshalLog addes log.Marshaler support, logging most of the fields.
func (*Info) ReportLatency ¶
ReportLatency reports the call latency via the metrics package based on the call Kind. If the Kind is not one of HTTP, GRPC or Outbound, it does nothing.
type Tracker ¶
type Tracker struct { }
Tracker helps manage a call info via the context.
func (*Tracker) EndCall ¶
EndCall is meant to be called in a defer abc.EndCall(ctx) pattern. It checks if there is a panic. If so, it uses that to update the current call Info object. It calls info.End(ctx) before returning. It rethrows any panic.
type Type ¶
type Type string
Type tracks the call type.
const ( // TypeHTTP is a constant that denotes the call type being an HTTP // request. TypeHTTP Type = "http" // TypeGRPC is a constant that denotes the call type being a gRPC // request. TypeGRPC Type = "grpc" // TypeOutbound is a constant that denotes the call type being an // outbound request. TypeOutbound Type = "outbound" )