Skip to content

Synchronized calls to Exporter::Export & Shutdown#1164

Merged
ThomsonTan merged 10 commits intoopen-telemetry:mainfrom
esigo:Synchronized-calls-to-Exporter-Export-and-Exporter-Shutdown
Jan 5, 2022
Merged

Synchronized calls to Exporter::Export & Shutdown#1164
ThomsonTan merged 10 commits intoopen-telemetry:mainfrom
esigo:Synchronized-calls-to-Exporter-Export-and-Exporter-Shutdown

Conversation

@esigo
Copy link
Copy Markdown
Member

@esigo esigo commented Dec 23, 2021

Fixes #1158 (issue)

Changes

Protects is_shutdown_ read and writes using opentelemetry::common::SpinLockMutex.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 23, 2021

Codecov Report

Merging #1164 (f68e537) into main (1f0bf83) will decrease coverage by 0.01%.
The diff coverage is 93.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1164      +/-   ##
==========================================
- Coverage   93.29%   93.29%   -0.00%     
==========================================
  Files         174      174              
  Lines        6391     6402      +11     
==========================================
+ Hits         5962     5972      +10     
- Misses        429      430       +1     
Impacted Files Coverage Δ
...de/opentelemetry/exporters/ostream/span_exporter.h 100.00% <ø> (ø)
...lemetry/exporters/memory/in_memory_span_exporter.h 91.31% <83.34%> (-3.14%) ⬇️
exporters/ostream/src/span_exporter.cc 90.82% <100.00%> (+0.50%) ⬆️
exporters/ostream/test/ostream_span_test.cc 100.00% <100.00%> (ø)

@esigo esigo marked this pull request as ready for review January 3, 2022 15:48
@esigo esigo requested a review from a team January 3, 2022 15:48
const nostd::span<std::unique_ptr<sdk::trace::Recordable>> &spans) noexcept
{
if (is_shutdown_)
if (isShutdown())
Copy link
Copy Markdown
Member

@lalitb lalitb Jan 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - not directly related to this PR, but while you are changing this piece of code, could you also add error logging wherever missing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


#include <opentelemetry/ext/http/client/http_client.h>
#include <opentelemetry/sdk/trace/exporter.h>
#include "opentelemetry/common/spin_lock_mutex.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use #include <> for consistency?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread exporters/jaeger/src/jaeger_exporter.cc Outdated
if (is_shutdown_)
if (isShutdown())
{
OTEL_INTERNAL_LOG_ERROR("[Jaeger Trace Exporter] Export failed, exporter is shutdown");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log the size of span to imply how many spans are lost?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added where possible

Comment thread exporters/jaeger/src/jaeger_exporter.cc Outdated
@ThomsonTan ThomsonTan merged commit 1688c7c into open-telemetry:main Jan 5, 2022
@esigo esigo deleted the Synchronized-calls-to-Exporter-Export-and-Exporter-Shutdown branch January 5, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Synchronized calls to Exporter::Export and Exporter::Shutdown.

3 participants