-
Notifications
You must be signed in to change notification settings - Fork 558
Reorder the destructor of members in LoggerProvider and TracerProvider #1245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
560e0a0
4b0f856
6470fb6
0322126
f9b1b3a
ee91478
bcf6aa0
67963f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,9 +67,10 @@ class Logger final : public opentelemetry::logs::Logger | |
| // The name of this logger | ||
| std::string logger_name_; | ||
|
|
||
| // The logger context of this Logger. Uses a weak_ptr to avoid cyclic dependency issues the with | ||
| std::weak_ptr<LoggerContext> context_; | ||
| // order of declaration is important here - instrumentation library should destroy after | ||
| // logger-context. | ||
| std::unique_ptr<instrumentationlibrary::InstrumentationLibrary> instrumentation_library_; | ||
| std::shared_ptr<LoggerContext> context_; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is cyclic dependency still an issue here as it changes
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no cyclic dependency right now.It's only be hold in |
||
| }; | ||
|
|
||
| } // namespace logs | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,11 +180,17 @@ void BatchSpanProcessor::DrainQueue() | |
|
|
||
| bool BatchSpanProcessor::Shutdown(std::chrono::microseconds timeout) noexcept | ||
| { | ||
| is_shutdown_.store(true); | ||
| std::lock_guard<std::mutex> shutdown_guard{shutdown_m_}; | ||
| bool already_shutdown = is_shutdown_.exchange(true); | ||
|
|
||
| cv_.notify_one(); | ||
| worker_thread_.join(); | ||
| if (exporter_ != nullptr) | ||
| if (worker_thread_.joinable()) | ||
| { | ||
| cv_.notify_one(); | ||
| worker_thread_.join(); | ||
| } | ||
|
|
||
| // Should only shutdown exporter ONCE. | ||
| if (!already_shutdown && exporter_ != nullptr) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is showing down is going, later call to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes and thanks, it's definitely a problem.I add a mutex lock to prevent this. |
||
| { | ||
| return exporter_->Shutdown(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.