6 #include <grpcpp/grpcpp.h>
7 #include <grpcpp/support/status.h>
13 #include "opentelemetry/exporters/otlp/otlp_grpc_client_options.h"
14 #include "opentelemetry/version.h"
17 #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h"
18 #include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h"
19 #include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h"
20 #include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h"
21 #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h"
24 #ifdef ENABLE_ASYNC_EXPORT
25 # include <functional>
27 # include "opentelemetry/sdk/common/exporter_utils.h"
83 struct OtlpGrpcClientOptions;
84 struct OtlpGrpcClientAsyncData;
99 std::atomic<bool> has_value_;
115 static std::string
GetGrpcTarget(
const std::string &endpoint);
131 std::unique_ptr<proto::collector::trace::v1::TraceService::StubInterface>
MakeTraceServiceStub();
136 std::unique_ptr<proto::collector::metrics::v1::MetricsService::StubInterface>
142 std::unique_ptr<proto::collector::logs::v1::LogsService::StubInterface>
MakeLogsServiceStub();
145 proto::collector::trace::v1::TraceService::StubInterface *stub,
146 std::unique_ptr<grpc::ClientContext> &&
context,
147 std::unique_ptr<google::protobuf::Arena> &&arena,
148 proto::collector::trace::v1::ExportTraceServiceRequest &&request,
149 proto::collector::trace::v1::ExportTraceServiceResponse *response);
152 proto::collector::metrics::v1::MetricsService::StubInterface *stub,
153 std::unique_ptr<grpc::ClientContext> &&
context,
154 std::unique_ptr<google::protobuf::Arena> &&arena,
155 proto::collector::metrics::v1::ExportMetricsServiceRequest &&request,
156 proto::collector::metrics::v1::ExportMetricsServiceResponse *response);
159 proto::collector::logs::v1::LogsService::StubInterface *stub,
160 std::unique_ptr<grpc::ClientContext> &&
context,
161 std::unique_ptr<google::protobuf::Arena> &&arena,
162 proto::collector::logs::v1::ExportLogsServiceRequest &&request,
163 proto::collector::logs::v1::ExportLogsServiceResponse *response);
176 #ifdef ENABLE_ASYNC_EXPORT
187 proto::collector::trace::v1::TraceService::StubInterface *stub,
188 std::unique_ptr<grpc::ClientContext> &&
context,
189 std::unique_ptr<google::protobuf::Arena> &&arena,
190 proto::collector::trace::v1::ExportTraceServiceRequest &&request,
192 std::unique_ptr<google::protobuf::Arena> &&,
193 const proto::collector::trace::v1::ExportTraceServiceRequest &,
194 proto::collector::trace::v1::ExportTraceServiceResponse *)>
195 &&result_callback) noexcept;
207 proto::collector::metrics::v1::MetricsService::StubInterface *stub,
208 std::unique_ptr<grpc::ClientContext> &&
context,
209 std::unique_ptr<google::protobuf::Arena> &&arena,
210 proto::collector::metrics::v1::ExportMetricsServiceRequest &&request,
212 std::unique_ptr<google::protobuf::Arena> &&,
213 const proto::collector::metrics::v1::ExportMetricsServiceRequest &,
214 proto::collector::metrics::v1::ExportMetricsServiceResponse *)>
215 &&result_callback) noexcept;
227 proto::collector::logs::v1::LogsService::StubInterface *stub,
228 std::unique_ptr<grpc::ClientContext> &&
context,
229 std::unique_ptr<google::protobuf::Arena> &&arena,
230 proto::collector::logs::v1::ExportLogsServiceRequest &&request,
232 std::unique_ptr<google::protobuf::Arena> &&,
233 const proto::collector::logs::v1::ExportLogsServiceRequest &,
234 proto::collector::logs::v1::ExportLogsServiceResponse *)>
235 &&result_callback) noexcept;
250 std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept;
258 std::atomic<bool> is_shutdown_;
261 std::shared_ptr<OtlpGrpcClientAsyncData> async_data_;