Skip to content

Commit 5c5f9b7

Browse files
committed
Add changelog, fix compiling problems without async
1 parent 213e3cf commit 5c5f9b7

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Increment the:
2121
* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY`
2222
[#2717](https://github.com/open-telemetry/opentelemetry-cpp/pull/2717)
2323

24+
* [EXPORTER] Allow to share gRPC clients between OTLP exporters.
25+
[#3041](https://github.com/open-telemetry/opentelemetry-cpp/pull/3041)
26+
2427
Breaking changes:
2528

2629
* [REMOVAL] Remove build option `WITH_DEPRECATED_SDK_FACTORY`

exporters/otlp/src/otlp_grpc_exporter.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ std::unique_ptr<sdk::trace::Recordable> OtlpGrpcExporter::MakeRecordable() noexc
9494
sdk::common::ExportResult OtlpGrpcExporter::Export(
9595
const nostd::span<std::unique_ptr<sdk::trace::Recordable>> &spans) noexcept
9696
{
97+
#ifdef ENABLE_ASYNC_EXPORT
9798
nostd::shared_ptr<OtlpGrpcClient> client = client_;
9899
if (isShutdown() || !client)
100+
#else
101+
if (isShutdown())
102+
#endif
99103
{
100104
OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC] Exporting " << spans.size()
101105
<< " span(s) failed, exporter is shutdown");

exporters/otlp/src/otlp_grpc_log_record_exporter.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,12 @@ OtlpGrpcLogRecordExporter::MakeRecordable() noexcept
108108
opentelemetry::sdk::common::ExportResult OtlpGrpcLogRecordExporter::Export(
109109
const nostd::span<std::unique_ptr<opentelemetry::sdk::logs::Recordable>> &logs) noexcept
110110
{
111+
#ifdef ENABLE_ASYNC_EXPORT
111112
nostd::shared_ptr<OtlpGrpcClient> client = client_;
112113
if (isShutdown() || !client)
114+
#else
115+
if (isShutdown())
116+
#endif
113117
{
114118
OTEL_INTERNAL_LOG_ERROR("[OTLP gRPC log] Exporting " << logs.size()
115119
<< " log(s) failed, exporter is shutdown");

exporters/otlp/src/otlp_grpc_metric_exporter.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ sdk::metrics::AggregationTemporality OtlpGrpcMetricExporter::GetAggregationTempo
9898
opentelemetry::sdk::common::ExportResult OtlpGrpcMetricExporter::Export(
9999
const opentelemetry::sdk::metrics::ResourceMetrics &data) noexcept
100100
{
101+
#ifdef ENABLE_ASYNC_EXPORT
101102
nostd::shared_ptr<OtlpGrpcClient> client = client_;
102103
if (isShutdown() || !client)
104+
#else
105+
if (isShutdown())
106+
#endif
103107
{
104108
OTEL_INTERNAL_LOG_ERROR("[OTLP METRICS gRPC] Exporting "
105109
<< data.scope_metric_data_.size()

0 commit comments

Comments
 (0)