Documentation ¶
Overview ¶
The call package helps support tracking latency and other metrics for calls.
Copyright 2022 Outreach Corporation. All Rights Reserved. Description: This file contains the call option definition used by trace.
Index ¶
- type Info
- func (info *Info) AddArgs(ctx context.Context, args ...logf.Marshaler)
- func (info *Info) ApplyOpts(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 Option
- 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) ApplyOpts ¶ added in v1.31.0
ApplyOpts applies call Option functions to the call Info object. even if args are logf.Marshalers, but there might be some call.Options this is done intentionally to preserve compatibility of StartCall API and extend it with new functionality
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 Option ¶ added in v1.31.0
type Option func(c *Info)
Option defines the call Info adjustment function
func (Option) MarshalLog ¶ added in v1.31.0
MarshalLog is defined for being compliant with trace.StartCall contract
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" )