• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_INTERNAL_CPP_EXT_FILTERS_CENSUS_GRPC_PLUGIN_H
20 #define GRPC_INTERNAL_CPP_EXT_FILTERS_CENSUS_GRPC_PLUGIN_H
21 
22 #include <grpc/support/port_platform.h>
23 
24 #include "absl/strings/string_view.h"
25 #include "include/grpcpp/opencensus.h"
26 #include "opencensus/stats/stats.h"
27 
28 namespace grpc {
29 
30 class ServerContext;
31 
32 // The tag keys set when recording RPC stats.
33 ::opencensus::stats::TagKey ClientMethodTagKey();
34 ::opencensus::stats::TagKey ClientStatusTagKey();
35 ::opencensus::stats::TagKey ServerMethodTagKey();
36 ::opencensus::stats::TagKey ServerStatusTagKey();
37 
38 // Names of measures used by the plugin--users can create views on these
39 // measures but should not record data for them.
40 extern const absl::string_view kRpcClientSentMessagesPerRpcMeasureName;
41 extern const absl::string_view kRpcClientSentBytesPerRpcMeasureName;
42 extern const absl::string_view kRpcClientReceivedMessagesPerRpcMeasureName;
43 extern const absl::string_view kRpcClientReceivedBytesPerRpcMeasureName;
44 extern const absl::string_view kRpcClientRoundtripLatencyMeasureName;
45 extern const absl::string_view kRpcClientServerLatencyMeasureName;
46 
47 extern const absl::string_view kRpcServerSentMessagesPerRpcMeasureName;
48 extern const absl::string_view kRpcServerSentBytesPerRpcMeasureName;
49 extern const absl::string_view kRpcServerReceivedMessagesPerRpcMeasureName;
50 extern const absl::string_view kRpcServerReceivedBytesPerRpcMeasureName;
51 extern const absl::string_view kRpcServerServerLatencyMeasureName;
52 
53 // Canonical gRPC view definitions.
54 const ::opencensus::stats::ViewDescriptor& ClientSentMessagesPerRpcCumulative();
55 const ::opencensus::stats::ViewDescriptor& ClientSentBytesPerRpcCumulative();
56 const ::opencensus::stats::ViewDescriptor&
57 ClientReceivedMessagesPerRpcCumulative();
58 const ::opencensus::stats::ViewDescriptor&
59 ClientReceivedBytesPerRpcCumulative();
60 const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatencyCumulative();
61 const ::opencensus::stats::ViewDescriptor& ClientServerLatencyCumulative();
62 const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcsCumulative();
63 
64 const ::opencensus::stats::ViewDescriptor& ServerSentBytesPerRpcCumulative();
65 const ::opencensus::stats::ViewDescriptor&
66 ServerReceivedBytesPerRpcCumulative();
67 const ::opencensus::stats::ViewDescriptor& ServerServerLatencyCumulative();
68 const ::opencensus::stats::ViewDescriptor& ServerStartedCountCumulative();
69 const ::opencensus::stats::ViewDescriptor& ServerCompletedRpcsCumulative();
70 const ::opencensus::stats::ViewDescriptor& ServerSentMessagesPerRpcCumulative();
71 const ::opencensus::stats::ViewDescriptor&
72 ServerReceivedMessagesPerRpcCumulative();
73 
74 const ::opencensus::stats::ViewDescriptor& ClientSentMessagesPerRpcMinute();
75 const ::opencensus::stats::ViewDescriptor& ClientSentBytesPerRpcMinute();
76 const ::opencensus::stats::ViewDescriptor& ClientReceivedMessagesPerRpcMinute();
77 const ::opencensus::stats::ViewDescriptor& ClientReceivedBytesPerRpcMinute();
78 const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatencyMinute();
79 const ::opencensus::stats::ViewDescriptor& ClientServerLatencyMinute();
80 const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcsMinute();
81 
82 const ::opencensus::stats::ViewDescriptor& ServerSentMessagesPerRpcMinute();
83 const ::opencensus::stats::ViewDescriptor& ServerSentBytesPerRpcMinute();
84 const ::opencensus::stats::ViewDescriptor& ServerReceivedMessagesPerRpcMinute();
85 const ::opencensus::stats::ViewDescriptor& ServerReceivedBytesPerRpcMinute();
86 const ::opencensus::stats::ViewDescriptor& ServerServerLatencyMinute();
87 const ::opencensus::stats::ViewDescriptor& ServerCompletedRpcsMinute();
88 
89 const ::opencensus::stats::ViewDescriptor& ClientSentMessagesPerRpcHour();
90 const ::opencensus::stats::ViewDescriptor& ClientSentBytesPerRpcHour();
91 const ::opencensus::stats::ViewDescriptor& ClientReceivedMessagesPerRpcHour();
92 const ::opencensus::stats::ViewDescriptor& ClientReceivedBytesPerRpcHour();
93 const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatencyHour();
94 const ::opencensus::stats::ViewDescriptor& ClientServerLatencyHour();
95 const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcsHour();
96 
97 const ::opencensus::stats::ViewDescriptor& ServerSentMessagesPerRpcHour();
98 const ::opencensus::stats::ViewDescriptor& ServerSentBytesPerRpcHour();
99 const ::opencensus::stats::ViewDescriptor& ServerReceivedMessagesPerRpcHour();
100 const ::opencensus::stats::ViewDescriptor& ServerReceivedBytesPerRpcHour();
101 const ::opencensus::stats::ViewDescriptor& ServerServerLatencyHour();
102 const ::opencensus::stats::ViewDescriptor& ServerStartedCountHour();
103 const ::opencensus::stats::ViewDescriptor& ServerCompletedRpcsHour();
104 
105 }  // namespace grpc
106 
107 #endif /* GRPC_INTERNAL_CPP_EXT_FILTERS_CENSUS_GRPC_PLUGIN_H */
108