]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/google.golang.org/grpc/stats/stats.go
338a3a75b2e278f0e6158c147c6837ef1a56e739
[github/fretlink/terraform-provider-statuscake.git] / vendor / google.golang.org / grpc / stats / stats.go
1 /*
2 *
3 * Copyright 2016 gRPC authors.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 // Package stats is for collecting and reporting various network and RPC stats.
20 // This package is for monitoring purpose only. All fields are read-only.
21 // All APIs are experimental.
22 package stats // import "google.golang.org/grpc/stats"
23
24 import (
25 "net"
26 "time"
27 )
28
29 // RPCStats contains stats information about RPCs.
30 type RPCStats interface {
31 isRPCStats()
32 // IsClient returns true if this RPCStats is from client side.
33 IsClient() bool
34 }
35
36 // Begin contains stats when an RPC begins.
37 // FailFast is only valid if this Begin is from client side.
38 type Begin struct {
39 // Client is true if this Begin is from client side.
40 Client bool
41 // BeginTime is the time when the RPC begins.
42 BeginTime time.Time
43 // FailFast indicates if this RPC is failfast.
44 FailFast bool
45 }
46
47 // IsClient indicates if the stats information is from client side.
48 func (s *Begin) IsClient() bool { return s.Client }
49
50 func (s *Begin) isRPCStats() {}
51
52 // InPayload contains the information for an incoming payload.
53 type InPayload struct {
54 // Client is true if this InPayload is from client side.
55 Client bool
56 // Payload is the payload with original type.
57 Payload interface{}
58 // Data is the serialized message payload.
59 Data []byte
60 // Length is the length of uncompressed data.
61 Length int
62 // WireLength is the length of data on wire (compressed, signed, encrypted).
63 WireLength int
64 // RecvTime is the time when the payload is received.
65 RecvTime time.Time
66 }
67
68 // IsClient indicates if the stats information is from client side.
69 func (s *InPayload) IsClient() bool { return s.Client }
70
71 func (s *InPayload) isRPCStats() {}
72
73 // InHeader contains stats when a header is received.
74 type InHeader struct {
75 // Client is true if this InHeader is from client side.
76 Client bool
77 // WireLength is the wire length of header.
78 WireLength int
79
80 // The following fields are valid only if Client is false.
81 // FullMethod is the full RPC method string, i.e., /package.service/method.
82 FullMethod string
83 // RemoteAddr is the remote address of the corresponding connection.
84 RemoteAddr net.Addr
85 // LocalAddr is the local address of the corresponding connection.
86 LocalAddr net.Addr
87 // Compression is the compression algorithm used for the RPC.
88 Compression string
89 }
90
91 // IsClient indicates if the stats information is from client side.
92 func (s *InHeader) IsClient() bool { return s.Client }
93
94 func (s *InHeader) isRPCStats() {}
95
96 // InTrailer contains stats when a trailer is received.
97 type InTrailer struct {
98 // Client is true if this InTrailer is from client side.
99 Client bool
100 // WireLength is the wire length of trailer.
101 WireLength int
102 }
103
104 // IsClient indicates if the stats information is from client side.
105 func (s *InTrailer) IsClient() bool { return s.Client }
106
107 func (s *InTrailer) isRPCStats() {}
108
109 // OutPayload contains the information for an outgoing payload.
110 type OutPayload struct {
111 // Client is true if this OutPayload is from client side.
112 Client bool
113 // Payload is the payload with original type.
114 Payload interface{}
115 // Data is the serialized message payload.
116 Data []byte
117 // Length is the length of uncompressed data.
118 Length int
119 // WireLength is the length of data on wire (compressed, signed, encrypted).
120 WireLength int
121 // SentTime is the time when the payload is sent.
122 SentTime time.Time
123 }
124
125 // IsClient indicates if this stats information is from client side.
126 func (s *OutPayload) IsClient() bool { return s.Client }
127
128 func (s *OutPayload) isRPCStats() {}
129
130 // OutHeader contains stats when a header is sent.
131 type OutHeader struct {
132 // Client is true if this OutHeader is from client side.
133 Client bool
134 // WireLength is the wire length of header.
135 WireLength int
136
137 // The following fields are valid only if Client is true.
138 // FullMethod is the full RPC method string, i.e., /package.service/method.
139 FullMethod string
140 // RemoteAddr is the remote address of the corresponding connection.
141 RemoteAddr net.Addr
142 // LocalAddr is the local address of the corresponding connection.
143 LocalAddr net.Addr
144 // Compression is the compression algorithm used for the RPC.
145 Compression string
146 }
147
148 // IsClient indicates if this stats information is from client side.
149 func (s *OutHeader) IsClient() bool { return s.Client }
150
151 func (s *OutHeader) isRPCStats() {}
152
153 // OutTrailer contains stats when a trailer is sent.
154 type OutTrailer struct {
155 // Client is true if this OutTrailer is from client side.
156 Client bool
157 // WireLength is the wire length of trailer.
158 WireLength int
159 }
160
161 // IsClient indicates if this stats information is from client side.
162 func (s *OutTrailer) IsClient() bool { return s.Client }
163
164 func (s *OutTrailer) isRPCStats() {}
165
166 // End contains stats when an RPC ends.
167 type End struct {
168 // Client is true if this End is from client side.
169 Client bool
170 // EndTime is the time when the RPC ends.
171 EndTime time.Time
172 // Error is the error the RPC ended with. It is an error generated from
173 // status.Status and can be converted back to status.Status using
174 // status.FromError if non-nil.
175 Error error
176 }
177
178 // IsClient indicates if this is from client side.
179 func (s *End) IsClient() bool { return s.Client }
180
181 func (s *End) isRPCStats() {}
182
183 // ConnStats contains stats information about connections.
184 type ConnStats interface {
185 isConnStats()
186 // IsClient returns true if this ConnStats is from client side.
187 IsClient() bool
188 }
189
190 // ConnBegin contains the stats of a connection when it is established.
191 type ConnBegin struct {
192 // Client is true if this ConnBegin is from client side.
193 Client bool
194 }
195
196 // IsClient indicates if this is from client side.
197 func (s *ConnBegin) IsClient() bool { return s.Client }
198
199 func (s *ConnBegin) isConnStats() {}
200
201 // ConnEnd contains the stats of a connection when it ends.
202 type ConnEnd struct {
203 // Client is true if this ConnEnd is from client side.
204 Client bool
205 }
206
207 // IsClient indicates if this is from client side.
208 func (s *ConnEnd) IsClient() bool { return s.Client }
209
210 func (s *ConnEnd) isConnStats() {}