forked from census-instrumentation/opencensus-java
/
RpcViewConstants.java
1521 lines (1404 loc) · 51.1 KB
/
RpcViewConstants.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright 2017, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.opencensus.contrib.grpc.metrics;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_BYTES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_BYTES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_MESSAGES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_ROUNDTRIP_LATENCY;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_BYTES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_BYTES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_MESSAGES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SENT_MESSAGES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_SERVER_LATENCY;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_STARTED_RPCS;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RETRIES_PER_CALL;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_RETRY_DELAY_PER_CALL;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_CLIENT_STATUS;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_BYTES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_BYTES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_MESSAGES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_BYTES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_BYTES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_MESSAGES_PER_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SENT_MESSAGES_PER_RPC;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_SERVER_LATENCY;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_STARTED_RPCS;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.GRPC_SERVER_STATUS;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_ERROR_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_FINISHED_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_REQUEST_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_REQUEST_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_RESPONSE_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_RESPONSE_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_ROUNDTRIP_LATENCY;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_SERVER_ELAPSED_TIME;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_STARTED_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_METHOD;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_ERROR_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_FINISHED_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_REQUEST_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_REQUEST_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_RESPONSE_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_RESPONSE_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_SERVER_ELAPSED_TIME;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_SERVER_LATENCY;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_STARTED_COUNT;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES;
import static io.opencensus.contrib.grpc.metrics.RpcMeasureConstants.RPC_STATUS;
import com.google.common.annotations.VisibleForTesting;
import io.opencensus.common.Duration;
import io.opencensus.stats.Aggregation;
import io.opencensus.stats.Aggregation.Count;
import io.opencensus.stats.Aggregation.Distribution;
import io.opencensus.stats.Aggregation.Sum;
import io.opencensus.stats.BucketBoundaries;
import io.opencensus.stats.View;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Constants for exporting views on rpc stats.
*
* @since 0.8
*/
@SuppressWarnings("deprecation")
public final class RpcViewConstants {
// Common histogram bucket boundaries for bytes received/sets Views.
@VisibleForTesting
static final List<Double> RPC_BYTES_BUCKET_BOUNDARIES =
Collections.unmodifiableList(
Arrays.asList(
0.0,
1024.0,
2048.0,
4096.0,
16384.0,
65536.0,
262144.0,
1048576.0,
4194304.0,
16777216.0,
67108864.0,
268435456.0,
1073741824.0,
4294967296.0));
// Common histogram bucket boundaries for latency and elapsed-time Views.
@VisibleForTesting
static final List<Double> RPC_MILLIS_BUCKET_BOUNDARIES =
Collections.unmodifiableList(
Arrays.asList(
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,
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,
300.0, 400.0, 500.0, 650.0, 800.0, 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 50000.0,
100000.0));
static final List<Double> RPC_MILLIS_BUCKET_BOUNDARIES_DEPRECATED =
Collections.unmodifiableList(
Arrays.asList(
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,
50.0, 65.0, 80.0, 100.0, 130.0, 160.0, 200.0, 250.0, 300.0, 400.0, 500.0, 650.0,
800.0, 1000.0, 2000.0, 5000.0, 10000.0, 20000.0, 50000.0, 100000.0));
// Common histogram bucket boundaries for request/response count Views.
@VisibleForTesting
static final List<Double> RPC_COUNT_BUCKET_BOUNDARIES =
Collections.unmodifiableList(
Arrays.asList(
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,
4096.0, 8192.0, 16384.0, 32768.0, 65536.0));
// Use Aggregation.Mean to record sum and count stats at the same time.
@VisibleForTesting static final Aggregation MEAN = Aggregation.Mean.create();
@VisibleForTesting static final Aggregation COUNT = Count.create();
@VisibleForTesting static final Aggregation SUM = Sum.create();
@VisibleForTesting
static final Aggregation AGGREGATION_WITH_BYTES_HISTOGRAM =
Distribution.create(BucketBoundaries.create(RPC_BYTES_BUCKET_BOUNDARIES));
@VisibleForTesting
static final Aggregation AGGREGATION_WITH_MILLIS_HISTOGRAM =
Distribution.create(BucketBoundaries.create(RPC_MILLIS_BUCKET_BOUNDARIES));
static final Aggregation AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED =
Distribution.create(BucketBoundaries.create(RPC_MILLIS_BUCKET_BOUNDARIES_DEPRECATED));
@VisibleForTesting
static final Aggregation AGGREGATION_WITH_COUNT_HISTOGRAM =
Distribution.create(BucketBoundaries.create(RPC_COUNT_BUCKET_BOUNDARIES));
@VisibleForTesting static final Duration MINUTE = Duration.create(60, 0);
@VisibleForTesting static final Duration HOUR = Duration.create(60 * 60, 0);
@VisibleForTesting
static final View.AggregationWindow CUMULATIVE = View.AggregationWindow.Cumulative.create();
@VisibleForTesting
static final View.AggregationWindow INTERVAL_MINUTE =
View.AggregationWindow.Interval.create(MINUTE);
@VisibleForTesting
static final View.AggregationWindow INTERVAL_HOUR = View.AggregationWindow.Interval.create(HOUR);
// Rpc client cumulative views.
/**
* Cumulative {@link View} for client RPC errors.
*
* @since 0.8
* @deprecated since error count measure is deprecated.
*/
@Deprecated
public static final View RPC_CLIENT_ERROR_COUNT_VIEW =
View.create(
View.Name.create("grpc.io/client/error_count/cumulative"),
"RPC Errors",
RPC_CLIENT_ERROR_COUNT,
MEAN,
Arrays.asList(RPC_STATUS, RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client roundtrip latency in milliseconds.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_ROUNDTRIP_LATENCY_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_ROUNDTRIP_LATENCY_VIEW =
View.create(
View.Name.create("grpc.io/client/roundtrip_latency/cumulative"),
"Latency in msecs",
RPC_CLIENT_ROUNDTRIP_LATENCY,
AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client server elapsed time in milliseconds.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_SERVER_LATENCY_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_SERVER_ELAPSED_TIME_VIEW =
View.create(
View.Name.create("grpc.io/client/server_elapsed_time/cumulative"),
"Server elapsed time in msecs",
RPC_CLIENT_SERVER_ELAPSED_TIME,
AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client request bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_SENT_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_REQUEST_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/client/request_bytes/cumulative"),
"Request bytes",
RPC_CLIENT_REQUEST_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client response bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_RECEIVED_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_RESPONSE_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/client/response_bytes/cumulative"),
"Response bytes",
RPC_CLIENT_RESPONSE_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client uncompressed request bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_SENT_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/client/uncompressed_request_bytes/cumulative"),
"Uncompressed Request bytes",
RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client uncompressed response bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_RECEIVED_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/client/uncompressed_response_bytes/cumulative"),
"Uncompressed Response bytes",
RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client request message counts.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_SENT_MESSAGES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_REQUEST_COUNT_VIEW =
View.create(
View.Name.create("grpc.io/client/request_count/cumulative"),
"Count of request messages per client RPC",
RPC_CLIENT_REQUEST_COUNT,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for client response message counts.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_RESPONSE_COUNT_VIEW =
View.create(
View.Name.create("grpc.io/client/response_count/cumulative"),
"Count of response messages per client RPC",
RPC_CLIENT_RESPONSE_COUNT,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for started client RPCs.
*
* @since 0.12
* @deprecated in favor of {@link #GRPC_CLIENT_STARTED_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_STARTED_COUNT_CUMULATIVE_VIEW =
View.create(
View.Name.create("grpc.io/client/started_count/cumulative"),
"Number of started client RPCs",
RPC_CLIENT_STARTED_COUNT,
COUNT,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for finished client RPCs.
*
* @since 0.12
* @deprecated in favor of {@link #GRPC_CLIENT_COMPLETED_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_CLIENT_FINISHED_COUNT_CUMULATIVE_VIEW =
View.create(
View.Name.create("grpc.io/client/finished_count/cumulative"),
"Number of finished client RPCs",
RPC_CLIENT_FINISHED_COUNT,
COUNT,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* {@link View} for client roundtrip latency in milliseconds.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_ROUNDTRIP_LATENCY_VIEW =
View.create(
View.Name.create("grpc.io/client/roundtrip_latency"),
"Latency in msecs",
GRPC_CLIENT_ROUNDTRIP_LATENCY,
AGGREGATION_WITH_MILLIS_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client server latency in milliseconds.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_SERVER_LATENCY_VIEW =
View.create(
View.Name.create("grpc.io/client/server_latency"),
"Server latency in msecs",
GRPC_CLIENT_SERVER_LATENCY,
AGGREGATION_WITH_MILLIS_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client sent bytes per RPC.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_SENT_BYTES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/client/sent_bytes_per_rpc"),
"Sent bytes per RPC",
GRPC_CLIENT_SENT_BYTES_PER_RPC,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client received bytes per RPC.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_RECEIVED_BYTES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/client/received_bytes_per_rpc"),
"Received bytes per RPC",
GRPC_CLIENT_RECEIVED_BYTES_PER_RPC,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client sent messages per RPC.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_SENT_MESSAGES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/client/sent_messages_per_rpc"),
"Number of messages sent in the RPC",
GRPC_CLIENT_SENT_MESSAGES_PER_RPC,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client received messages per RPC.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/client/received_messages_per_rpc"),
"Number of response messages received per RPC",
GRPC_CLIENT_RECEIVED_MESSAGES_PER_RPC,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client sent bytes per method.
*
* @since 0.18
*/
public static final View GRPC_CLIENT_SENT_BYTES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/client/sent_bytes_per_method"),
"Sent bytes per method",
GRPC_CLIENT_SENT_BYTES_PER_METHOD,
SUM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client received bytes per method.
*
* @since 0.18
*/
public static final View GRPC_CLIENT_RECEIVED_BYTES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/client/received_bytes_per_method"),
"Received bytes per method",
GRPC_CLIENT_RECEIVED_BYTES_PER_METHOD,
SUM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client sent messages.
*
* @since 0.18
*/
public static final View GRPC_CLIENT_SENT_MESSAGES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/client/sent_messages_per_method"),
"Number of messages sent",
GRPC_CLIENT_SENT_MESSAGES_PER_METHOD,
COUNT,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client received messages.
*
* @since 0.18
*/
public static final View GRPC_CLIENT_RECEIVED_MESSAGES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/client/received_messages_per_method"),
"Number of messages received",
GRPC_CLIENT_RECEIVED_MESSAGES_PER_METHOD,
COUNT,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for completed client RPCs.
*
* <p>This {@code View} uses measure {@code GRPC_CLIENT_ROUNDTRIP_LATENCY}, since completed RPCs
* can be inferred over any measure recorded once per RPC (since it's just a count aggregation
* over the measure). It would be unnecessary to use a separate "count" measure.
*
* @since 0.13
*/
public static final View GRPC_CLIENT_COMPLETED_RPC_VIEW =
View.create(
View.Name.create("grpc.io/client/completed_rpcs"),
"Number of completed client RPCs",
GRPC_CLIENT_ROUNDTRIP_LATENCY,
COUNT,
Arrays.asList(GRPC_CLIENT_METHOD, GRPC_CLIENT_STATUS));
/**
* {@link View} for started client RPCs.
*
* @since 0.14
*/
public static final View GRPC_CLIENT_STARTED_RPC_VIEW =
View.create(
View.Name.create("grpc.io/client/started_rpcs"),
"Number of started client RPCs",
GRPC_CLIENT_STARTED_RPCS,
COUNT,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for client retries per call.
*
* @since 0.28
*/
public static final View GRPC_CLIENT_RETRIES_PER_CALL_VIEW =
View.create(
View.Name.create("grpc.io/client/retries_per_call"),
"Number of client retries per call",
GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for total transparent client retries across calls.
*
* @since 0.28
*/
public static final View GRPC_CLIENT_TRANSPARENT_RETRIES_VIEW =
View.create(
View.Name.create("grpc.io/client/transparent_retries"),
"Total number of transparent client retries across calls",
GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL,
SUM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for total time of delay while there is no active attempt during the client call.
*
* @since 0.28
*/
public static final View GRPC_CLIENT_RETRY_DELAY_PER_CALL_VIEW =
View.create(
View.Name.create("grpc.io/client/retry_delay_per_call"),
"Total time of delay while there is no active attempt during the client call",
GRPC_CLIENT_RETRY_DELAY_PER_CALL,
AGGREGATION_WITH_MILLIS_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for total retries across all calls, excluding transparent retries
*
* @since 0.28
*/
public static final View GRPC_CLIENT_RETRIES_VIEW =
View.create(
View.Name.create("grpc.io/client/retries"),
"Total number of client retries across all calls",
GRPC_CLIENT_RETRIES_PER_CALL,
SUM,
Arrays.asList(GRPC_CLIENT_METHOD));
/**
* {@link View} for transparent retries per call
*
* @since 0.28
*/
public static final View GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL_VIEW =
View.create(
View.Name.create("grpc.io/client/transparent_retries_per_call"),
"Number of transparent client retries per call",
GRPC_CLIENT_TRANSPARENT_RETRIES_PER_CALL,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(GRPC_CLIENT_METHOD));
// Rpc server cumulative views.
/**
* Cumulative {@link View} for server RPC errors.
*
* @since 0.8
* @deprecated since error count measure is deprecated.
*/
@Deprecated
public static final View RPC_SERVER_ERROR_COUNT_VIEW =
View.create(
View.Name.create("grpc.io/server/error_count/cumulative"),
"RPC Errors",
RPC_SERVER_ERROR_COUNT,
MEAN,
Arrays.asList(RPC_STATUS, RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server latency in milliseconds.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_SERVER_LATENCY_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_SERVER_LATENCY_VIEW =
View.create(
View.Name.create("grpc.io/server/server_latency/cumulative"),
"Latency in msecs",
RPC_SERVER_SERVER_LATENCY,
AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server elapsed time in milliseconds.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_SERVER_LATENCY_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_SERVER_ELAPSED_TIME_VIEW =
View.create(
View.Name.create("grpc.io/server/elapsed_time/cumulative"),
"Server elapsed time in msecs",
RPC_SERVER_SERVER_ELAPSED_TIME,
AGGREGATION_WITH_MILLIS_HISTOGRAM_DEPRECATED,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server request bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_RECEIVED_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_REQUEST_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/server/request_bytes/cumulative"),
"Request bytes",
RPC_SERVER_REQUEST_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server response bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_SENT_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_RESPONSE_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/server/response_bytes/cumulative"),
"Response bytes",
RPC_SERVER_RESPONSE_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server uncompressed request bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_RECEIVED_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/server/uncompressed_request_bytes/cumulative"),
"Uncompressed Request bytes",
RPC_SERVER_UNCOMPRESSED_REQUEST_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server uncompressed response bytes.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_SENT_BYTES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES_VIEW =
View.create(
View.Name.create("grpc.io/server/uncompressed_response_bytes/cumulative"),
"Uncompressed Response bytes",
RPC_SERVER_UNCOMPRESSED_RESPONSE_BYTES,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server request message counts.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_REQUEST_COUNT_VIEW =
View.create(
View.Name.create("grpc.io/server/request_count/cumulative"),
"Count of request messages per server RPC",
RPC_SERVER_REQUEST_COUNT,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for server response message counts.
*
* @since 0.8
* @deprecated in favor of {@link #GRPC_SERVER_SENT_MESSAGES_PER_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_RESPONSE_COUNT_VIEW =
View.create(
View.Name.create("grpc.io/server/response_count/cumulative"),
"Count of response messages per server RPC",
RPC_SERVER_RESPONSE_COUNT,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for started server RPCs.
*
* @since 0.12
* @deprecated in favor of {@link #GRPC_SERVER_STARTED_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_STARTED_COUNT_CUMULATIVE_VIEW =
View.create(
View.Name.create("grpc.io/server/started_count/cumulative"),
"Number of started server RPCs",
RPC_SERVER_STARTED_COUNT,
COUNT,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* Cumulative {@link View} for finished server RPCs.
*
* @since 0.12
* @deprecated in favor of {@link #GRPC_SERVER_COMPLETED_RPC_VIEW}.
*/
@Deprecated
public static final View RPC_SERVER_FINISHED_COUNT_CUMULATIVE_VIEW =
View.create(
View.Name.create("grpc.io/server/finished_count/cumulative"),
"Number of finished server RPCs",
RPC_SERVER_FINISHED_COUNT,
COUNT,
Arrays.asList(RPC_METHOD),
CUMULATIVE);
/**
* {@link View} for server server latency in milliseconds.
*
* @since 0.13
*/
public static final View GRPC_SERVER_SERVER_LATENCY_VIEW =
View.create(
View.Name.create("grpc.io/server/server_latency"),
"Server latency in msecs",
GRPC_SERVER_SERVER_LATENCY,
AGGREGATION_WITH_MILLIS_HISTOGRAM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for server sent bytes per RPC.
*
* @since 0.13
*/
public static final View GRPC_SERVER_SENT_BYTES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/server/sent_bytes_per_rpc"),
"Sent bytes per RPC",
GRPC_SERVER_SENT_BYTES_PER_RPC,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for server received bytes per RPC.
*
* @since 0.13
*/
public static final View GRPC_SERVER_RECEIVED_BYTES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/server/received_bytes_per_rpc"),
"Received bytes per RPC",
GRPC_SERVER_RECEIVED_BYTES_PER_RPC,
AGGREGATION_WITH_BYTES_HISTOGRAM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for server sent messages per RPC.
*
* @since 0.13
*/
public static final View GRPC_SERVER_SENT_MESSAGES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/server/sent_messages_per_rpc"),
"Number of messages sent in each RPC",
GRPC_SERVER_SENT_MESSAGES_PER_RPC,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for server received messages per RPC.
*
* @since 0.13
*/
public static final View GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC_VIEW =
View.create(
View.Name.create("grpc.io/server/received_messages_per_rpc"),
"Number of response messages received in each RPC",
GRPC_SERVER_RECEIVED_MESSAGES_PER_RPC,
AGGREGATION_WITH_COUNT_HISTOGRAM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for total server sent bytes per method.
*
* @since 0.18
*/
public static final View GRPC_SERVER_SENT_BYTES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/server/sent_bytes_per_method"),
"Sent bytes per method",
GRPC_SERVER_SENT_BYTES_PER_METHOD,
SUM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for total server received bytes per method.
*
* @since 0.18
*/
public static final View GRPC_SERVER_RECEIVED_BYTES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/server/received_bytes_per_method"),
"Received bytes per method",
GRPC_SERVER_RECEIVED_BYTES_PER_METHOD,
SUM,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for server sent messages.
*
* @since 0.18
*/
public static final View GRPC_SERVER_SENT_MESSAGES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/server/sent_messages_per_method"),
"Number of messages sent",
GRPC_SERVER_SENT_MESSAGES_PER_METHOD,
COUNT,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for server received messages.
*
* @since 0.18
*/
public static final View GRPC_SERVER_RECEIVED_MESSAGES_PER_METHOD_VIEW =
View.create(
View.Name.create("grpc.io/server/received_messages_per_method"),
"Number of messages received",
GRPC_SERVER_RECEIVED_MESSAGES_PER_METHOD,
COUNT,
Arrays.asList(GRPC_SERVER_METHOD));
/**
* {@link View} for completed server RPCs.
*
* <p>This {@code View} uses measure {@code GRPC_SERVER_SERVER_LATENCY}, since completed RPCs can
* be inferred over any measure recorded once per RPC (since it's just a count aggregation over
* the measure). It would be unnecessary to use a separate "count" measure.
*
* @since 0.13
*/
public static final View GRPC_SERVER_COMPLETED_RPC_VIEW =
View.create(
View.Name.create("grpc.io/server/completed_rpcs"),
"Number of completed server RPCs",
GRPC_SERVER_SERVER_LATENCY,
COUNT,
Arrays.asList(GRPC_SERVER_METHOD, GRPC_SERVER_STATUS));
/**
* {@link View} for started server RPCs.
*
* @since 0.14
*/
public static final View GRPC_SERVER_STARTED_RPC_VIEW =
View.create(
View.Name.create("grpc.io/server/started_rpcs"),
"Number of started server RPCs",
GRPC_SERVER_STARTED_RPCS,
COUNT,
Arrays.asList(GRPC_SERVER_METHOD));
// Interval Stats
// RPC client interval views.
/**
* Minute {@link View} for client roundtrip latency in milliseconds.
*
* @since 0.8
*/
public static final View RPC_CLIENT_ROUNDTRIP_LATENCY_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/roundtrip_latency/minute"),
"Minute stats for latency in msecs",
RPC_CLIENT_ROUNDTRIP_LATENCY,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**
* Minute {@link View} for client request bytes.
*
* @since 0.8
*/
public static final View RPC_CLIENT_REQUEST_BYTES_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/request_bytes/minute"),
"Minute stats for request size in bytes",
RPC_CLIENT_REQUEST_BYTES,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**
* Minute {@link View} for client response bytes.
*
* @since 0.8
*/
public static final View RPC_CLIENT_RESPONSE_BYTES_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/response_bytes/minute"),
"Minute stats for response size in bytes",
RPC_CLIENT_RESPONSE_BYTES,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**
* Minute {@link View} for client RPC errors.
*
* @since 0.8
*/
public static final View RPC_CLIENT_ERROR_COUNT_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/error_count/minute"),
"Minute stats for rpc errors",
RPC_CLIENT_ERROR_COUNT,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**
* Minute {@link View} for client uncompressed request bytes.
*
* @since 0.8
*/
public static final View RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/uncompressed_request_bytes/minute"),
"Minute stats for uncompressed request size in bytes",
RPC_CLIENT_UNCOMPRESSED_REQUEST_BYTES,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**
* Minute {@link View} for client uncompressed response bytes.
*
* @since 0.8
*/
public static final View RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/uncompressed_response_bytes/minute"),
"Minute stats for uncompressed response size in bytes",
RPC_CLIENT_UNCOMPRESSED_RESPONSE_BYTES,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**
* Minute {@link View} for client server elapsed time in milliseconds.
*
* @since 0.8
*/
public static final View RPC_CLIENT_SERVER_ELAPSED_TIME_MINUTE_VIEW =
View.create(
View.Name.create("grpc.io/client/server_elapsed_time/minute"),
"Minute stats for server elapsed time in msecs",
RPC_CLIENT_SERVER_ELAPSED_TIME,
MEAN,
Arrays.asList(RPC_METHOD),
INTERVAL_MINUTE);
/**