Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/time.h"
#include "google/monitoring/v3/metric_service.grpc.pb.h"
#include "google/protobuf/empty.pb.h"
#include "opencensus/common/internal/grpc/status.h"
Expand Down Expand Up @@ -107,6 +108,8 @@ void Handler::ExportViewData(
for (int i = rpc_index * kTimeSeriesBatchSize; i < batch_end; ++i) {
*request.add_time_series() = time_series[i];
};
responses[rpc_index].second.set_deadline(
Comment thread
g-easy marked this conversation as resolved.
absl::ToChronoTime(absl::Now() + opts_.rpc_deadline));
auto rpc(stub_->AsyncCreateTimeSeries(&responses[rpc_index].second, request,
&cq));
rpc->Finish(&response, &responses[rpc_index].first,
Expand Down Expand Up @@ -145,6 +148,7 @@ bool Handler::MaybeRegisterView(
SetMetricDescriptor(project_id_, descriptor,
request.mutable_metric_descriptor());
::grpc::ClientContext context;
context.set_deadline(absl::ToChronoTime(absl::Now() + opts_.rpc_deadline));
google::api::MetricDescriptor response;
::grpc::Status status =
stub_->CreateMetricDescriptor(&context, request, &response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "absl/base/macros.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"

namespace opencensus {
namespace exporters {
Expand All @@ -32,6 +33,9 @@ struct StackdriverOptions {
// The recommended format is "{LANGUAGE}-{PID}@{HOSTNAME}". If PID is not
// available, a random number may be used.
std::string opencensus_task;

// The RPC deadline to use when exporting to Stackdriver.
absl::Duration rpc_deadline = absl::Seconds(5);
};

// Exports stats for registered views (see opencensus/stats/stats_exporter.h) to
Expand Down