Revert "Revert "GcpObservability: Change default views provided (#31144)" (#31149)" (#31155)

This reverts commit 6fbff9c6a9.
pull/31159/head
Yash Tibrewal 2 years ago committed by GitHub
parent 68387a4e68
commit 4ccb80252b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/cpp/ext/gcp/BUILD
  2. 14
      src/cpp/ext/gcp/observability.cc

@ -41,6 +41,7 @@ grpc_cc_library(
"absl/status",
"absl/status:statusor",
"absl/types:optional",
"opencensus-stats",
"opencensus-trace",
"opencensus-trace-stackdriver_exporter",
"opencensus-stats-stackdriver_exporter",

@ -27,12 +27,14 @@
#include "absl/types/optional.h"
#include "opencensus/exporters/stats/stackdriver/stackdriver_exporter.h"
#include "opencensus/exporters/trace/stackdriver/stackdriver_exporter.h"
#include "opencensus/stats/stats.h"
#include "opencensus/trace/sampler.h"
#include "opencensus/trace/trace_config.h"
#include <grpcpp/opencensus.h>
#include <grpcpp/support/config.h>
#include "src/cpp/ext/filters/census/grpc_plugin.h"
#include "src/cpp/ext/gcp/observability_config.h"
namespace grpc {
@ -46,6 +48,16 @@ constexpr uint32_t kMaxAttributes = 128;
constexpr uint32_t kMaxAnnotations = 128;
constexpr uint32_t kMaxMessageEvents = 128;
constexpr uint32_t kMaxLinks = 128;
void RegisterOpenCensusViewsForGcpObservability() {
// Register client default views for GCP observability
ClientStartedRpcsCumulative().RegisterForExport();
ClientCompletedRpcsCumulative().RegisterForExport();
// Register server default views for GCP observability
ServerStartedRpcsCumulative().RegisterForExport();
ServerCompletedRpcsCumulative().RegisterForExport();
}
} // namespace
absl::Status GcpObservabilityInit() {
@ -54,7 +66,7 @@ absl::Status GcpObservabilityInit() {
return config.status();
}
grpc::RegisterOpenCensusPlugin();
grpc::RegisterOpenCensusViewsForExport();
RegisterOpenCensusViewsForGcpObservability();
if (config->cloud_trace.has_value()) {
opencensus::trace::TraceConfig::SetCurrentTraceParams(
{kMaxAttributes, kMaxAnnotations, kMaxMessageEvents, kMaxLinks,

Loading…
Cancel
Save