Debian Codegraph @

src/cpp/server/load_reporter/constants.h

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