Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions docs/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ There are
- Internal dependencies as the part of code from external libraries
backported/copied in main repo.

The minimum required versions of the third-party libraries that are required can
be found in the [third_party_minimum](/install/cmake/third_party_minimum) file.
The minimum supported versions are listed here for convenience but the
authoritative source is always the linked file.

Both these dependencies are listed here:

## Internal dependencies
Expand Down Expand Up @@ -37,8 +42,8 @@ Both these dependencies are listed here:

- [OTLP/HTTP+JSON](/exporters/otlp)
exporter:
- [protobuf](https://github.com/protocolbuffers/protobuf): Library to
serialize structured data.
- [protobuf](https://github.com/protocolbuffers/protobuf) (v3.21.6 or later):
Library to serialize structured data.
- OTLP messages are constructed as protobuf payloads.
- `protoc` compiler is used to generate C++ stubs for proto files provided
by `opentelemetry-proto`.
Expand All @@ -48,18 +53,19 @@ Both these dependencies are listed here:
[here](https://github.com/protocolbuffers/protobuf/blob/master/LICENSE).
The code generated by protoc compiler is owned by the owner of `.proto`
file.
- [libcurl](https://curl.se/libcurl/) : the multiprotocol file transfer
library.
- [libcurl](https://curl.se/libcurl/) (curl-7_81_0 or later):
the multiprotocol file transfer library.
- Export connects with opentelemetry collector over HTTP protocol using
libcurl library
- License: Inspired by `MIT/X` but not same.
<https://curl.se/docs/copyright.html>
- [nlohmann/json](https://github.com/nlohmann/json): JSON for Modern C++.
- [nlohmann/json](https://github.com/nlohmann/json) (v3.10.5 or later):
JSON for Modern C++.
- protobuf serialized otlp messages are encoded in JSON format using this
library.
- License: `MIT License`
- [zlib](https://www.zlib.net/): A Massively Spiffy Yet Delicately
Unobtrusive Compression Library.
- [zlib](https://www.zlib.net/) (v1.2.11 or later):
A Massively Spiffy Yet Delicately Unobtrusive Compression Library.
- The `http_client` utilizes zlib to compress the message body and send
it in gzip format.
- License: The library is licensed
Expand All @@ -68,7 +74,7 @@ Both these dependencies are listed here:
- [OTLP/gRPC](/exporters/otlp)
exporter:
- `protobuf` OTLP messages are constructed as protobuf payloads.
- [gRPC](https://github.com/grpc/grpc): An RPC library and framework
- [gRPC](https://github.com/grpc/grpc) (v1.49.2 or later): An RPC library and framework
- Exporter communicates with OTLP collector using gRPC transport mechanism.
- License: `Apache License 2.0`

Expand All @@ -84,8 +90,8 @@ Both these dependencies are listed here:

- [Prometheus](/exporters/prometheus)
exporter:
- [`prometheus-cpp`](https://github.com/jupp0r/prometheus-cpp) Prometheus
Client Library for Modern C++
- [`prometheus-cpp`](https://github.com/jupp0r/prometheus-cpp)
(v1.1.0 or later): Prometheus Client Library for Modern C++
- License: `MIT License`

- [ElasticSearch](/exporters/elasticsearch)
Expand All @@ -96,6 +102,6 @@ Both these dependencies are listed here:
- [Opentracing](/opentracing-shim)
shim:
- [`opentracing-cpp`](https://github.com/opentracing/opentracing-cpp)
OpenTracing API for C++
(v1.6.0 or later): OpenTracing API for C++
- A bridge layer implementing the OpenTracing API using the OpenTelemetry API
- License: `Apache License 2.0`
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ class HttpOperation
std::promise<CURLcode> result_promise;
std::future<CURLcode> result_future;
};
friend class HttpOperationAccessor;
std::unique_ptr<AsyncData> async_data_;
};
} // namespace curl
Expand Down
30 changes: 26 additions & 4 deletions ext/src/http/client/curl/http_operation_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,28 @@ namespace client
namespace curl
{

class HttpOperationAccessor
{
public:
OPENTELEMETRY_SANITIZER_NO_THREAD static std::thread::id GetThreadId(
const HttpOperation::AsyncData &async_data)
{
#if !(defined(OPENTELEMETRY_HAVE_THREAD_SANITIZER) && OPENTELEMETRY_HAVE_THREAD_SANITIZER)
std::atomic_thread_fence(std::memory_order_acquire);
#endif
return async_data.callback_thread;
}

OPENTELEMETRY_SANITIZER_NO_THREAD static void SetThreadId(HttpOperation::AsyncData &async_data,
std::thread::id thread_id)
{
async_data.callback_thread = thread_id;
#if !(defined(OPENTELEMETRY_HAVE_THREAD_SANITIZER) && OPENTELEMETRY_HAVE_THREAD_SANITIZER)
std::atomic_thread_fence(std::memory_order_release);
#endif
}
};

size_t HttpOperation::WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
HttpOperation *self = reinterpret_cast<HttpOperation *>(userp);
Expand Down Expand Up @@ -335,7 +357,7 @@ HttpOperation::~HttpOperation()
case opentelemetry::ext::http::client::SessionState::Sending: {
if (async_data_ && async_data_->result_future.valid())
{
if (async_data_->callback_thread != std::this_thread::get_id())
if (HttpOperationAccessor::GetThreadId(*async_data_) != std::this_thread::get_id())
{
async_data_->result_future.wait();
last_curl_result_ = async_data_->result_future.get();
Expand All @@ -360,7 +382,7 @@ void HttpOperation::Finish()
if (async_data_ && async_data_->result_future.valid())
{
// We should not wait in callback from Cleanup()
if (async_data_->callback_thread != std::this_thread::get_id())
if (HttpOperationAccessor::GetThreadId(*async_data_) != std::this_thread::get_id())
{
async_data_->result_future.wait();
last_curl_result_ = async_data_->result_future.get();
Expand Down Expand Up @@ -412,9 +434,9 @@ void HttpOperation::Cleanup()
callback.swap(async_data_->callback);
if (callback)
{
async_data_->callback_thread = std::this_thread::get_id();
HttpOperationAccessor::SetThreadId(*async_data_, std::this_thread::get_id());
callback(*this);
async_data_->callback_thread = std::thread::id();
HttpOperationAccessor::SetThreadId(*async_data_, std::thread::id());
}

// Set value to promise to continue Finish()
Expand Down
2 changes: 2 additions & 0 deletions install/cmake/third_party_minimum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Minimum supported version git tags of third-party dependencies
# Format: <dependency_name>=<release_git_tag>

# Update docs/dependencies.md whenever the minimum version of a library is modified.

abseil=20220623.2
zlib=v1.2.11
curl=curl-7_81_0
Expand Down
Loading