You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// MetricsCollector is used to extract performance metrics for the last invocation in the context
MetricsCollector struct {
sync.Mutex
metrics *InvocationMetrics
}
// InvocationMetrics contains performance information about the last invocation in the context
InvocationMetrics struct {
InvocationRequestTimestamp time.Time
SocketWriteTimestamp time.Time
SocketReadTimestamp time.Time
InvocationResponseTimestamp time.Time
RequestMessageSize int
ResponseMessageSize int
}
)
// ToString returns a human-friendly string representation of elapsed times
func (m *InvocationMetrics) ToString() string {
return fmt.Sprintf("On air time: %v, Total time: %v", m.SocketReadTimestamp.Sub(m.SocketWriteTimestamp), m.InvocationResponseTimestamp.Sub(m.InvocationRequestTimestamp))