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
4 changes: 2 additions & 2 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
matrix:
include:
- cmake_options: all-options-abiv1-preview
warning_limit: 86
warning_limit: 62
- cmake_options: all-options-abiv2-preview
warning_limit: 86
warning_limit: 62
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ Increment the:
[#3496](https://github.com/open-telemetry/opentelemetry-cpp/pull/3496)

* [CodeHealth] Fix clang-tidy warnings part 3
[#3496](https://github.com/open-telemetry/opentelemetry-cpp/pull/3498)
[#3498](https://github.com/open-telemetry/opentelemetry-cpp/pull/3498)

* [CodeHealth] Fix clang-tidy warnings part 4
[#3501](https://github.com/open-telemetry/opentelemetry-cpp/pull/3501)

Important changes:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class OtlpFileClient
OtlpFileClientRuntimeOptions &&runtime_options);

~OtlpFileClient();
OtlpFileClient(const OtlpFileClient &) = delete;
OtlpFileClient &operator=(const OtlpFileClient &) = delete;
OtlpFileClient(OtlpFileClient &&) = delete;
OtlpFileClient &operator=(OtlpFileClient &&) = delete;

/**
* Sync export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct OtlpFileClientFileSystemOptions
// Maximum file count
std::size_t rotate_size = 3;

inline OtlpFileClientFileSystemOptions() noexcept {}
OtlpFileClientFileSystemOptions() = default;
};

/**
Expand All @@ -77,7 +77,12 @@ struct OtlpFileClientFileSystemOptions
class OtlpFileAppender
{
public:
virtual ~OtlpFileAppender() = default;
OtlpFileAppender() = default;
virtual ~OtlpFileAppender() = default;
OtlpFileAppender(const OtlpFileAppender &) = default;
OtlpFileAppender &operator=(const OtlpFileAppender &) = default;
OtlpFileAppender(OtlpFileAppender &&) = default;
OtlpFileAppender &operator=(OtlpFileAppender &&) = default;

virtual void Export(opentelemetry::nostd::string_view data, std::size_t record_count) = 0;

Expand All @@ -96,12 +101,17 @@ using OtlpFileClientBackendOptions =
*/
struct OtlpFileClientOptions
{
OtlpFileClientOptions() = default;
virtual ~OtlpFileClientOptions() = default;
OtlpFileClientOptions(const OtlpFileClientOptions &) = default;
OtlpFileClientOptions &operator=(const OtlpFileClientOptions &) = default;
OtlpFileClientOptions(OtlpFileClientOptions &&) = default;
OtlpFileClientOptions &operator=(OtlpFileClientOptions &&) = default;

// Whether to print the status of the FILE client in the console
bool console_debug = false;

OtlpFileClientBackendOptions backend_options;

inline OtlpFileClientOptions() noexcept {}
};
} // namespace otlp
} // namespace exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ namespace otlp
*/
struct OtlpFileClientRuntimeOptions
{
OtlpFileClientRuntimeOptions() = default;
virtual ~OtlpFileClientRuntimeOptions() = default;
OtlpFileClientRuntimeOptions(const OtlpFileClientRuntimeOptions &) = default;
OtlpFileClientRuntimeOptions &operator=(const OtlpFileClientRuntimeOptions &) = default;
OtlpFileClientRuntimeOptions(OtlpFileClientRuntimeOptions &&) = default;
OtlpFileClientRuntimeOptions &operator=(OtlpFileClientRuntimeOptions &&) = default;

std::shared_ptr<sdk::common::ThreadInstrumentation> thread_instrumentation =
std::shared_ptr<sdk::common::ThreadInstrumentation>(nullptr);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class OPENTELEMETRY_EXPORT OtlpFileExporter final : public opentelemetry::sdk::t

private:
// The configuration options associated with this exporter.
const OtlpFileExporterOptions options_;
OtlpFileExporterOptions options_;
// The runtime options associated with this exporter.
const OtlpFileExporterRuntimeOptions runtime_options_;
OtlpFileExporterRuntimeOptions runtime_options_;

// Object that stores the file context.
std::unique_ptr<OtlpFileClient> file_client_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace otlp
struct OPENTELEMETRY_EXPORT OtlpFileExporterOptions : public OtlpFileClientOptions
{
OtlpFileExporterOptions();
~OtlpFileExporterOptions();
};

} // namespace otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ namespace otlp
*/
struct OPENTELEMETRY_EXPORT OtlpFileExporterRuntimeOptions : public OtlpFileClientRuntimeOptions
{
OtlpFileExporterRuntimeOptions() = default;
~OtlpFileExporterRuntimeOptions() = default;
OtlpFileExporterRuntimeOptions() = default;
};

} // namespace otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class OtlpFileLogRecordExporter final : public opentelemetry::sdk::logs::LogReco

