Skip to content

Commit 762b73d

Browse files
authored
[SDK] Tracer provider shutdown blocks in-definitively (#3191)
1 parent 6218a24 commit 762b73d

File tree

13 files changed

+23
-19
lines changed

13 files changed

+23
-19
lines changed

exporters/memory/include/opentelemetry/exporters/memory/in_memory_span_exporter.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ class InMemorySpanExporter final : public opentelemetry::sdk::trace::SpanExporte
7575
return sdk::common::ExportResult::kSuccess;
7676
}
7777

78+
virtual bool ForceFlush(std::chrono::microseconds /* timeout */) noexcept override
79+
{
80+
return true;
81+
}
82+
7883
/**
7984
* @param timeout an optional value containing the timeout of the exporter
8085
* note: passing custom timeout values is not currently supported for this exporter

sdk/include/opentelemetry/sdk/logs/exporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class OPENTELEMETRY_EXPORT LogRecordExporter
5151
* Force flush the log records pushed into this log exporter.
5252
*/
5353
virtual bool ForceFlush(
54-
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
54+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
5555

5656
/**
5757
* Marks the exporter as ShutDown and cleans up any resources as required.

sdk/include/opentelemetry/sdk/logs/logger_provider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class OPENTELEMETRY_EXPORT LoggerProvider final : public opentelemetry::logs::Lo
9393
/**
9494
* Shutdown the log processor associated with this log provider.
9595
*/
96-
bool Shutdown() noexcept;
96+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
9797

9898
/**
9999
* Force flush the log processor associated with this log provider.

sdk/include/opentelemetry/sdk/metrics/meter_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class MeterContext : public std::enable_shared_from_this<MeterContext>
147147
/**
148148
* Shutdown the Collectors associated with this meter provider.
149149
*/
150-
bool Shutdown() noexcept;
150+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
151151

152152
private:
153153
opentelemetry::sdk::resource::Resource resource_;

sdk/include/opentelemetry/sdk/metrics/meter_provider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class OPENTELEMETRY_EXPORT MeterProvider final : public opentelemetry::metrics::
110110
/**
111111
* Shutdown the meter provider.
112112
*/
113-
bool Shutdown() noexcept;
113+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
114114

115115
/**
116116
* Force flush the meter provider.

sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class PushMetricExporter
5353
* @return return the status of the operation.
5454
*/
5555
virtual bool Shutdown(
56-
std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept = 0;
56+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
5757
};
5858
} // namespace metrics
5959
} // namespace sdk

sdk/include/opentelemetry/sdk/trace/exporter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ class OPENTELEMETRY_EXPORT SpanExporter
4848

4949
/**
5050
* Export all spans that have been exported.
51-
* @param timeout an optional timeout, the default timeout of 0 means that no
51+
* @param timeout an optional timeout, the default timeout means that no
5252
* timeout is applied.
5353
* @return return true when all data are exported, and false when timeout
5454
*/
5555
virtual bool ForceFlush(
56-
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
56+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
5757

5858
/**
5959
* Shut down the exporter.

sdk/include/opentelemetry/sdk/trace/processor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class OPENTELEMETRY_EXPORT SpanProcessor
5656

5757
/**
5858
* Export all ended spans that have not yet been exported.
59-
* @param timeout an optional timeout, the default timeout of 0 means that no
59+
* @param timeout an optional timeout, the default timeout means that no
6060
* timeout is applied.
6161
*/
6262
virtual bool ForceFlush(
@@ -67,7 +67,7 @@ class OPENTELEMETRY_EXPORT SpanProcessor
6767
* exported before shutdown. After the call to Shutdown, subsequent calls to
6868
* OnStart, OnEnd, ForceFlush or Shutdown will return immediately without
6969
* doing anything.
70-
* @param timeout an optional timeout, the default timeout of 0 means that no
70+
* @param timeout an optional timeout, the default timeout means that no
7171
* timeout is applied.
7272
*/
7373
virtual bool Shutdown(

sdk/include/opentelemetry/sdk/trace/tracer_provider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T
101101
/**
102102
* Shutdown the span processor associated with this tracer provider.
103103
*/
104-
bool Shutdown() noexcept;
104+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
105105

106106
/**
107107
* Force flush the span processor associated with this tracer provider.

sdk/src/logs/logger_provider.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ const opentelemetry::sdk::resource::Resource &LoggerProvider::GetResource() cons
118118
return context_->GetResource();
119119
}
120120

121-
bool LoggerProvider::Shutdown() noexcept
121+
bool LoggerProvider::Shutdown(std::chrono::microseconds timeout) noexcept
122122
{
123-
return context_->Shutdown();
123+
return context_->Shutdown(timeout);
124124
}
125125

126126
bool LoggerProvider::ForceFlush(std::chrono::microseconds timeout) noexcept

0 commit comments

Comments
 (0)