Add OpenCensus measures and views for retries (#26751)

* Add OpenCensus measures and views for retries

* Fix views

* Fix measures
pull/26770/head
Yash Tibrewal 3 years ago committed by GitHub
parent 0e6fe3f42c
commit 1265cfd29a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/cpp/ext/filters/census/grpc_plugin.cc
  2. 21
      src/cpp/ext/filters/census/grpc_plugin.h
  3. 26
      src/cpp/ext/filters/census/measures.cc
  4. 3
      src/cpp/ext/filters/census/measures.h
  5. 150
      src/cpp/ext/filters/census/views.cc

@ -47,6 +47,9 @@ void RegisterOpenCensusPlugin() {
RpcClientServerLatency();
RpcClientSentMessagesPerRpc();
RpcClientReceivedMessagesPerRpc();
RpcClientRetriesPerCall();
RpcClientTransparentRetriesPerCall();
RpcClientRetryDelayPerCall();
RpcServerSentBytesPerRpc();
RpcServerReceivedBytesPerRpc();
@ -112,6 +115,16 @@ ABSL_CONST_INIT const absl::string_view kRpcClientRoundtripLatencyMeasureName =
ABSL_CONST_INIT const absl::string_view kRpcClientServerLatencyMeasureName =
"grpc.io/client/server_latency";
ABSL_CONST_INIT const absl::string_view kRpcClientRetriesPerCallMeasureName =
"grpc.io/client/retries_per_call";
ABSL_CONST_INIT const absl::string_view
kRpcClientTransparentRetriesPerCallMeasureName =
"grpc.io/client/transparent_retries_per_call";
ABSL_CONST_INIT const absl::string_view kRpcClientRetryDelayPerCallMeasureName =
"grpc.io/client/retry_delay_per_call";
// Server
ABSL_CONST_INIT const absl::string_view
kRpcServerSentMessagesPerRpcMeasureName =

@ -42,6 +42,9 @@ extern const absl::string_view kRpcClientReceivedMessagesPerRpcMeasureName;
extern const absl::string_view kRpcClientReceivedBytesPerRpcMeasureName;
extern const absl::string_view kRpcClientRoundtripLatencyMeasureName;
extern const absl::string_view kRpcClientServerLatencyMeasureName;
extern const absl::string_view kRpcClientRetriesPerCallMeasureName;
extern const absl::string_view kRpcClientTransparentRetriesPerCallMeasureName;
extern const absl::string_view kRpcClientRetryDelayPerCallMeasureName;
extern const absl::string_view kRpcServerSentMessagesPerRpcMeasureName;
extern const absl::string_view kRpcServerSentBytesPerRpcMeasureName;
@ -59,6 +62,12 @@ ClientReceivedBytesPerRpcCumulative();
const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatencyCumulative();
const ::opencensus::stats::ViewDescriptor& ClientServerLatencyCumulative();
const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcsCumulative();
const ::opencensus::stats::ViewDescriptor& ClientRetriesPerCallCumulative();
const ::opencensus::stats::ViewDescriptor& ClientRetriesCumulative();
const ::opencensus::stats::ViewDescriptor&
ClientTransparentRetriesPerCallCumulative();
const ::opencensus::stats::ViewDescriptor& ClientTransparentRetriesCumulative();
const ::opencensus::stats::ViewDescriptor& ClientRetryDelayPerCallCumulative();
const ::opencensus::stats::ViewDescriptor& ServerSentBytesPerRpcCumulative();
const ::opencensus::stats::ViewDescriptor&
@ -77,6 +86,12 @@ const ::opencensus::stats::ViewDescriptor& ClientReceivedBytesPerRpcMinute();
const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatencyMinute();
const ::opencensus::stats::ViewDescriptor& ClientServerLatencyMinute();
const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcsMinute();
const ::opencensus::stats::ViewDescriptor& ClientRetriesPerCallMinute();
const ::opencensus::stats::ViewDescriptor& ClientRetriesMinute();
const ::opencensus::stats::ViewDescriptor&
ClientTransparentRetriesPerCallMinute();
const ::opencensus::stats::ViewDescriptor& ClientTransparentRetriesMinute();
const ::opencensus::stats::ViewDescriptor& ClientRetryDelayPerCallMinute();
const ::opencensus::stats::ViewDescriptor& ServerSentMessagesPerRpcMinute();
const ::opencensus::stats::ViewDescriptor& ServerSentBytesPerRpcMinute();
@ -92,6 +107,12 @@ const ::opencensus::stats::ViewDescriptor& ClientReceivedBytesPerRpcHour();
const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatencyHour();
const ::opencensus::stats::ViewDescriptor& ClientServerLatencyHour();
const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcsHour();
const ::opencensus::stats::ViewDescriptor& ClientRetriesPerCallHour();
const ::opencensus::stats::ViewDescriptor& ClientRetriesHour();
const ::opencensus::stats::ViewDescriptor&
ClientTransparentRetriesPerCallHour();
const ::opencensus::stats::ViewDescriptor& ClientTransparentRetriesHour();
const ::opencensus::stats::ViewDescriptor& ClientRetryDelayPerCallHour();
const ::opencensus::stats::ViewDescriptor& ServerSentMessagesPerRpcHour();
const ::opencensus::stats::ViewDescriptor& ServerSentBytesPerRpcHour();

@ -88,6 +88,32 @@ MeasureInt64 RpcClientReceivedMessagesPerRpc() {
return measure;
}
// Client per-overall-client-call measures
MeasureInt64 RpcClientRetriesPerCall() {
static const auto measure =
MeasureInt64::Register(kRpcClientRetriesPerCallMeasureName,
"Number of retry or hedging attempts excluding "
"transparent retries made during the client call",
kCount);
return measure;
}
MeasureInt64 RpcClientTransparentRetriesPerCall() {
static const auto measure = MeasureInt64::Register(
kRpcClientTransparentRetriesPerCallMeasureName,
"Number of transparent retries made during the client call", kCount);
return measure;
}
MeasureDouble RpcClientRetryDelayPerCall() {
static const auto measure =
MeasureDouble::Register(kRpcClientRetryDelayPerCallMeasureName,
"Total time of delay while there is no active "
"attempt during the client call",
kUnitMilliseconds);
return measure;
}
// Server
MeasureDouble RpcServerSentBytesPerRpc() {
static const auto measure = MeasureDouble::Register(

@ -33,6 +33,9 @@ namespace grpc {
::opencensus::stats::MeasureDouble RpcClientRoundtripLatency();
::opencensus::stats::MeasureDouble RpcClientServerLatency();
::opencensus::stats::MeasureInt64 RpcClientCompletedRpcs();
::opencensus::stats::MeasureInt64 RpcClientRetriesPerCall();
::opencensus::stats::MeasureInt64 RpcClientTransparentRetriesPerCall();
::opencensus::stats::MeasureDouble RpcClientRetryDelayPerCall();
::opencensus::stats::MeasureInt64 RpcServerSentMessagesPerRpc();
::opencensus::stats::MeasureDouble RpcServerSentBytesPerRpc();

@ -158,6 +158,56 @@ const ViewDescriptor& ClientReceivedMessagesPerRpcCumulative() {
return descriptor;
}
const ViewDescriptor& ClientRetriesPerCallCumulative() {
const static ViewDescriptor descriptor =
ViewDescriptor()
.set_name("grpc.io/client/retries_per_call/cumulative")
.set_measure(kRpcClientRetriesPerCallMeasureName)
.set_aggregation(CountDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientRetriesCumulative() {
const static ViewDescriptor descriptor =
ViewDescriptor()
.set_name("grpc.io/client/retries/cumulative")
.set_measure(kRpcClientRetriesPerCallMeasureName)
.set_aggregation(Aggregation::Sum())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientTransparentRetriesPerCallCumulative() {
const static ViewDescriptor descriptor =
ViewDescriptor()
.set_name("grpc.io/client/transparent_retries_per_call/cumulative")
.set_measure(kRpcClientTransparentRetriesPerCallMeasureName)
.set_aggregation(CountDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientTransparentRetriesCumulative() {
const static ViewDescriptor descriptor =
ViewDescriptor()
.set_name("grpc.io/client/transparent_retries/cumulative")
.set_measure(kRpcClientTransparentRetriesPerCallMeasureName)
.set_aggregation(Aggregation::Sum())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientRetryDelayPerCallCumulative() {
const static ViewDescriptor descriptor =
ViewDescriptor()
.set_name("grpc.io/client/retry_delay_per_call/cumulative")
.set_measure(kRpcClientRetryDelayPerCallMeasureName)
.set_aggregation(MillisDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
// server cumulative
const ViewDescriptor& ServerSentBytesPerRpcCumulative() {
const static ViewDescriptor descriptor =
@ -292,6 +342,56 @@ const ViewDescriptor& ClientReceivedMessagesPerRpcMinute() {
return descriptor;
}
const ViewDescriptor& ClientRetriesPerCallMinute() {
const static ViewDescriptor descriptor =
MinuteDescriptor()
.set_name("grpc.io/client/retries_per_call/minute")
.set_measure(kRpcClientRetriesPerCallMeasureName)
.set_aggregation(CountDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientRetriesMinute() {
const static ViewDescriptor descriptor =
MinuteDescriptor()
.set_name("grpc.io/client/retries/minute")
.set_measure(kRpcClientRetriesPerCallMeasureName)
.set_aggregation(Aggregation::Sum())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientTransparentRetriesPerCallMinute() {
const static ViewDescriptor descriptor =
MinuteDescriptor()
.set_name("grpc.io/client/transparent_retries_per_call/minute")
.set_measure(kRpcClientTransparentRetriesPerCallMeasureName)
.set_aggregation(CountDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientTransparentRetriesMinute() {
const static ViewDescriptor descriptor =
MinuteDescriptor()
.set_name("grpc.io/client/transparent_retries/minute")
.set_measure(kRpcClientTransparentRetriesPerCallMeasureName)
.set_aggregation(Aggregation::Sum())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientRetryDelayPerCallMinute() {
const static ViewDescriptor descriptor =
MinuteDescriptor()
.set_name("grpc.io/client/retry_delay_per_call/minute")
.set_measure(kRpcClientRetryDelayPerCallMeasureName)
.set_aggregation(MillisDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
// server minute
const ViewDescriptor& ServerSentBytesPerRpcMinute() {
const static ViewDescriptor descriptor =
@ -426,6 +526,56 @@ const ViewDescriptor& ClientReceivedMessagesPerRpcHour() {
return descriptor;
}
const ViewDescriptor& ClientRetriesPerCallHour() {
const static ViewDescriptor descriptor =
HourDescriptor()
.set_name("grpc.io/client/retries_per_call/hour")
.set_measure(kRpcClientRetriesPerCallMeasureName)
.set_aggregation(CountDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientRetriesHour() {
const static ViewDescriptor descriptor =
HourDescriptor()
.set_name("grpc.io/client/retries/hour")
.set_measure(kRpcClientRetriesPerCallMeasureName)
.set_aggregation(Aggregation::Sum())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientTransparentRetriesPerCallHour() {
const static ViewDescriptor descriptor =
HourDescriptor()
.set_name("grpc.io/client/transparent_retries_per_call/hour")
.set_measure(kRpcClientTransparentRetriesPerCallMeasureName)
.set_aggregation(CountDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientTransparentRetriesHour() {
const static ViewDescriptor descriptor =
HourDescriptor()
.set_name("grpc.io/client/transparent_retries/hour")
.set_measure(kRpcClientTransparentRetriesPerCallMeasureName)
.set_aggregation(Aggregation::Sum())
.add_column(ClientMethodTagKey());
return descriptor;
}
const ViewDescriptor& ClientRetryDelayPerCallHour() {
const static ViewDescriptor descriptor =
HourDescriptor()
.set_name("grpc.io/client/retry_delay_per_call/hour")
.set_measure(kRpcClientRetryDelayPerCallMeasureName)
.set_aggregation(MillisDistributionAggregation())
.add_column(ClientMethodTagKey());
return descriptor;
}
// server hour
const ViewDescriptor& ServerSentBytesPerRpcHour() {
const static ViewDescriptor descriptor =

Loading…
Cancel
Save