private:
// Configuration options for the exporter
const OtlpFileLogRecordExporterOptions options_;
OtlpFileLogRecordExporterOptions options_;
// Runtime options for the exporter
const OtlpFileLogRecordExporterRuntimeOptions runtime_options_;
OtlpFileLogRecordExporterRuntimeOptions runtime_options_;

// Object that stores the file context.
std::unique_ptr<OtlpFileClient> file_client_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace otlp
struct OPENTELEMETRY_EXPORT OtlpFileLogRecordExporterOptions : public OtlpFileClientOptions
{
OtlpFileLogRecordExporterOptions();
~OtlpFileLogRecordExporterOptions();
};

} // namespace otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ namespace otlp
struct OPENTELEMETRY_EXPORT OtlpFileLogRecordExporterRuntimeOptions
: public OtlpFileClientRuntimeOptions
{
OtlpFileLogRecordExporterRuntimeOptions() = default;
~OtlpFileLogRecordExporterRuntimeOptions() = default;
OtlpFileLogRecordExporterRuntimeOptions() = default;
};

} // namespace otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class OtlpFileMetricExporter final : public opentelemetry::sdk::metrics::PushMet
friend class OtlpFileMetricExporterTestPeer;

// Configuration options for the exporter
const OtlpFileMetricExporterOptions options_;
OtlpFileMetricExporterOptions options_;
// Runtime options for the exporter
const OtlpFileMetricExporterRuntimeOptions runtime_options_;
OtlpFileMetricExporterRuntimeOptions runtime_options_;

// Aggregation Temporality Selector
const sdk::metrics::AggregationTemporalitySelector aggregation_temporality_selector_;
sdk::metrics::AggregationTemporalitySelector aggregation_temporality_selector_;

// Object that stores the file context.
std::unique_ptr<OtlpFileClient> file_client_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace otlp
struct OPENTELEMETRY_EXPORT OtlpFileMetricExporterOptions : public OtlpFileClientOptions
{
OtlpFileMetricExporterOptions();
~OtlpFileMetricExporterOptions();

PreferredAggregationTemporality aggregation_temporality;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ namespace otlp
struct OPENTELEMETRY_EXPORT OtlpFileMetricExporterRuntimeOptions
: public OtlpFileClientRuntimeOptions
{
OtlpFileMetricExporterRuntimeOptions() = default;
~OtlpFileMetricExporterRuntimeOptions() = default;
OtlpFileMetricExporterRuntimeOptions() = default;
};

} // namespace otlp
Expand Down
2 changes: 0 additions & 2 deletions exporters/otlp/src/otlp_file_exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ OtlpFileExporterOptions::OtlpFileExporterOptions()
backend_options = fs_options;
}

OtlpFileExporterOptions::~OtlpFileExporterOptions() {}

} // namespace otlp
} // namespace exporter
OPENTELEMETRY_END_NAMESPACE
2 changes: 0 additions & 2 deletions exporters/otlp/src/otlp_file_log_record_exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ OtlpFileLogRecordExporterOptions::OtlpFileLogRecordExporterOptions()
backend_options = fs_options;
}

OtlpFileLogRecordExporterOptions::~OtlpFileLogRecordExporterOptions() {}

} // namespace otlp
} // namespace exporter
OPENTELEMETRY_END_NAMESPACE
5 changes: 3 additions & 2 deletions exporters/otlp/src/otlp_file_metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ OtlpFileMetricExporter::OtlpFileMetricExporter(
runtime_options_(runtime_options),
aggregation_temporality_selector_{
OtlpMetricUtils::ChooseTemporalitySelector(options_.aggregation_temporality)},
file_client_(new OtlpFileClient(OtlpFileClientOptions(options),
OtlpFileClientRuntimeOptions(runtime_options)))
file_client_(new OtlpFileClient(
OtlpFileClientOptions(static_cast<const OtlpFileClientOptions &>(options)),
OtlpFileClientRuntimeOptions(runtime_options)))
{}

// ----------------------------- Exporter methods ------------------------------
Expand Down
2 changes: 0 additions & 2 deletions exporters/otlp/src/otlp_file_metric_exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ OtlpFileMetricExporterOptions::OtlpFileMetricExporterOptions()
backend_options = fs_options;
}

