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