aboutsummaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/grpc/trace.go
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2017-11-03 00:20:15 -0700
committerGravatar Miek Gieben <miek@miek.nl> 2017-11-03 07:20:15 +0000
commit1fc0c16968304b169fb7eb52f162ffa4c7cdc55c (patch)
treee242db88ffc7aa291a6344d1ab1d6cd07293cba7 /vendor/google.golang.org/grpc/trace.go
parentaf6086d6535e3309e3bd1e521cb4d51ef113f850 (diff)
downloadcoredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.tar.gz
coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.tar.zst
coredns-1fc0c16968304b169fb7eb52f162ffa4c7cdc55c.zip
Update vendor libraries except client-go, apimachinery and ugorji/go (#1197)
This fix updates vendor libraries except client-go, apimachinery and ugorji/go, as github.com/ugorji/go/codec is causing compatibilities issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'vendor/google.golang.org/grpc/trace.go')
-rw-r--r--vendor/google.golang.org/grpc/trace.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/vendor/google.golang.org/grpc/trace.go b/vendor/google.golang.org/grpc/trace.go
index b419c9e3d..c1c96dedc 100644
--- a/vendor/google.golang.org/grpc/trace.go
+++ b/vendor/google.golang.org/grpc/trace.go
@@ -31,7 +31,7 @@ import (
// EnableTracing controls whether to trace RPCs using the golang.org/x/net/trace package.
// This should only be set before any RPCs are sent or received by this program.
-var EnableTracing = true
+var EnableTracing bool
// methodFamily returns the trace family for the given method.
// It turns "/pkg.Service/GetFoo" into "pkg.Service".
@@ -76,6 +76,15 @@ func (f *firstLine) String() string {
return line.String()
}
+const truncateSize = 100
+
+func truncate(x string, l int) string {
+ if l > len(x) {
+ return x
+ }
+ return x[:l]
+}
+
// payload represents an RPC request or response payload.
type payload struct {
sent bool // whether this is an outgoing payload
@@ -85,9 +94,9 @@ type payload struct {
func (p payload) String() string {
if p.sent {
- return fmt.Sprintf("sent: %v", p.msg)
+ return truncate(fmt.Sprintf("sent: %v", p.msg), truncateSize)
}
- return fmt.Sprintf("recv: %v", p.msg)
+ return truncate(fmt.Sprintf("recv: %v", p.msg), truncateSize)
}
type fmtStringer struct {