Skip to content

Commit

Permalink
Fix several compiling/linking errors (#1539)
Browse files Browse the repository at this point in the history
Signed-off-by: owentou <owentou@tencent.com>
  • Loading branch information
owent authored Aug 3, 2022
1 parent 90fd291 commit b4d8245
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

1 comment on commit b4d8245

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: b4d8245 Previous: 90fd291 Ratio
BM_AlwaysOnSamplerConstruction 3.7847947593726374 ns/iter 1.6295519990535758 ns/iter 2.32
BM_RandomIdGeneration 6.147035004592915 ns/iter 2.5098369925273785 ns/iter 2.45
BM_BaselineBuffer/2 6552922.72567749 ns/iter 3100739.2406463623 ns/iter 2.11
BM_LockFreeBuffer/2 3318618.325626149 ns/iter 1362228.1551361084 ns/iter 2.44

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.