We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 468f615 commit 3ff779bCopy full SHA for 3ff779b
interceptors/reporter.go
@@ -14,6 +14,23 @@ import (
14
15
type GRPCType string
16
17
+// Timer is a helper interface to time functions.
18
+// Useful for interceptors to record the total
19
+// time elapsed since completion of a call.
20
+type Timer interface {
21
+ ObserveDuration() time.Duration
22
+}
23
+
24
+// zeroTimer.
25
+type zeroTimer struct {
26
27
28
+func (zeroTimer) ObserveDuration() time.Duration {
29
+ return 0
30
31
32
+var EmptyTimer = &zeroTimer{}
33
34
const (
35
Unary GRPCType = "unary"
36
ClientStream GRPCType = "client_stream"
0 commit comments