This repository was archived by the owner on Jul 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
opencensus/exporters/trace/stackdriver Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ void Handler::Export(
237237 ::google::protobuf::Empty response;
238238 grpc::ClientContext context;
239239 context.set_deadline (absl::ToChronoTime (absl::Now () + opts_.rpc_deadline ));
240+ opts_.prepare_client_context (&context);
240241 grpc::Status status =
241242 opts_.trace_service_stub ->BatchWriteSpans (&context, request, &response);
242243 if (!status.ok ()) {
Original file line number Diff line number Diff line change 1515#ifndef OPENCENSUS_EXPORTERS_TRACE_STACKDRIVER_STACKDRIVER_EXPORTER_H_
1616#define OPENCENSUS_EXPORTERS_TRACE_STACKDRIVER_STACKDRIVER_EXPORTER_H_
1717
18+ #include < functional>
1819#include < memory>
1920#include < string>
2021
@@ -39,6 +40,13 @@ struct StackdriverOptions {
3940 // instead. Useful for testing.
4041 std::unique_ptr<google::devtools::cloudtrace::v2::TraceService::StubInterface>
4142 trace_service_stub;
43+
44+ // (optional) A function which can be used to modify the grpc::ClientContext
45+ // before making API requests. For example, to add custom credentials.
46+ // This function will be called by the exporter before every BatchWriteSpans
47+ // RPC. This function will not be called in parallel.
48+ std::function<void (grpc::ClientContext*)> prepare_client_context =
49+ [](grpc::ClientContext*) {};
4250};
4351
4452class StackdriverExporter {
You can’t perform that action at this time.
0 commit comments