Skip to content
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

Synchronized calls to Exporter::Export & Shutdown #1164

Conversation

esigo
Copy link
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

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
@@ -39,7 +40,7 @@ std::unique_ptr<trace_sdk::Recordable> JaegerExporter::MakeRecordable() noexcept
sdk_common::ExportResult JaegerExporter::Export(
const nostd::span<std::unique_ptr<sdk::trace::Recordable>> &spans) noexcept
{
if (is_shutdown_)
if (isShutdown())
Copy link
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
Member Author

Choose a reason for hiding this comment

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

done

@@ -5,6 +5,7 @@

#include <opentelemetry/ext/http/client/http_client.h>
#include <opentelemetry/sdk/trace/exporter.h>
#include "opentelemetry/common/spin_lock_mutex.h"
Copy link
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
Member Author

Choose a reason for hiding this comment

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

done

{
OTEL_INTERNAL_LOG_ERROR("[Jaeger Trace Exporter] Export failed, exporter is shutdown");
Copy link
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
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

@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