Skip to content

Commit

Permalink
Fix several compiling/linking errors
Browse files Browse the repository at this point in the history
Signed-off-by: owentou <owentou@tencent.com>
  • Loading branch information
owent committed Aug 2, 2022
1 parent 3af512e commit 32d84f4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# include "nlohmann/json.hpp"
# include "opentelemetry/common/spin_lock_mutex.h"
# include "opentelemetry/ext/http/client/curl/http_client_curl.h"
# include "opentelemetry/ext/http/client/http_client_factory.h"
# include "opentelemetry/nostd/type_traits.h"
# include "opentelemetry/sdk/logs/exporter.h"
# include "opentelemetry/sdk/logs/log_record.h"
Expand Down Expand Up @@ -104,7 +104,7 @@ class ElasticsearchLogExporter final : public opentelemetry::sdk::logs::LogExpor
ElasticsearchExporterOptions options_;

// Object that stores the HTTP sessions that have been created
std::unique_ptr<ext::http::client::HttpClient> http_client_;
std::shared_ptr<ext::http::client::HttpClient> http_client_;
mutable opentelemetry::common::SpinLockMutex lock_;
bool isShutdown() const noexcept;
};
Expand Down
5 changes: 3 additions & 2 deletions exporters/elasticsearch/src/es_log_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# include <sstream> // std::stringstream

# include <condition_variable>
# include <mutex>
# include "opentelemetry/exporters/elasticsearch/es_log_exporter.h"
# include "opentelemetry/exporters/elasticsearch/es_log_recordable.h"
Expand Down Expand Up @@ -225,11 +226,11 @@ class AsyncResponseHandler : public http_client::EventHandler

ElasticsearchLogExporter::ElasticsearchLogExporter()
: options_{ElasticsearchExporterOptions()},
http_client_{new ext::http::client::curl::HttpClient()}
http_client_{ext::http::client::HttpClientFactory::Create()}
{}

ElasticsearchLogExporter::ElasticsearchLogExporter(const ElasticsearchExporterOptions &options)
: options_{options}, http_client_{new ext::http::client::curl::HttpClient()}
: options_{options}, http_client_{ext::http::client::HttpClientFactory::Create()}
{}

std::unique_ptr<sdklogs::Recordable> ElasticsearchLogExporter::MakeRecordable() noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class OtlpHttpClient
event_handle.swap(input_handle);
}

inline explicit HttpSessionData(HttpSessionData &&other)
inline HttpSessionData(HttpSessionData &&other)
{
session.swap(other.session);
event_handle.swap(other.event_handle);
Expand Down
19 changes: 19 additions & 0 deletions exporters/otlp/src/otlp_grpc_metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ opentelemetry::sdk::common::ExportResult OtlpGrpcMetricExporter::Export(
return opentelemetry::sdk::common::ExportResult::kSuccess;
}

bool OtlpGrpcMetricExporter::ForceFlush(std::chrono::microseconds timeout) noexcept
{
// TODO: OTLP gRPC exporter does not support concurrency exporting now.
return true;
}

bool OtlpGrpcMetricExporter::Shutdown(std::chrono::microseconds timeout) noexcept
{
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
is_shutdown_ = true;
return true;
}

bool OtlpGrpcMetricExporter::isShutdown() const noexcept
{
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
return is_shutdown_;
}

} // namespace otlp
} // namespace exporter
OPENTELEMETRY_END_NAMESPACE
Expand Down
3 changes: 2 additions & 1 deletion exporters/prometheus/src/collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void PrometheusCollector::AddMetricData(const sdk::metrics::ResourceMetrics &dat
collection_lock_.lock();
if (metrics_to_collect_.size() + 1 <= max_collection_size_)
{
metrics_to_collect_.emplace_back(new sdk::metrics::ResourceMetrics{data});
// We can not use initializer lists here due to broken variadic capture on GCC 4.8.5
metrics_to_collect_.emplace_back(new sdk::metrics::ResourceMetrics(data));
}
collection_lock_.unlock();
}
Expand Down

0 comments on commit 32d84f4

Please sign in to comment.