Skip to content

Commit ad722f4

Browse files
committed
Make OtlpGrpcClientReferenceGuard always available
1 parent cd80d19 commit ad722f4

File tree

8 files changed

+4
-30
lines changed

8 files changed

+4
-30
lines changed

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_factory.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ namespace exporter
1414
namespace otlp
1515
{
1616

17-
#ifdef ENABLE_ASYNC_EXPORT
1817
class OtlpGrpcClientReferenceGuard;
19-
#endif
2018
class OtlpGrpcClient;
2119

2220
/**
@@ -30,9 +28,7 @@ class OPENTELEMETRY_EXPORT OtlpGrpcClientFactory
3028
*/
3129
static nostd::shared_ptr<OtlpGrpcClient> Create(const OtlpGrpcClientOptions &options);
3230

33-
#ifdef ENABLE_ASYNC_EXPORT
3431
static nostd::shared_ptr<OtlpGrpcClientReferenceGuard> CreateReferenceGuard();
35-
#endif
3632
};
3733

3834
} // namespace otlp

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ namespace exporter
2828
namespace otlp
2929
{
3030

31-
#ifdef ENABLE_ASYNC_EXPORT
3231
class OtlpGrpcClientReferenceGuard;
33-
#endif
32+
3433
class OtlpGrpcClient;
3534

3635
/**
@@ -44,7 +43,6 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter
4443
*/
4544
OtlpGrpcExporter();
4645

47-
#ifdef ENABLE_ASYNC_EXPORT
4846
/**
4947
* Create an OtlpGrpcExporter using specified OtlpGrpcClient.
5048
*
@@ -53,7 +51,6 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter
5351
*/
5452
OtlpGrpcExporter(const OtlpGrpcExporterOptions &options,
5553
nostd::shared_ptr<OtlpGrpcClient> client);
56-
#endif
5754

5855
/**
5956
* Create an OtlpGrpcExporter using the given options.
@@ -120,7 +117,6 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter
120117
*/
121118
OtlpGrpcExporter(std::unique_ptr<proto::collector::trace::v1::TraceService::StubInterface> stub);
122119

123-
#ifdef ENABLE_ASYNC_EXPORT
124120
/**
125121
* Create an OtlpGrpcExporter using the specified service stub and gRPC client.
126122
* Only tests can call this constructor directly.
@@ -129,7 +125,6 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter
129125
*/
130126
OtlpGrpcExporter(std::unique_ptr<proto::collector::trace::v1::TraceService::StubInterface> stub,
131127
nostd::shared_ptr<OtlpGrpcClient> client);
132-
#endif
133128

134129
std::atomic<bool> is_shutdown_{false};
135130
bool isShutdown() const noexcept;

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ namespace exporter
2626
namespace otlp
2727
{
2828

29-
#ifdef ENABLE_ASYNC_EXPORT
3029
class OtlpGrpcClientReferenceGuard;
31-
#endif
30+
3231
class OtlpGrpcClient;
3332

3433
/**
@@ -42,7 +41,6 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo
4241
*/
4342
OtlpGrpcLogRecordExporter();
4443

45-
#ifdef ENABLE_ASYNC_EXPORT
4644
/**
4745
* Create an OtlpGrpcLogRecordExporter using specified OtlpGrpcClient.
4846
*
@@ -51,7 +49,6 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo
5149
*/
5250
OtlpGrpcLogRecordExporter(const OtlpGrpcLogRecordExporterOptions &options,
5351
nostd::shared_ptr<OtlpGrpcClient> client);
54-
#endif
5552

5653
/**
5754
* Create an OtlpGrpcLogRecordExporter with user specified options.
@@ -118,7 +115,7 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo
118115
*/
119116
OtlpGrpcLogRecordExporter(
120117
std::unique_ptr<proto::collector::logs::v1::LogsService::StubInterface> stub);
121-
#ifdef ENABLE_ASYNC_EXPORT
118+
122119
/**
123120
* Create an OtlpGrpcLogRecordExporter using the specified service stub and gRPC client.
124121
* Only tests can call this constructor directly.
@@ -128,7 +125,6 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo
128125
OtlpGrpcLogRecordExporter(
129126
std::unique_ptr<proto::collector::logs::v1::LogsService::StubInterface> stub,
130127
nostd::shared_ptr<OtlpGrpcClient> client);
131-
#endif
132128

133129
std::atomic<bool> is_shutdown_{false};
134130
bool isShutdown() const noexcept;

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ namespace exporter
2626
namespace otlp
2727
{
2828

29-
#ifdef ENABLE_ASYNC_EXPORT
3029
class OtlpGrpcClientReferenceGuard;
31-
#endif
3230
class OtlpGrpcClient;
3331

3432
/**
@@ -42,7 +40,6 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp
4240
*/
4341
OtlpGrpcMetricExporter();
4442

45-
#ifdef ENABLE_ASYNC_EXPORT
4643
/**
4744
* Create an OtlpGrpcMetricExporter using specified OtlpGrpcClient.
4845
*
@@ -51,7 +48,6 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp
5148
*/
5249
OtlpGrpcMetricExporter(const OtlpGrpcMetricExporterOptions &options,
5350
nostd::shared_ptr<OtlpGrpcClient> client);
54-
#endif
5551

5652
/**
5753
* Create an OtlpGrpcMetricExporter using the given options.
@@ -108,7 +104,7 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp
108104
*/
109105
OtlpGrpcMetricExporter(
110106
std::unique_ptr<proto::collector::metrics::v1::MetricsService::StubInterface> stub);
111-
#ifdef ENABLE_ASYNC_EXPORT
107+
112108
/**
113109
* Create an OtlpGrpcMetricExporter using the specified service stub and gRPC client.
114110
* Only tests can call this constructor directly.
@@ -118,7 +114,6 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp
118114
OtlpGrpcMetricExporter(
119115
std::unique_ptr<proto::collector::metrics::v1::MetricsService::StubInterface> stub,
120116
nostd::shared_ptr<OtlpGrpcClient> client);
121-
#endif
122117

123118
std::atomic<bool> is_shutdown_{false};
124119
bool isShutdown() const noexcept;

exporters/otlp/src/otlp_grpc_client_factory.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ nostd::shared_ptr<OtlpGrpcClient> OtlpGrpcClientFactory::Create(
1818
return nostd::shared_ptr<OtlpGrpcClient>(new OtlpGrpcClient(options));
1919
}
2020

21-
#ifdef ENABLE_ASYNC_EXPORT
2221
nostd::shared_ptr<OtlpGrpcClientReferenceGuard> OtlpGrpcClientFactory::CreateReferenceGuard()
2322
{
2423
return nostd::shared_ptr<OtlpGrpcClientReferenceGuard>(new OtlpGrpcClientReferenceGuard());
2524
}
26-
#endif
2725

2826
} // namespace otlp
2927
} // namespace exporter

exporters/otlp/src/otlp_grpc_exporter.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ OtlpGrpcExporter::OtlpGrpcExporter(
4242
client_->AddReference(*client_reference_guard_, options_);
4343
}
4444

45-
#ifdef ENABLE_ASYNC_EXPORT
4645
OtlpGrpcExporter::OtlpGrpcExporter(const OtlpGrpcExporterOptions &options,
4746
nostd::shared_ptr<OtlpGrpcClient> client)
4847
: options_(options),
@@ -64,7 +63,6 @@ OtlpGrpcExporter::OtlpGrpcExporter(
6463
{
6564
client_->AddReference(*client_reference_guard_, options_);
6665
}
67-
#endif
6866

6967
OtlpGrpcExporter::~OtlpGrpcExporter()
7068
{

exporters/otlp/src/otlp_grpc_log_record_exporter.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter(
5555
client_->AddReference(*client_reference_guard_, options_);
5656
}
5757

58-
#ifdef ENABLE_ASYNC_EXPORT
5958
OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter(
6059
const OtlpGrpcLogRecordExporterOptions &options,
6160
nostd::shared_ptr<OtlpGrpcClient> client)
@@ -78,7 +77,6 @@ OtlpGrpcLogRecordExporter::OtlpGrpcLogRecordExporter(
7877
{
7978
client_->AddReference(*client_reference_guard_, options_);
8079
}
81-
#endif
8280

8381
OtlpGrpcLogRecordExporter::~OtlpGrpcLogRecordExporter()
8482
{

exporters/otlp/src/otlp_grpc_metric_exporter.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ OtlpGrpcMetricExporter::OtlpGrpcMetricExporter(
4747
client_->AddReference(*client_reference_guard_, options_);
4848
}
4949

50-
#ifdef ENABLE_ASYNC_EXPORT
5150
OtlpGrpcMetricExporter::OtlpGrpcMetricExporter(const OtlpGrpcMetricExporterOptions &options,
5251
nostd::shared_ptr<OtlpGrpcClient> client)
5352
: options_(options),
@@ -69,7 +68,6 @@ OtlpGrpcMetricExporter::OtlpGrpcMetricExporter(
6968
{
7069
client_->AddReference(*client_reference_guard_, options_);
7170
}
72-
#endif
7371

7472
OtlpGrpcMetricExporter::~OtlpGrpcMetricExporter()
7573
{

0 commit comments

Comments
 (0)