• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017, OpenCensus Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.opencensus.contrib.grpc.metrics;
18 
19 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_METHOD;
20 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_BYTES_PER_METHOD;
21 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_BYTES_PER_RPC;
22 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_MESSAGES_PER_METHOD;
23 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC;
24 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RETRIES_PER_CALL;
25 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RETRY_DELAY_PER_CALL;
26 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_ROUNDTRIP_LATENCY;
27 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_BYTES_PER_METHOD;
28 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_BYTES_PER_RPC;
29 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_MESSAGES_PER_METHOD;
30 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_MESSAGES_PER_RPC;
31 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SERVER_LATENCY;
32 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_STARTED_RPCS;
33 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_STATUS;
34 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL;
35 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_METHOD;
36 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_BYTES_PER_METHOD;
37 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_BYTES_PER_RPC;
38 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_MESSAGES_PER_METHOD;
39 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC;
40 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_BYTES_PER_METHOD;
41 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_BYTES_PER_RPC;
42 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_MESSAGES_PER_METHOD;
43 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_MESSAGES_PER_RPC;
44 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SERVER_LATENCY;
45 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_STARTED_RPCS;
46 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_STATUS;
47 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT;
48 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT;
49 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES;
50 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT;
51 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES;
52 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT;
53 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY;
54 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_SERVER_ELAPSED_TIME;
55 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT;
56 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES;
57 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES;
58 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_METHOD;
59 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_ERROR_COUNT;
60 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_FINISHED_COUNT;
61 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES;
62 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT;
63 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES;
64 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT;
65 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_SERVER_ELAPSED_TIME;
66 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY;
67 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_STARTED_COUNT;
68 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES;
69 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES;
70 import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_STATUS;
71 
72 import com.google.common.annotations.VisibleForTesting;
73 import io.opencensus.common.Duration;
74 import io.opencensus.stats.Aggregation;
75 import io.opencensus.stats.Aggregation.Count;
76 import io.opencensus.stats.Aggregation.Distribution;
77 import io.opencensus.stats.Aggregation.Sum;
78 import io.opencensus.stats.BucketBoundaries;
79 import io.opencensus.stats.View;
80 import java.util.Arrays;
81 import java.util.Collections;
82 import java.util.List;
83 
84 /**
85  * Constants for exporting views on rpc stats.
86  *
87  * @since 0.8
88  */
89 @SuppressWarnings("deprecation")
90 public final class RpcViewConstants {
91 
92   // Common histogram bucket boundaries for bytes received/sets Views.
93   @VisibleForTesting
94   static final List<Double> RPC_BYTES_BUCKET_BOUNDARIES =
95       Collections.unmodifiableList(
96           Arrays.asList(
97               0.0,
98               1024.0,
99               2048.0,
100               4096.0,
101               16384.0,
102               65536.0,
103               262144.0,
104               1048576.0,
105               4194304.0,
106               16777216.0,
107               67108864.0,
108               268435456.0,
109               1073741824.0,
110               4294967296.0));
111 
112   // Common histogram bucket boundaries for latency and elapsed-time Views.
113   @VisibleForTesting
114   static final List<Double> RPC_MILLIS_BUCKET_BOUNDARIES =
115       Collections.unmodifiableList(
116           Arrays.asList(
117               0.0, 0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 13.0,
118               16.0, 20.0, 25.0, 30.0, 40.0, 50.0, 65.0, 80.0, 100.0, 130.0, 160.0, 200.0, 250.0,
119               300.0, 400.0, 500.0, 650.0, 800.0, 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 50000.0,
120               100000.0));
121 
122   static final List<Double> RPC_MILLIS_BUCKET_BOUNDARIES_DEPRECATED =
123       Collections.unmodifiableList(
124           Arrays.asList(
125               0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 13.0, 16.0, 20.0, 25.0, 30.0, 40.0,
126               50.0, 65.0, 80.0, 100.0, 130.0, 160.0, 200.0, 250.0, 300.0, 400.0, 500.0, 650.0,
127               800.0, 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 50000.0, 100000.0));
128 
129   // Common histogram bucket boundaries for request/response count Views.
130   @VisibleForTesting
131   static final List<Double> RPC_COUNT_BUCKET_BOUNDARIES =
132       Collections.unmodifiableList(
133           Arrays.asList(
134               0.0, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0,
135               4096.0, 8192.0, 16384.0, 32768.0, 65536.0));
136 
137   @VisibleForTesting
138   static final List<Double> RETRY_COUNT_PER_CALL_BUCKET_BOUNDARIES =
139       Collections.unmodifiableList(Arrays.asList(1.0, 2.0, 3.0, 4.0, 5.0));
140 
141   // Use Aggregation.Mean to record sum and count stats at the same time.
142   @VisibleForTesting static final Aggregation MEAN = Aggregation.Mean.create();
143   @VisibleForTesting static final Aggregation COUNT = Count.create();
144   @VisibleForTesting static final Aggregation SUM = Sum.create();
145 
146   @VisibleForTesting
147   static final Aggregation AGGREGATION_WITH_BYTES_HISTOGRAM =
148       Distribution.create(BucketBoundaries.create(RPC_BYTES_BUCKET_BOUNDARIES));
149 
150   @VisibleForTesting
151   static final Aggregation AGGREGATION_WITH_MILLIS_HISTOGRAM =
152       Distribution.create(BucketBoundaries.create(RPC_MILLIS_BUCKET_BOUNDARIES));
153 
154   static final Aggregation AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED =
155       Distribution.create(BucketBoundaries.create(RPC_MILLIS_BUCKET_BOUNDARIES_DEPRECATED));
156 
157   @VisibleForTesting
158   static final Aggregation AGGREGATION_WITH_COUNT_HISTOGRAM =
159       Distribution.create(BucketBoundaries.create(RPC_COUNT_BUCKET_BOUNDARIES));
160 
161   @VisibleForTesting
162   static final Aggregation AGGREGATION_WITH_COUNT_RETRY_HISTOGRAM =
163       Distribution.create(BucketBoundaries.create(RETRY_COUNT_PER_CALL_BUCKET_BOUNDARIES));
164 
165   @VisibleForTesting static final Duration MINUTE = Duration.create(60, 0);
166   @VisibleForTesting static final Duration HOUR = Duration.create(60 * 60, 0);
167 
168   @VisibleForTesting
169   static final View.AggregationWindow CUMULATIVE = View.AggregationWindow.Cumulative.create();
170 
171   @VisibleForTesting
172   static final View.AggregationWindow INTERVAL_MINUTE =
173       View.AggregationWindow.Interval.create(MINUTE);
174 
175   @VisibleForTesting
176   static final View.AggregationWindow INTERVAL_HOUR = View.AggregationWindow.Interval.create(HOUR);
177 
178   // Rpc client cumulative views.
179 
180   /**
181    * Cumulative {@link View} for client RPC errors.
182    *
183    * @since 0.8
184    * @deprecated since error count measure is deprecated.
185    */
186   @Deprecated
187   public static final View RPC_CLIENT_ERROR_COUNT_VIEW =
188       View.create(
189           View.Name.create("grpc.io/client/error_count/cumulative"),
190           "RPC Errors",
191           RPC_CLIENT_ERROR_COUNT,
192           MEAN,
193           Arrays.asList(RPC_STATUS, RPC_METHOD),
194           CUMULATIVE);
195 
196   /**
197    * Cumulative {@link View} for client roundtrip latency in milliseconds.
198    *
199    * @since 0.8
200    * @deprecated in favor of {@link #GRPC_CLIENT_ROUNDTRIP_LATENCY_VIEW}.
201    */
202   @Deprecated
203   public static final View RPC_CLIENT_ROUNDTRIP_LATENCY_VIEW =
204       View.create(
205           View.Name.create("grpc.io/client/roundtrip_latency/cumulative"),
206           "Latency in msecs",
207           RPC_CLIENT_ROUNDTRIP_LATENCY,
208           AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
209           Arrays.asList(RPC_METHOD),
210           CUMULATIVE);
211 
212   /**
213    * Cumulative {@link View} for client server elapsed time in milliseconds.
214    *
215    * @since 0.8
216    * @deprecated in favor of {@link #GRPC_CLIENT_SERVER_LATENCY_VIEW}.
217    */
218   @Deprecated
219   public static final View RPC_CLIENT_SERVER_ELAPSED_TIME_VIEW =
220       View.create(
221           View.Name.create("grpc.io/client/server_elapsed_time/cumulative"),
222           "Server elapsed time in msecs",
223           RPC_CLIENT_SERVER_ELAPSED_TIME,
224           AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
225           Arrays.asList(RPC_METHOD),
226           CUMULATIVE);
227 
228   /**
229    * Cumulative {@link View} for client request bytes.
230    *
231    * @since 0.8
232    * @deprecated in favor of {@link #GRPC_CLIENT_SENT_BYTES_PER_RPC_VIEW}.
233    */
234   @Deprecated
235   public static final View RPC_CLIENT_REQUEST_BYTES_VIEW =
236       View.create(
237           View.Name.create("grpc.io/client/request_bytes/cumulative"),
238           "Request bytes",
239           RPC_CLIENT_REQUEST_BYTES,
240           AGGREGATION_WITH_BYTES_HISTOGRAM,
241           Arrays.asList(RPC_METHOD),
242           CUMULATIVE);
243 
244   /**
245    * Cumulative {@link View} for client response bytes.
246    *
247    * @since 0.8
248    * @deprecated in favor of {@link #GRPC_CLIENT_RECEIVED_BYTES_PER_RPC_VIEW}.
249    */
250   @Deprecated
251   public static final View RPC_CLIENT_RESPONSE_BYTES_VIEW =
252       View.create(
253           View.Name.create("grpc.io/client/response_bytes/cumulative"),
254           "Response bytes",
255           RPC_CLIENT_RESPONSE_BYTES,
256           AGGREGATION_WITH_BYTES_HISTOGRAM,
257           Arrays.asList(RPC_METHOD),
258           CUMULATIVE);
259 
260   /**
261    * Cumulative {@link View} for client uncompressed request bytes.
262    *
263    * @since 0.8
264    * @deprecated in favor of {@link #GRPC_CLIENT_SENT_BYTES_PER_RPC_VIEW}.
265    */
266   @Deprecated
267   public static final View RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES_VIEW =
268       View.create(
269           View.Name.create("grpc.io/client/uncompressed_request_bytes/cumulative"),
270           "Uncompressed Request bytes",
271           RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
272           AGGREGATION_WITH_BYTES_HISTOGRAM,
273           Arrays.asList(RPC_METHOD),
274           CUMULATIVE);
275 
276   /**
277    * Cumulative {@link View} for client uncompressed response bytes.
278    *
279    * @since 0.8
280    * @deprecated in favor of {@link #GRPC_CLIENT_RECEIVED_BYTES_PER_RPC_VIEW}.
281    */
282   @Deprecated
283   public static final View RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES_VIEW =
284       View.create(
285           View.Name.create("grpc.io/client/uncompressed_response_bytes/cumulative"),
286           "Uncompressed Response bytes",
287           RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
288           AGGREGATION_WITH_BYTES_HISTOGRAM,
289           Arrays.asList(RPC_METHOD),
290           CUMULATIVE);
291 
292   /**
293    * Cumulative {@link View} for client request message counts.
294    *
295    * @since 0.8
296    * @deprecated in favor of {@link #GRPC_CLIENT_SENT_MESSAGES_PER_RPC_VIEW}.
297    */
298   @Deprecated
299   public static final View RPC_CLIENT_REQUEST_COUNT_VIEW =
300       View.create(
301           View.Name.create("grpc.io/client/request_count/cumulative"),
302           "Count of request messages per client RPC",
303           RPC_CLIENT_REQUEST_COUNT,
304           AGGREGATION_WITH_COUNT_HISTOGRAM,
305           Arrays.asList(RPC_METHOD),
306           CUMULATIVE);
307 
308   /**
309    * Cumulative {@link View} for client response message counts.
310    *
311    * @since 0.8
312    * @deprecated in favor of {@link #GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC_VIEW}.
313    */
314   @Deprecated
315   public static final View RPC_CLIENT_RESPONSE_COUNT_VIEW =
316       View.create(
317           View.Name.create("grpc.io/client/response_count/cumulative"),
318           "Count of response messages per client RPC",
319           RPC_CLIENT_RESPONSE_COUNT,
320           AGGREGATION_WITH_COUNT_HISTOGRAM,
321           Arrays.asList(RPC_METHOD),
322           CUMULATIVE);
323 
324   /**
325    * Cumulative {@link View} for started client RPCs.
326    *
327    * @since 0.12
328    * @deprecated in favor of {@link #GRPC_CLIENT_STARTED_RPC_VIEW}.
329    */
330   @Deprecated
331   public static final View RPC_CLIENT_STARTED_COUNT_CUMULATIVE_VIEW =
332       View.create(
333           View.Name.create("grpc.io/client/started_count/cumulative"),
334           "Number of started client RPCs",
335           RPC_CLIENT_STARTED_COUNT,
336           COUNT,
337           Arrays.asList(RPC_METHOD),
338           CUMULATIVE);
339 
340   /**
341    * Cumulative {@link View} for finished client RPCs.
342    *
343    * @since 0.12
344    * @deprecated in favor of {@link #GRPC_CLIENT_COMPLETED_RPC_VIEW}.
345    */
346   @Deprecated
347   public static final View RPC_CLIENT_FINISHED_COUNT_CUMULATIVE_VIEW =
348       View.create(
349           View.Name.create("grpc.io/client/finished_count/cumulative"),
350           "Number of finished client RPCs",
351           RPC_CLIENT_FINISHED_COUNT,
352           COUNT,
353           Arrays.asList(RPC_METHOD),
354           CUMULATIVE);
355 
356   /**
357    * {@link View} for client roundtrip latency in milliseconds.
358    *
359    * @since 0.13
360    */
361   public static final View GRPC_CLIENT_ROUNDTRIP_LATENCY_VIEW =
362       View.create(
363           View.Name.create("grpc.io/client/roundtrip_latency"),
364           "Latency in msecs",
365           GRPC_CLIENT_ROUNDTRIP_LATENCY,
366           AGGREGATION_WITH_MILLIS_HISTOGRAM,
367           Arrays.asList(GRPC_CLIENT_METHOD));
368 
369   /**
370    * {@link View} for client server latency in milliseconds.
371    *
372    * @since 0.13
373    */
374   public static final View GRPC_CLIENT_SERVER_LATENCY_VIEW =
375       View.create(
376           View.Name.create("grpc.io/client/server_latency"),
377           "Server latency in msecs",
378           GRPC_CLIENT_SERVER_LATENCY,
379           AGGREGATION_WITH_MILLIS_HISTOGRAM,
380           Arrays.asList(GRPC_CLIENT_METHOD));
381 
382   /**
383    * {@link View} for client sent bytes per RPC.
384    *
385    * @since 0.13
386    */
387   public static final View GRPC_CLIENT_SENT_BYTES_PER_RPC_VIEW =
388       View.create(
389           View.Name.create("grpc.io/client/sent_bytes_per_rpc"),
390           "Sent bytes per RPC",
391           GRPC_CLIENT_SENT_BYTES_PER_RPC,
392           AGGREGATION_WITH_BYTES_HISTOGRAM,
393           Arrays.asList(GRPC_CLIENT_METHOD));
394 
395   /**
396    * {@link View} for client received bytes per RPC.
397    *
398    * @since 0.13
399    */
400   public static final View GRPC_CLIENT_RECEIVED_BYTES_PER_RPC_VIEW =
401       View.create(
402           View.Name.create("grpc.io/client/received_bytes_per_rpc"),
403           "Received bytes per RPC",
404           GRPC_CLIENT_RECEIVED_BYTES_PER_RPC,
405           AGGREGATION_WITH_BYTES_HISTOGRAM,
406           Arrays.asList(GRPC_CLIENT_METHOD));
407 
408   /**
409    * {@link View} for client sent messages per RPC.
410    *
411    * @since 0.13
412    */
413   public static final View GRPC_CLIENT_SENT_MESSAGES_PER_RPC_VIEW =
414       View.create(
415           View.Name.create("grpc.io/client/sent_messages_per_rpc"),
416           "Number of messages sent in the RPC",
417           GRPC_CLIENT_SENT_MESSAGES_PER_RPC,
418           AGGREGATION_WITH_COUNT_HISTOGRAM,
419           Arrays.asList(GRPC_CLIENT_METHOD));
420 
421   /**
422    * {@link View} for client received messages per RPC.
423    *
424    * @since 0.13
425    */
426   public static final View GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC_VIEW =
427       View.create(
428           View.Name.create("grpc.io/client/received_messages_per_rpc"),
429           "Number of response messages received per RPC",
430           GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC,
431           AGGREGATION_WITH_COUNT_HISTOGRAM,
432           Arrays.asList(GRPC_CLIENT_METHOD));
433 
434   /**
435    * {@link View} for client sent bytes per method.
436    *
437    * @since 0.18
438    */
439   public static final View GRPC_CLIENT_SENT_BYTES_PER_METHOD_VIEW =
440       View.create(
441           View.Name.create("grpc.io/client/sent_bytes_per_method"),
442           "Sent bytes per method",
443           GRPC_CLIENT_SENT_BYTES_PER_METHOD,
444           SUM,
445           Arrays.asList(GRPC_CLIENT_METHOD));
446 
447   /**
448    * {@link View} for client received bytes per method.
449    *
450    * @since 0.18
451    */
452   public static final View GRPC_CLIENT_RECEIVED_BYTES_PER_METHOD_VIEW =
453       View.create(
454           View.Name.create("grpc.io/client/received_bytes_per_method"),
455           "Received bytes per method",
456           GRPC_CLIENT_RECEIVED_BYTES_PER_METHOD,
457           SUM,
458           Arrays.asList(GRPC_CLIENT_METHOD));
459 
460   /**
461    * {@link View} for client sent messages.
462    *
463    * @since 0.18
464    */
465   public static final View GRPC_CLIENT_SENT_MESSAGES_PER_METHOD_VIEW =
466       View.create(
467           View.Name.create("grpc.io/client/sent_messages_per_method"),
468           "Number of messages sent",
469           GRPC_CLIENT_SENT_MESSAGES_PER_METHOD,
470           COUNT,
471           Arrays.asList(GRPC_CLIENT_METHOD));
472 
473   /**
474    * {@link View} for client received messages.
475    *
476    * @since 0.18
477    */
478   public static final View GRPC_CLIENT_RECEIVED_MESSAGES_PER_METHOD_VIEW =
479       View.create(
480           View.Name.create("grpc.io/client/received_messages_per_method"),
481           "Number of messages received",
482           GRPC_CLIENT_RECEIVED_MESSAGES_PER_METHOD,
483           COUNT,
484           Arrays.asList(GRPC_CLIENT_METHOD));
485 
486   /**
487    * {@link View} for completed client RPCs.
488    *
489    * <p>This {@code View} uses measure {@code GRPC_CLIENT_ROUNDTRIP_LATENCY}, since completed RPCs
490    * can be inferred over any measure recorded once per RPC (since it's just a count aggregation
491    * over the measure). It would be unnecessary to use a separate "count" measure.
492    *
493    * @since 0.13
494    */
495   public static final View GRPC_CLIENT_COMPLETED_RPC_VIEW =
496       View.create(
497           View.Name.create("grpc.io/client/completed_rpcs"),
498           "Number of completed client RPCs",
499           GRPC_CLIENT_ROUNDTRIP_LATENCY,
500           COUNT,
501           Arrays.asList(GRPC_CLIENT_METHOD, GRPC_CLIENT_STATUS));
502 
503   /**
504    * {@link View} for started client RPCs.
505    *
506    * @since 0.14
507    */
508   public static final View GRPC_CLIENT_STARTED_RPC_VIEW =
509       View.create(
510           View.Name.create("grpc.io/client/started_rpcs"),
511           "Number of started client RPCs",
512           GRPC_CLIENT_STARTED_RPCS,
513           COUNT,
514           Arrays.asList(GRPC_CLIENT_METHOD));
515 
516   /**
517    * {@link View} for client retries per call.
518    *
519    * @since 0.28
520    */
521   public static final View GRPC_CLIENT_RETRIES_PER_CALL_VIEW =
522       View.create(
523           View.Name.create("grpc.io/client/retries_per_call"),
524           "Number of client retries per call",
525           GRPC_CLIENT_RETRIES_PER_CALL,
526           AGGREGATION_WITH_COUNT_RETRY_HISTOGRAM,
527           Arrays.asList(GRPC_CLIENT_METHOD));
528 
529   /**
530    * {@link View} for total transparent client retries across calls.
531    *
532    * @since 0.28
533    */
534   public static final View GRPC_CLIENT_TRANSPARENT_RETRIES_VIEW =
535       View.create(
536           View.Name.create("grpc.io/client/transparent_retries"),
537           "Total number of transparent client retries across calls",
538           GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL,
539           SUM,
540           Arrays.asList(GRPC_CLIENT_METHOD));
541 
542   /**
543    * {@link View} for total time of delay while there is no active attempt during the client call.
544    *
545    * @since 0.28
546    */
547   public static final View GRPC_CLIENT_RETRY_DELAY_PER_CALL_VIEW =
548       View.create(
549           View.Name.create("grpc.io/client/retry_delay_per_call"),
550           "Total time of delay while there is no active attempt during the client call",
551           GRPC_CLIENT_RETRY_DELAY_PER_CALL,
552           AGGREGATION_WITH_MILLIS_HISTOGRAM,
553           Arrays.asList(GRPC_CLIENT_METHOD));
554 
555   /**
556    * {@link View} for total retries across all calls, excluding transparent retries.
557    *
558    * @since 0.28
559    */
560   public static final View GRPC_CLIENT_RETRIES_VIEW =
561       View.create(
562           View.Name.create("grpc.io/client/retries"),
563           "Total number of client retries across all calls",
564           GRPC_CLIENT_RETRIES_PER_CALL,
565           SUM,
566           Arrays.asList(GRPC_CLIENT_METHOD));
567 
568   /**
569    * {@link View} for transparent retries per call.
570    *
571    * @since 0.28
572    */
573   public static final View GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL_VIEW =
574       View.create(
575           View.Name.create("grpc.io/client/transparent_retries_per_call"),
576           "Number of transparent client retries per call",
577           GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL,
578           AGGREGATION_WITH_COUNT_RETRY_HISTOGRAM,
579           Arrays.asList(GRPC_CLIENT_METHOD));
580 
581   // Rpc server cumulative views.
582 
583   /**
584    * Cumulative {@link View} for server RPC errors.
585    *
586    * @since 0.8
587    * @deprecated since error count measure is deprecated.
588    */
589   @Deprecated
590   public static final View RPC_SERVER_ERROR_COUNT_VIEW =
591       View.create(
592           View.Name.create("grpc.io/server/error_count/cumulative"),
593           "RPC Errors",
594           RPC_SERVER_ERROR_COUNT,
595           MEAN,
596           Arrays.asList(RPC_STATUS, RPC_METHOD),
597           CUMULATIVE);
598 
599   /**
600    * Cumulative {@link View} for server latency in milliseconds.
601    *
602    * @since 0.8
603    * @deprecated in favor of {@link #GRPC_SERVER_SERVER_LATENCY_VIEW}.
604    */
605   @Deprecated
606   public static final View RPC_SERVER_SERVER_LATENCY_VIEW =
607       View.create(
608           View.Name.create("grpc.io/server/server_latency/cumulative"),
609           "Latency in msecs",
610           RPC_SERVER_SERVER_LATENCY,
611           AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
612           Arrays.asList(RPC_METHOD),
613           CUMULATIVE);
614 
615   /**
616    * Cumulative {@link View} for server elapsed time in milliseconds.
617    *
618    * @since 0.8
619    * @deprecated in favor of {@link #GRPC_SERVER_SERVER_LATENCY_VIEW}.
620    */
621   @Deprecated
622   public static final View RPC_SERVER_SERVER_ELAPSED_TIME_VIEW =
623       View.create(
624           View.Name.create("grpc.io/server/elapsed_time/cumulative"),
625           "Server elapsed time in msecs",
626           RPC_SERVER_SERVER_ELAPSED_TIME,
627           AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
628           Arrays.asList(RPC_METHOD),
629           CUMULATIVE);
630 
631   /**
632    * Cumulative {@link View} for server request bytes.
633    *
634    * @since 0.8
635    * @deprecated in favor of {@link #GRPC_SERVER_RECEIVED_BYTES_PER_RPC_VIEW}.
636    */
637   @Deprecated
638   public static final View RPC_SERVER_REQUEST_BYTES_VIEW =
639       View.create(
640           View.Name.create("grpc.io/server/request_bytes/cumulative"),
641           "Request bytes",
642           RPC_SERVER_REQUEST_BYTES,
643           AGGREGATION_WITH_BYTES_HISTOGRAM,
644           Arrays.asList(RPC_METHOD),
645           CUMULATIVE);
646 
647   /**
648    * Cumulative {@link View} for server response bytes.
649    *
650    * @since 0.8
651    * @deprecated in favor of {@link #GRPC_SERVER_SENT_BYTES_PER_RPC_VIEW}.
652    */
653   @Deprecated
654   public static final View RPC_SERVER_RESPONSE_BYTES_VIEW =
655       View.create(
656           View.Name.create("grpc.io/server/response_bytes/cumulative"),
657           "Response bytes",
658           RPC_SERVER_RESPONSE_BYTES,
659           AGGREGATION_WITH_BYTES_HISTOGRAM,
660           Arrays.asList(RPC_METHOD),
661           CUMULATIVE);
662 
663   /**
664    * Cumulative {@link View} for server uncompressed request bytes.
665    *
666    * @since 0.8
667    * @deprecated in favor of {@link #GRPC_SERVER_RECEIVED_BYTES_PER_RPC_VIEW}.
668    */
669   @Deprecated
670   public static final View RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES_VIEW =
671       View.create(
672           View.Name.create("grpc.io/server/uncompressed_request_bytes/cumulative"),
673           "Uncompressed Request bytes",
674           RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES,
675           AGGREGATION_WITH_BYTES_HISTOGRAM,
676           Arrays.asList(RPC_METHOD),
677           CUMULATIVE);
678 
679   /**
680    * Cumulative {@link View} for server uncompressed response bytes.
681    *
682    * @since 0.8
683    * @deprecated in favor of {@link #GRPC_SERVER_SENT_BYTES_PER_RPC_VIEW}.
684    */
685   @Deprecated
686   public static final View RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES_VIEW =
687       View.create(
688           View.Name.create("grpc.io/server/uncompressed_response_bytes/cumulative"),
689           "Uncompressed Response bytes",
690           RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES,
691           AGGREGATION_WITH_BYTES_HISTOGRAM,
692           Arrays.asList(RPC_METHOD),
693           CUMULATIVE);
694 
695   /**
696    * Cumulative {@link View} for server request message counts.
697    *
698    * @since 0.8
699    * @deprecated in favor of {@link #GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC_VIEW}.
700    */
701   @Deprecated
702   public static final View RPC_SERVER_REQUEST_COUNT_VIEW =
703       View.create(
704           View.Name.create("grpc.io/server/request_count/cumulative"),
705           "Count of request messages per server RPC",
706           RPC_SERVER_REQUEST_COUNT,
707           AGGREGATION_WITH_COUNT_HISTOGRAM,
708           Arrays.asList(RPC_METHOD),
709           CUMULATIVE);
710 
711   /**
712    * Cumulative {@link View} for server response message counts.
713    *
714    * @since 0.8
715    * @deprecated in favor of {@link #GRPC_SERVER_SENT_MESSAGES_PER_RPC_VIEW}.
716    */
717   @Deprecated
718   public static final View RPC_SERVER_RESPONSE_COUNT_VIEW =
719       View.create(
720           View.Name.create("grpc.io/server/response_count/cumulative"),
721           "Count of response messages per server RPC",
722           RPC_SERVER_RESPONSE_COUNT,
723           AGGREGATION_WITH_COUNT_HISTOGRAM,
724           Arrays.asList(RPC_METHOD),
725           CUMULATIVE);
726 
727   /**
728    * Cumulative {@link View} for started server RPCs.
729    *
730    * @since 0.12
731    * @deprecated in favor of {@link #GRPC_SERVER_STARTED_RPC_VIEW}.
732    */
733   @Deprecated
734   public static final View RPC_SERVER_STARTED_COUNT_CUMULATIVE_VIEW =
735       View.create(
736           View.Name.create("grpc.io/server/started_count/cumulative"),
737           "Number of started server RPCs",
738           RPC_SERVER_STARTED_COUNT,
739           COUNT,
740           Arrays.asList(RPC_METHOD),
741           CUMULATIVE);
742 
743   /**
744    * Cumulative {@link View} for finished server RPCs.
745    *
746    * @since 0.12
747    * @deprecated in favor of {@link #GRPC_SERVER_COMPLETED_RPC_VIEW}.
748    */
749   @Deprecated
750   public static final View RPC_SERVER_FINISHED_COUNT_CUMULATIVE_VIEW =
751       View.create(
752           View.Name.create("grpc.io/server/finished_count/cumulative"),
753           "Number of finished server RPCs",
754           RPC_SERVER_FINISHED_COUNT,
755           COUNT,
756           Arrays.asList(RPC_METHOD),
757           CUMULATIVE);
758 
759   /**
760    * {@link View} for server server latency in milliseconds.
761    *
762    * @since 0.13
763    */
764   public static final View GRPC_SERVER_SERVER_LATENCY_VIEW =
765       View.create(
766           View.Name.create("grpc.io/server/server_latency"),
767           "Server latency in msecs",
768           GRPC_SERVER_SERVER_LATENCY,
769           AGGREGATION_WITH_MILLIS_HISTOGRAM,
770           Arrays.asList(GRPC_SERVER_METHOD));
771 
772   /**
773    * {@link View} for server sent bytes per RPC.
774    *
775    * @since 0.13
776    */
777   public static final View GRPC_SERVER_SENT_BYTES_PER_RPC_VIEW =
778       View.create(
779           View.Name.create("grpc.io/server/sent_bytes_per_rpc"),
780           "Sent bytes per RPC",
781           GRPC_SERVER_SENT_BYTES_PER_RPC,
782           AGGREGATION_WITH_BYTES_HISTOGRAM,
783           Arrays.asList(GRPC_SERVER_METHOD));
784 
785   /**
786    * {@link View} for server received bytes per RPC.
787    *
788    * @since 0.13
789    */
790   public static final View GRPC_SERVER_RECEIVED_BYTES_PER_RPC_VIEW =
791       View.create(
792           View.Name.create("grpc.io/server/received_bytes_per_rpc"),
793           "Received bytes per RPC",
794           GRPC_SERVER_RECEIVED_BYTES_PER_RPC,
795           AGGREGATION_WITH_BYTES_HISTOGRAM,
796           Arrays.asList(GRPC_SERVER_METHOD));
797 
798   /**
799    * {@link View} for server sent messages per RPC.
800    *
801    * @since 0.13
802    */
803   public static final View GRPC_SERVER_SENT_MESSAGES_PER_RPC_VIEW =
804       View.create(
805           View.Name.create("grpc.io/server/sent_messages_per_rpc"),
806           "Number of messages sent in each RPC",
807           GRPC_SERVER_SENT_MESSAGES_PER_RPC,
808           AGGREGATION_WITH_COUNT_HISTOGRAM,
809           Arrays.asList(GRPC_SERVER_METHOD));
810 
811   /**
812    * {@link View} for server received messages per RPC.
813    *
814    * @since 0.13
815    */
816   public static final View GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC_VIEW =
817       View.create(
818           View.Name.create("grpc.io/server/received_messages_per_rpc"),
819           "Number of response messages received in each RPC",
820           GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC,
821           AGGREGATION_WITH_COUNT_HISTOGRAM,
822           Arrays.asList(GRPC_SERVER_METHOD));
823 
824   /**
825    * {@link View} for total server sent bytes per method.
826    *
827    * @since 0.18
828    */
829   public static final View GRPC_SERVER_SENT_BYTES_PER_METHOD_VIEW =
830       View.create(
831           View.Name.create("grpc.io/server/sent_bytes_per_method"),
832           "Sent bytes per method",
833           GRPC_SERVER_SENT_BYTES_PER_METHOD,
834           SUM,
835           Arrays.asList(GRPC_SERVER_METHOD));
836 
837   /**
838    * {@link View} for total server received bytes per method.
839    *
840    * @since 0.18
841    */
842   public static final View GRPC_SERVER_RECEIVED_BYTES_PER_METHOD_VIEW =
843       View.create(
844           View.Name.create("grpc.io/server/received_bytes_per_method"),
845           "Received bytes per method",
846           GRPC_SERVER_RECEIVED_BYTES_PER_METHOD,
847           SUM,
848           Arrays.asList(GRPC_SERVER_METHOD));
849 
850   /**
851    * {@link View} for server sent messages.
852    *
853    * @since 0.18
854    */
855   public static final View GRPC_SERVER_SENT_MESSAGES_PER_METHOD_VIEW =
856       View.create(
857           View.Name.create("grpc.io/server/sent_messages_per_method"),
858           "Number of messages sent",
859           GRPC_SERVER_SENT_MESSAGES_PER_METHOD,
860           COUNT,
861           Arrays.asList(GRPC_SERVER_METHOD));
862 
863   /**
864    * {@link View} for server received messages.
865    *
866    * @since 0.18
867    */
868   public static final View GRPC_SERVER_RECEIVED_MESSAGES_PER_METHOD_VIEW =
869       View.create(
870           View.Name.create("grpc.io/server/received_messages_per_method"),
871           "Number of messages received",
872           GRPC_SERVER_RECEIVED_MESSAGES_PER_METHOD,
873           COUNT,
874           Arrays.asList(GRPC_SERVER_METHOD));
875 
876   /**
877    * {@link View} for completed server RPCs.
878    *
879    * <p>This {@code View} uses measure {@code GRPC_SERVER_SERVER_LATENCY}, since completed RPCs can
880    * be inferred over any measure recorded once per RPC (since it's just a count aggregation over
881    * the measure). It would be unnecessary to use a separate "count" measure.
882    *
883    * @since 0.13
884    */
885   public static final View GRPC_SERVER_COMPLETED_RPC_VIEW =
886       View.create(
887           View.Name.create("grpc.io/server/completed_rpcs"),
888           "Number of completed server RPCs",
889           GRPC_SERVER_SERVER_LATENCY,
890           COUNT,
891           Arrays.asList(GRPC_SERVER_METHOD, GRPC_SERVER_STATUS));
892 
893   /**
894    * {@link View} for started server RPCs.
895    *
896    * @since 0.14
897    */
898   public static final View GRPC_SERVER_STARTED_RPC_VIEW =
899       View.create(
900           View.Name.create("grpc.io/server/started_rpcs"),
901           "Number of started server RPCs",
902           GRPC_SERVER_STARTED_RPCS,
903           COUNT,
904           Arrays.asList(GRPC_SERVER_METHOD));
905 
906   // Interval Stats
907 
908   // RPC client interval views.
909 
910   /**
911    * Minute {@link View} for client roundtrip latency in milliseconds.
912    *
913    * @since 0.8
914    */
915   public static final View RPC_CLIENT_ROUNDTRIP_LATENCY_MINUTE_VIEW =
916       View.create(
917           View.Name.create("grpc.io/client/roundtrip_latency/minute"),
918           "Minute stats for latency in msecs",
919           RPC_CLIENT_ROUNDTRIP_LATENCY,
920           MEAN,
921           Arrays.asList(RPC_METHOD),
922           INTERVAL_MINUTE);
923 
924   /**
925    * Minute {@link View} for client request bytes.
926    *
927    * @since 0.8
928    */
929   public static final View RPC_CLIENT_REQUEST_BYTES_MINUTE_VIEW =
930       View.create(
931           View.Name.create("grpc.io/client/request_bytes/minute"),
932           "Minute stats for request size in bytes",
933           RPC_CLIENT_REQUEST_BYTES,
934           MEAN,
935           Arrays.asList(RPC_METHOD),
936           INTERVAL_MINUTE);
937 
938   /**
939    * Minute {@link View} for client response bytes.
940    *
941    * @since 0.8
942    */
943   public static final View RPC_CLIENT_RESPONSE_BYTES_MINUTE_VIEW =
944       View.create(
945           View.Name.create("grpc.io/client/response_bytes/minute"),
946           "Minute stats for response size in bytes",
947           RPC_CLIENT_RESPONSE_BYTES,
948           MEAN,
949           Arrays.asList(RPC_METHOD),
950           INTERVAL_MINUTE);
951 
952   /**
953    * Minute {@link View} for client RPC errors.
954    *
955    * @since 0.8
956    */
957   public static final View RPC_CLIENT_ERROR_COUNT_MINUTE_VIEW =
958       View.create(
959           View.Name.create("grpc.io/client/error_count/minute"),
960           "Minute stats for rpc errors",
961           RPC_CLIENT_ERROR_COUNT,
962           MEAN,
963           Arrays.asList(RPC_METHOD),
964           INTERVAL_MINUTE);
965 
966   /**
967    * Minute {@link View} for client uncompressed request bytes.
968    *
969    * @since 0.8
970    */
971   public static final View RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES_MINUTE_VIEW =
972       View.create(
973           View.Name.create("grpc.io/client/uncompressed_request_bytes/minute"),
974           "Minute stats for uncompressed request size in bytes",
975           RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
976           MEAN,
977           Arrays.asList(RPC_METHOD),
978           INTERVAL_MINUTE);
979 
980   /**
981    * Minute {@link View} for client uncompressed response bytes.
982    *
983    * @since 0.8
984    */
985   public static final View RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES_MINUTE_VIEW =
986       View.create(
987           View.Name.create("grpc.io/client/uncompressed_response_bytes/minute"),
988           "Minute stats for uncompressed response size in bytes",
989           RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
990           MEAN,
991           Arrays.asList(RPC_METHOD),
992           INTERVAL_MINUTE);
993 
994   /**
995    * Minute {@link View} for client server elapsed time in milliseconds.
996    *
997    * @since 0.8
998    */
999   public static final View RPC_CLIENT_SERVER_ELAPSED_TIME_MINUTE_VIEW =
1000       View.create(
1001           View.Name.create("grpc.io/client/server_elapsed_time/minute"),
1002           "Minute stats for server elapsed time in msecs",
1003           RPC_CLIENT_SERVER_ELAPSED_TIME,
1004           MEAN,
1005           Arrays.asList(RPC_METHOD),
1006           INTERVAL_MINUTE);
1007 
1008   /**
1009    * Minute {@link View} for started client RPCs.
1010    *
1011    * @since 0.8
1012    */
1013   public static final View RPC_CLIENT_STARTED_COUNT_MINUTE_VIEW =
1014       View.create(
1015           View.Name.create("grpc.io/client/started_count/minute"),
1016           "Minute stats on the number of client RPCs started",
1017           RPC_CLIENT_STARTED_COUNT,
1018           COUNT,
1019           Arrays.asList(RPC_METHOD),
1020           INTERVAL_MINUTE);
1021 
1022   /**
1023    * Minute {@link View} for finished client RPCs.
1024    *
1025    * @since 0.8
1026    */
1027   public static final View RPC_CLIENT_FINISHED_COUNT_MINUTE_VIEW =
1028       View.create(
1029           View.Name.create("grpc.io/client/finished_count/minute"),
1030           "Minute stats on the number of client RPCs finished",
1031           RPC_CLIENT_FINISHED_COUNT,
1032           COUNT,
1033           Arrays.asList(RPC_METHOD),
1034           INTERVAL_MINUTE);
1035 
1036   /**
1037    * Minute {@link View} for client request messages.
1038    *
1039    * @since 0.8
1040    */
1041   public static final View RPC_CLIENT_REQUEST_COUNT_MINUTE_VIEW =
1042       View.create(
1043           View.Name.create("grpc.io/client/request_count/minute"),
1044           "Minute stats on the count of request messages per client RPC",
1045           RPC_CLIENT_REQUEST_COUNT,
1046           MEAN,
1047           Arrays.asList(RPC_METHOD),
1048           INTERVAL_MINUTE);
1049 
1050   /**
1051    * Minute {@link View} for client response messages.
1052    *
1053    * @since 0.8
1054    */
1055   public static final View RPC_CLIENT_RESPONSE_COUNT_MINUTE_VIEW =
1056       View.create(
1057           View.Name.create("grpc.io/client/response_count/minute"),
1058           "Minute stats on the count of response messages per client RPC",
1059           RPC_CLIENT_RESPONSE_COUNT,
1060           MEAN,
1061           Arrays.asList(RPC_METHOD),
1062           INTERVAL_MINUTE);
1063 
1064   /**
1065    * Hour {@link View} for client roundtrip latency in milliseconds.
1066    *
1067    * @since 0.8
1068    */
1069   public static final View RPC_CLIENT_ROUNDTRIP_LATENCY_HOUR_VIEW =
1070       View.create(
1071           View.Name.create("grpc.io/client/roundtrip_latency/hour"),
1072           "Hour stats for latency in msecs",
1073           RPC_CLIENT_ROUNDTRIP_LATENCY,
1074           MEAN,
1075           Arrays.asList(RPC_METHOD),
1076           INTERVAL_HOUR);
1077 
1078   /**
1079    * Hour {@link View} for client request bytes.
1080    *
1081    * @since 0.8
1082    */
1083   public static final View RPC_CLIENT_REQUEST_BYTES_HOUR_VIEW =
1084       View.create(
1085           View.Name.create("grpc.io/client/request_bytes/hour"),
1086           "Hour stats for request size in bytes",
1087           RPC_CLIENT_REQUEST_BYTES,
1088           MEAN,
1089           Arrays.asList(RPC_METHOD),
1090           INTERVAL_HOUR);
1091 
1092   /**
1093    * Hour {@link View} for client response bytes.
1094    *
1095    * @since 0.8
1096    */
1097   public static final View RPC_CLIENT_RESPONSE_BYTES_HOUR_VIEW =
1098       View.create(
1099           View.Name.create("grpc.io/client/response_bytes/hour"),
1100           "Hour stats for response size in bytes",
1101           RPC_CLIENT_RESPONSE_BYTES,
1102           MEAN,
1103           Arrays.asList(RPC_METHOD),
1104           INTERVAL_HOUR);
1105 
1106   /**
1107    * Hour {@link View} for client RPC errors.
1108    *
1109    * @since 0.8
1110    */
1111   public static final View RPC_CLIENT_ERROR_COUNT_HOUR_VIEW =
1112       View.create(
1113           View.Name.create("grpc.io/client/error_count/hour"),
1114           "Hour stats for rpc errors",
1115           RPC_CLIENT_ERROR_COUNT,
1116           MEAN,
1117           Arrays.asList(RPC_METHOD),
1118           INTERVAL_HOUR);
1119 
1120   /**
1121    * Hour {@link View} for client uncompressed request bytes.
1122    *
1123    * @since 0.8
1124    */
1125   public static final View RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES_HOUR_VIEW =
1126       View.create(
1127           View.Name.create("grpc.io/client/uncompressed_request_bytes/hour"),
1128           "Hour stats for uncompressed request size in bytes",
1129           RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
1130           MEAN,
1131           Arrays.asList(RPC_METHOD),
1132           INTERVAL_HOUR);
1133 
1134   /**
1135    * Hour {@link View} for client uncompressed response bytes.
1136    *
1137    * @since 0.8
1138    */
1139   public static final View RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES_HOUR_VIEW =
1140       View.create(
1141           View.Name.create("grpc.io/client/uncompressed_response_bytes/hour"),
1142           "Hour stats for uncompressed response size in bytes",
1143           RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
1144           MEAN,
1145           Arrays.asList(RPC_METHOD),
1146           INTERVAL_HOUR);
1147 
1148   /**
1149    * Hour {@link View} for client server elapsed time in milliseconds.
1150    *
1151    * @since 0.8
1152    */
1153   public static final View RPC_CLIENT_SERVER_ELAPSED_TIME_HOUR_VIEW =
1154       View.create(
1155           View.Name.create("grpc.io/client/server_elapsed_time/hour"),
1156           "Hour stats for server elapsed time in msecs",
1157           RPC_CLIENT_SERVER_ELAPSED_TIME,
1158           MEAN,
1159           Arrays.asList(RPC_METHOD),
1160           INTERVAL_HOUR);
1161 
1162   /**
1163    * Hour {@link View} for started client RPCs.
1164    *
1165    * @since 0.8
1166    */
1167   public static final View RPC_CLIENT_STARTED_COUNT_HOUR_VIEW =
1168       View.create(
1169           View.Name.create("grpc.io/client/started_count/hour"),
1170           "Hour stats on the number of client RPCs started",
1171           RPC_CLIENT_STARTED_COUNT,
1172           COUNT,
1173           Arrays.asList(RPC_METHOD),
1174           INTERVAL_HOUR);
1175 
1176   /**
1177    * Hour {@link View} for finished client RPCs.
1178    *
1179    * @since 0.8
1180    */
1181   public static final View RPC_CLIENT_FINISHED_COUNT_HOUR_VIEW =
1182       View.create(
1183           View.Name.create("grpc.io/client/finished_count/hour"),
1184           "Hour stats on the number of client RPCs finished",
1185           RPC_CLIENT_FINISHED_COUNT,
1186           COUNT,
1187           Arrays.asList(RPC_METHOD),
1188           INTERVAL_HOUR);
1189 
1190   /**
1191    * Hour {@link View} for client request messages.
1192    *
1193    * @since 0.8
1194    */
1195   public static final View RPC_CLIENT_REQUEST_COUNT_HOUR_VIEW =
1196       View.create(
1197           View.Name.create("grpc.io/client/request_count/hour"),
1198           "Hour stats on the count of request messages per client RPC",
1199           RPC_CLIENT_REQUEST_COUNT,
1200           MEAN,
1201           Arrays.asList(RPC_METHOD),
1202           INTERVAL_HOUR);
1203 
1204   /**
1205    * Hour {@link View} for client response messages.
1206    *
1207    * @since 0.8
1208    */
1209   public static final View RPC_CLIENT_RESPONSE_COUNT_HOUR_VIEW =
1210       View.create(
1211           View.Name.create("grpc.io/client/response_count/hour"),
1212           "Hour stats on the count of response messages per client RPC",
1213           RPC_CLIENT_RESPONSE_COUNT,
1214           MEAN,
1215           Arrays.asList(RPC_METHOD),
1216           INTERVAL_HOUR);
1217 
1218   // RPC server interval views.
1219 
1220   /**
1221    * Minute {@link View} for server latency in milliseconds.
1222    *
1223    * @since 0.8
1224    */
1225   public static final View RPC_SERVER_SERVER_LATENCY_MINUTE_VIEW =
1226       View.create(
1227           View.Name.create("grpc.io/server/server_latency/minute"),
1228           "Minute stats for server latency in msecs",
1229           RPC_SERVER_SERVER_LATENCY,
1230           MEAN,
1231           Arrays.asList(RPC_METHOD),
1232           INTERVAL_MINUTE);
1233 
1234   /**
1235    * Minute {@link View} for server request bytes.
1236    *
1237    * @since 0.8
1238    */
1239   public static final View RPC_SERVER_REQUEST_BYTES_MINUTE_VIEW =
1240       View.create(
1241           View.Name.create("grpc.io/server/request_bytes/minute"),
1242           "Minute stats for request size in bytes",
1243           RPC_SERVER_REQUEST_BYTES,
1244           MEAN,
1245           Arrays.asList(RPC_METHOD),
1246           INTERVAL_MINUTE);
1247 
1248   /**
1249    * Minute {@link View} for server response bytes.
1250    *
1251    * @since 0.8
1252    */
1253   public static final View RPC_SERVER_RESPONSE_BYTES_MINUTE_VIEW =
1254       View.create(
1255           View.Name.create("grpc.io/server/response_bytes/minute"),
1256           "Minute stats for response size in bytes",
1257           RPC_SERVER_RESPONSE_BYTES,
1258           MEAN,
1259           Arrays.asList(RPC_METHOD),
1260           INTERVAL_MINUTE);
1261 
1262   /**
1263    * Minute {@link View} for server RPC errors.
1264    *
1265    * @since 0.8
1266    */
1267   public static final View RPC_SERVER_ERROR_COUNT_MINUTE_VIEW =
1268       View.create(
1269           View.Name.create("grpc.io/server/error_count/minute"),
1270           "Minute stats for rpc errors",
1271           RPC_SERVER_ERROR_COUNT,
1272           MEAN,
1273           Arrays.asList(RPC_METHOD),
1274           INTERVAL_MINUTE);
1275 
1276   /**
1277    * Minute {@link View} for server uncompressed request bytes.
1278    *
1279    * @since 0.8
1280    */
1281   public static final View RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES_MINUTE_VIEW =
1282       View.create(
1283           View.Name.create("grpc.io/server/uncompressed_request_bytes/minute"),
1284           "Minute stats for uncompressed request size in bytes",
1285           RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES,
1286           MEAN,
1287           Arrays.asList(RPC_METHOD),
1288           INTERVAL_MINUTE);
1289 
1290   /**
1291    * Minute {@link View} for server uncompressed response bytes.
1292    *
1293    * @since 0.8
1294    */
1295   public static final View RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES_MINUTE_VIEW =
1296       View.create(
1297           View.Name.create("grpc.io/server/uncompressed_response_bytes/minute"),
1298           "Minute stats for uncompressed response size in bytes",
1299           RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES,
1300           MEAN,
1301           Arrays.asList(RPC_METHOD),
1302           INTERVAL_MINUTE);
1303 
1304   /**
1305    * Minute {@link View} for server elapsed time in milliseconds.
1306    *
1307    * @since 0.8
1308    */
1309   public static final View RPC_SERVER_SERVER_ELAPSED_TIME_MINUTE_VIEW =
1310       View.create(
1311           View.Name.create("grpc.io/server/server_elapsed_time/minute"),
1312           "Minute stats for server elapsed time in msecs",
1313           RPC_SERVER_SERVER_ELAPSED_TIME,
1314           MEAN,
1315           Arrays.asList(RPC_METHOD),
1316           INTERVAL_MINUTE);
1317 
1318   /**
1319    * Minute {@link View} for started server RPCs.
1320    *
1321    * @since 0.8
1322    */
1323   public static final View RPC_SERVER_STARTED_COUNT_MINUTE_VIEW =
1324       View.create(
1325           View.Name.create("grpc.io/server/started_count/minute"),
1326           "Minute stats on the number of server RPCs started",
1327           RPC_SERVER_STARTED_COUNT,
1328           COUNT,
1329           Arrays.asList(RPC_METHOD),
1330           INTERVAL_MINUTE);
1331 
1332   /**
1333    * Minute {@link View} for finished server RPCs.
1334    *
1335    * @since 0.8
1336    */
1337   public static final View RPC_SERVER_FINISHED_COUNT_MINUTE_VIEW =
1338       View.create(
1339           View.Name.create("grpc.io/server/finished_count/minute"),
1340           "Minute stats on the number of server RPCs finished",
1341           RPC_SERVER_FINISHED_COUNT,
1342           COUNT,
1343           Arrays.asList(RPC_METHOD),
1344           INTERVAL_MINUTE);
1345 
1346   /**
1347    * Minute {@link View} for server request messages.
1348    *
1349    * @since 0.8
1350    */
1351   public static final View RPC_SERVER_REQUEST_COUNT_MINUTE_VIEW =
1352       View.create(
1353           View.Name.create("grpc.io/server/request_count/minute"),
1354           "Minute stats on the count of request messages per server RPC",
1355           RPC_SERVER_REQUEST_COUNT,
1356           MEAN,
1357           Arrays.asList(RPC_METHOD),
1358           INTERVAL_MINUTE);
1359 
1360   /**
1361    * Minute {@link View} for server response messages.
1362    *
1363    * @since 0.8
1364    */
1365   public static final View RPC_SERVER_RESPONSE_COUNT_MINUTE_VIEW =
1366       View.create(
1367           View.Name.create("grpc.io/server/response_count/minute"),
1368           "Minute stats on the count of response messages per server RPC",
1369           RPC_SERVER_RESPONSE_COUNT,
1370           MEAN,
1371           Arrays.asList(RPC_METHOD),
1372           INTERVAL_MINUTE);
1373 
1374   /**
1375    * Hour {@link View} for server latency in milliseconds.
1376    *
1377    * @since 0.8
1378    */
1379   public static final View RPC_SERVER_SERVER_LATENCY_HOUR_VIEW =
1380       View.create(
1381           View.Name.create("grpc.io/server/server_latency/hour"),
1382           "Hour stats for server latency in msecs",
1383           RPC_SERVER_SERVER_LATENCY,
1384           MEAN,
1385           Arrays.asList(RPC_METHOD),
1386           INTERVAL_HOUR);
1387 
1388   /**
1389    * Hour {@link View} for server request bytes.
1390    *
1391    * @since 0.8
1392    */
1393   public static final View RPC_SERVER_REQUEST_BYTES_HOUR_VIEW =
1394       View.create(
1395           View.Name.create("grpc.io/server/request_bytes/hour"),
1396           "Hour stats for request size in bytes",
1397           RPC_SERVER_REQUEST_BYTES,
1398           MEAN,
1399           Arrays.asList(RPC_METHOD),
1400           INTERVAL_HOUR);
1401 
1402   /**
1403    * Hour {@link View} for server response bytes.
1404    *
1405    * @since 0.8
1406    */
1407   public static final View RPC_SERVER_RESPONSE_BYTES_HOUR_VIEW =
1408       View.create(
1409           View.Name.create("grpc.io/server/response_bytes/hour"),
1410           "Hour stats for response size in bytes",
1411           RPC_SERVER_RESPONSE_BYTES,
1412           MEAN,
1413           Arrays.asList(RPC_METHOD),
1414           INTERVAL_HOUR);
1415 
1416   /**
1417    * Hour {@link View} for server RPC errors.
1418    *
1419    * @since 0.8
1420    */
1421   public static final View RPC_SERVER_ERROR_COUNT_HOUR_VIEW =
1422       View.create(
1423           View.Name.create("grpc.io/server/error_count/hour"),
1424           "Hour stats for rpc errors",
1425           RPC_SERVER_ERROR_COUNT,
1426           MEAN,
1427           Arrays.asList(RPC_METHOD),
1428           INTERVAL_HOUR);
1429 
1430   /**
1431    * Hour {@link View} for server uncompressed request bytes.
1432    *
1433    * @since 0.8
1434    */
1435   public static final View RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES_HOUR_VIEW =
1436       View.create(
1437           View.Name.create("grpc.io/server/uncompressed_request_bytes/hour"),
1438           "Hour stats for uncompressed request size in bytes",
1439           RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES,
1440           MEAN,
1441           Arrays.asList(RPC_METHOD),
1442           INTERVAL_HOUR);
1443 
1444   /**
1445    * Hour {@link View} for server uncompressed response bytes.
1446    *
1447    * @since 0.8
1448    */
1449   public static final View RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES_HOUR_VIEW =
1450       View.create(
1451           View.Name.create("grpc.io/server/uncompressed_response_bytes/hour"),
1452           "Hour stats for uncompressed response size in bytes",
1453           RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES,
1454           MEAN,
1455           Arrays.asList(RPC_METHOD),
1456           INTERVAL_HOUR);
1457 
1458   /**
1459    * Hour {@link View} for server elapsed time in milliseconds.
1460    *
1461    * @since 0.8
1462    */
1463   public static final View RPC_SERVER_SERVER_ELAPSED_TIME_HOUR_VIEW =
1464       View.create(
1465           View.Name.create("grpc.io/server/server_elapsed_time/hour"),
1466           "Hour stats for server elapsed time in msecs",
1467           RPC_SERVER_SERVER_ELAPSED_TIME,
1468           MEAN,
1469           Arrays.asList(RPC_METHOD),
1470           INTERVAL_HOUR);
1471 
1472   /**
1473    * Hour {@link View} for started server RPCs.
1474    *
1475    * @since 0.8
1476    */
1477   public static final View RPC_SERVER_STARTED_COUNT_HOUR_VIEW =
1478       View.create(
1479           View.Name.create("grpc.io/server/started_count/hour"),
1480           "Hour stats on the number of server RPCs started",
1481           RPC_SERVER_STARTED_COUNT,
1482           COUNT,
1483           Arrays.asList(RPC_METHOD),
1484           INTERVAL_HOUR);
1485 
1486   /**
1487    * Hour {@link View} for finished server RPCs.
1488    *
1489    * @since 0.8
1490    */
1491   public static final View RPC_SERVER_FINISHED_COUNT_HOUR_VIEW =
1492       View.create(
1493           View.Name.create("grpc.io/server/finished_count/hour"),
1494           "Hour stats on the number of server RPCs finished",
1495           RPC_SERVER_FINISHED_COUNT,
1496           COUNT,
1497           Arrays.asList(RPC_METHOD),
1498           INTERVAL_HOUR);
1499 
1500   /**
1501    * Hour {@link View} for server request messages.
1502    *
1503    * @since 0.8
1504    */
1505   public static final View RPC_SERVER_REQUEST_COUNT_HOUR_VIEW =
1506       View.create(
1507           View.Name.create("grpc.io/server/request_count/hour"),
1508           "Hour stats on the count of request messages per server RPC",
1509           RPC_SERVER_REQUEST_COUNT,
1510           MEAN,
1511           Arrays.asList(RPC_METHOD),
1512           INTERVAL_HOUR);
1513 
1514   /**
1515    * Hour {@link View} for server response messages.
1516    *
1517    * @since 0.8
1518    */
1519   public static final View RPC_SERVER_RESPONSE_COUNT_HOUR_VIEW =
1520       View.create(
1521           View.Name.create("grpc.io/server/response_count/hour"),
1522           "Hour stats on the count of response messages per server RPC",
1523           RPC_SERVER_RESPONSE_COUNT,
1524           MEAN,
1525           Arrays.asList(RPC_METHOD),
1526           INTERVAL_HOUR);
1527 
RpcViewConstants()1528   private RpcViewConstants() {}
1529 }
1530