OtlpFileMetricExporterOptions::~OtlpFileMetricExporterOptions() {}

} // namespace otlp
} // namespace exporter
OPENTELEMETRY_END_NAMESPACE
11 changes: 5 additions & 6 deletions exporters/otlp/src/otlp_http_exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ OtlpHttpExporterOptions::OtlpHttpExporterOptions()
console_debug(false),
timeout(GetOtlpDefaultTracesTimeout()),
http_headers(GetOtlpDefaultTracesHeaders()),
#ifdef ENABLE_ASYNC_EXPORT
max_concurrent_requests{64},
max_requests_per_connection{8},
#endif
ssl_insecure_skip_verify(false),
ssl_ca_cert_path(GetOtlpDefaultTracesSslCertificatePath()),
ssl_ca_cert_string(GetOtlpDefaultTracesSslCertificateString()),
Expand All @@ -37,12 +41,7 @@ OtlpHttpExporterOptions::OtlpHttpExporterOptions()
retry_policy_initial_backoff(GetOtlpDefaultTracesRetryInitialBackoff()),
retry_policy_max_backoff(GetOtlpDefaultTracesRetryMaxBackoff()),
retry_policy_backoff_multiplier(GetOtlpDefaultTracesRetryBackoffMultiplier())
{
#ifdef ENABLE_ASYNC_EXPORT
max_concurrent_requests = 64;
max_requests_per_connection = 8;
#endif /* ENABLE_ASYNC_EXPORT */
}
{}

OtlpHttpExporterOptions::~OtlpHttpExporterOptions() {}

Expand Down
11 changes: 5 additions & 6 deletions exporters/otlp/src/otlp_http_log_record_exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions()
console_debug(false),
timeout(GetOtlpDefaultLogsTimeout()),
http_headers(GetOtlpDefaultLogsHeaders()),
#ifdef ENABLE_ASYNC_EXPORT
max_concurrent_requests{64},
max_requests_per_connection{8},
#endif
ssl_insecure_skip_verify(false),
ssl_ca_cert_path(GetOtlpDefaultLogsSslCertificatePath()),
ssl_ca_cert_string(GetOtlpDefaultLogsSslCertificateString()),
Expand All @@ -37,12 +41,7 @@ OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions()
retry_policy_initial_backoff(GetOtlpDefaultLogsRetryInitialBackoff()),
retry_policy_max_backoff(GetOtlpDefaultLogsRetryMaxBackoff()),
retry_policy_backoff_multiplier(GetOtlpDefaultLogsRetryBackoffMultiplier())
{
#ifdef ENABLE_ASYNC_EXPORT
max_concurrent_requests = 64;
max_requests_per_connection = 8;
#endif
}
{}

OtlpHttpLogRecordExporterOptions::~OtlpHttpLogRecordExporterOptions() {}

Expand Down
11 changes: 5 additions & 6 deletions exporters/otlp/src/otlp_http_metric_exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ OtlpHttpMetricExporterOptions::OtlpHttpMetricExporterOptions()
timeout(GetOtlpDefaultMetricsTimeout()),
http_headers(GetOtlpDefaultMetricsHeaders()),
aggregation_temporality(PreferredAggregationTemporality::kCumulative),
#ifdef ENABLE_ASYNC_EXPORT
max_concurrent_requests{64},
max_requests_per_connection{8},
#endif
ssl_insecure_skip_verify(false),
ssl_ca_cert_path(GetOtlpDefaultMetricsSslCertificatePath()),
ssl_ca_cert_string(GetOtlpDefaultMetricsSslCertificateString()),
Expand All @@ -39,12 +43,7 @@ OtlpHttpMetricExporterOptions::OtlpHttpMetricExporterOptions()
retry_policy_initial_backoff(GetOtlpDefaultMetricsRetryInitialBackoff()),
retry_policy_max_backoff(GetOtlpDefaultMetricsRetryMaxBackoff()),
retry_policy_backoff_multiplier(GetOtlpDefaultMetricsRetryBackoffMultiplier())
{
#ifdef ENABLE_ASYNC_EXPORT
max_concurrent_requests = 64;
max_requests_per_connection = 8;
#endif
}
{}

