• 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_SRC_CPP_SERVER_LOAD_REPORTER_UTIL_H
20 #define GRPC_SRC_CPP_SERVER_LOAD_REPORTER_UTIL_H
21 
22 #include <grpc/impl/codegen/port_platform.h>
23 
24 namespace grpc {
25 namespace load_reporter {
26 
27 // TODO(juanlishen): Update the version number with the PR number every time
28 // there is any change to the server load reporter.
29 constexpr uint32_t kVersion = 15853;
30 
31 // TODO(juanlishen): This window size is from the internal spec for the load
32 // reporter. Need to ask the gRPC LB team whether we should make this and the
33 // fetching interval configurable.
34 constexpr uint32_t kFeedbackSampleWindowSeconds = 10;
35 constexpr uint32_t kFetchAndSampleIntervalSeconds = 1;
36 
37 constexpr size_t kLbIdLength = 8;
38 constexpr size_t kIpv4AddressLength = 8;
39 constexpr size_t kIpv6AddressLength = 32;
40 
41 constexpr char kInvalidLbId[] = "<INVALID_LBID_238dsb234890rb>";
42 
43 // Call statuses.
44 
45 constexpr char kCallStatusOk[] = "OK";
46 constexpr char kCallStatusServerError[] = "5XX";
47 constexpr char kCallStatusClientError[] = "4XX";
48 
49 // Tag keys.
50 
51 constexpr char kTagKeyToken[] = "token";
52 constexpr char kTagKeyHost[] = "host";
53 constexpr char kTagKeyUserId[] = "user_id";
54 constexpr char kTagKeyStatus[] = "status";
55 constexpr char kTagKeyMetricName[] = "metric_name";
56 
57 // Measure names.
58 
59 constexpr char kMeasureStartCount[] = "grpc.io/lb/start_count";
60 constexpr char kMeasureEndCount[] = "grpc.io/lb/end_count";
61 constexpr char kMeasureEndBytesSent[] = "grpc.io/lb/bytes_sent";
62 constexpr char kMeasureEndBytesReceived[] = "grpc.io/lb/bytes_received";
63 constexpr char kMeasureEndLatencyMs[] = "grpc.io/lb/latency_ms";
64 constexpr char kMeasureOtherCallMetric[] = "grpc.io/lb/other_call_metric";
65 
66 // View names.
67 
68 constexpr char kViewStartCount[] = "grpc.io/lb_view/start_count";
69 constexpr char kViewEndCount[] = "grpc.io/lb_view/end_count";
70 constexpr char kViewEndBytesSent[] = "grpc.io/lb_view/bytes_sent";
71 constexpr char kViewEndBytesReceived[] = "grpc.io/lb_view/bytes_received";
72 constexpr char kViewEndLatencyMs[] = "grpc.io/lb_view/latency_ms";
73 constexpr char kViewOtherCallMetricCount[] =
74     "grpc.io/lb_view/other_call_metric_count";
75 constexpr char kViewOtherCallMetricValue[] =
76     "grpc.io/lb_view/other_call_metric_value";
77 
78 }  // namespace load_reporter
79 }  // namespace grpc
80 
81 #endif  // GRPC_SRC_CPP_SERVER_LOAD_REPORTER_UTIL_H
82