From 75f2a2c1c68db010fc959abb18012bcb8e8522ae Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 10 Jan 2023 13:40:33 -0800 Subject: [PATCH] GCP Observability: Client attempt top latency (#32064) --- include/grpcpp/opencensus.h | 1 + src/cpp/ext/filters/census/views.cc | 10 ++++++++++ src/cpp/ext/gcp/observability.cc | 1 + 3 files changed, 12 insertions(+) diff --git a/include/grpcpp/opencensus.h b/include/grpcpp/opencensus.h index 260c4a50d9a..55ad9ddc0f2 100644 --- a/include/grpcpp/opencensus.h +++ b/include/grpcpp/opencensus.h @@ -76,6 +76,7 @@ extern const absl::string_view kRpcServerStartedRpcsMeasureName; // Canonical gRPC view definitions. const ::opencensus::stats::ViewDescriptor& ClientStartedRpcs(); const ::opencensus::stats::ViewDescriptor& ClientCompletedRpcs(); +const ::opencensus::stats::ViewDescriptor& ClientRoundtripLatency(); const ::opencensus::stats::ViewDescriptor& ClientSentCompressedMessageBytesPerRpc(); const ::opencensus::stats::ViewDescriptor& diff --git a/src/cpp/ext/filters/census/views.cc b/src/cpp/ext/filters/census/views.cc index 905a9fff436..aaa759e0f16 100644 --- a/src/cpp/ext/filters/census/views.cc +++ b/src/cpp/ext/filters/census/views.cc @@ -110,6 +110,16 @@ const ViewDescriptor& ClientCompletedRpcs() { return descriptor; } +const ViewDescriptor& ClientRoundtripLatency() { + const static ViewDescriptor descriptor = + ViewDescriptor() + .set_name("grpc.io/client/roundtrip_latency") + .set_measure(kRpcClientRoundtripLatencyMeasureName) + .set_aggregation(MillisDistributionAggregation()) + .add_column(ClientMethodTagKey()); + return descriptor; +} + const ViewDescriptor& ClientSentCompressedMessageBytesPerRpc() { const static ViewDescriptor descriptor = ViewDescriptor() diff --git a/src/cpp/ext/gcp/observability.cc b/src/cpp/ext/gcp/observability.cc index 47928785264..95f6fbb1da3 100644 --- a/src/cpp/ext/gcp/observability.cc +++ b/src/cpp/ext/gcp/observability.cc @@ -61,6 +61,7 @@ void RegisterOpenCensusViewsForGcpObservability() { // Register client default views for GCP observability ClientStartedRpcs().RegisterForExport(); ClientCompletedRpcs().RegisterForExport(); + ClientRoundtripLatency().RegisterForExport(); ClientSentCompressedMessageBytesPerRpc().RegisterForExport(); ClientReceivedCompressedMessageBytesPerRpc().RegisterForExport(); // Register server default views for GCP observability