OtlpHttpMetricExporterOptions::~OtlpHttpMetricExporterOptions() {}

Expand Down
11 changes: 10 additions & 1 deletion ext/src/http/client/curl/http_operation_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ std::chrono::system_clock::time_point HttpOperation::NextRetryTime()
# define HAVE_TLS_VERSION
#endif

// NOLINTNEXTLINE(google-runtime-int)
static long parse_min_ssl_version(const std::string &version)
{
#ifdef HAVE_TLS_VERSION
Expand All @@ -532,6 +533,7 @@ static long parse_min_ssl_version(const std::string &version)
return 0;
}

// NOLINTNEXTLINE(google-runtime-int)
static long parse_max_ssl_version(const std::string &version)
{
#ifdef HAVE_TLS_VERSION
Expand Down Expand Up @@ -591,6 +593,7 @@ CURLcode HttpOperation::SetCurlPtrOption(CURLoption option, void *value)
return rc;
}

// NOLINTNEXTLINE(google-runtime-int)
CURLcode HttpOperation::SetCurlLongOption(CURLoption option, long value)
{
CURLcode rc;
Expand Down Expand Up @@ -877,8 +880,10 @@ CURLcode HttpOperation::Setup()

#ifdef HAVE_TLS_VERSION
/* By default, TLSv1.2 or better is required (if we have TLS). */
// NOLINTNEXTLINE(google-runtime-int)
long min_ssl_version = CURL_SSLVERSION_TLSv1_2;
#else
// NOLINTNEXTLINE(google-runtime-int)
long min_ssl_version = 0;
#endif

Expand All @@ -903,6 +908,7 @@ CURLcode HttpOperation::Setup()
* The CURL + openssl library may be more recent than this code,
* and support a version we do not know about.
*/
// NOLINTNEXTLINE(google-runtime-int)
long max_ssl_version = 0;

if (!ssl_options_.ssl_max_tls.empty())
Expand All @@ -921,6 +927,7 @@ CURLcode HttpOperation::Setup()
#endif
}

// NOLINTNEXTLINE(google-runtime-int)
long version_range = min_ssl_version | max_ssl_version;
if (version_range != 0)
{
Expand Down Expand Up @@ -967,6 +974,7 @@ CURLcode HttpOperation::Setup()
if (ssl_options_.ssl_insecure_skip_verify)
{
/* 6 - DO NOT ENFORCE VERIFICATION, This is not secure. */
// NOLINTNEXTLINE(google-runtime-int)
rc = SetCurlLongOption(CURLOPT_USE_SSL, static_cast<long>(CURLUSESSL_NONE));
if (rc != CURLE_OK)
{
Expand All @@ -988,6 +996,7 @@ CURLcode HttpOperation::Setup()
else
{
/* 6 - ENFORCE VERIFICATION */
// NOLINTNEXTLINE(google-runtime-int)
rc = SetCurlLongOption(CURLOPT_USE_SSL, static_cast<long>(CURLUSESSL_ALL));
if (rc != CURLE_OK)
{
Expand Down Expand Up @@ -1042,7 +1051,7 @@ CURLcode HttpOperation::Setup()

// TODO: control local port to use
// curl_easy_setopt(curl, CURLOPT_LOCALPORT, dcf_port);

// NOLINTNEXTLINE(google-runtime-int)
rc = SetCurlLongOption(CURLOPT_TIMEOUT_MS, static_cast<long>(http_conn_timeout_.count()));
if (rc != CURLE_OK)
{
Expand Down
2 changes: 1 addition & 1 deletion ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/string_view.h"

#define HTTP_PORT 19000
constexpr int HTTP_PORT{19000};

namespace curl = opentelemetry::ext::http::client::curl;
namespace http_client = opentelemetry::ext::http::client;
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/data/point_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class HistogramPointData
HistogramPointData &operator=(HistogramPointData &&) = default;
HistogramPointData(const HistogramPointData &) = default;
HistogramPointData() = default;
HistogramPointData(std::vector<double> &boundaries) : boundaries_(boundaries) {}
HistogramPointData(const std::vector<double> &boundaries) : boundaries_(boundaries) {}
HistogramPointData &operator=(const HistogramPointData &other) = default;
~HistogramPointData() = default;

Expand Down
Loading
Loading