Skip to content

Commit b89fbde

Browse files
committed
Second pass
1 parent 9375819 commit b89fbde

File tree

23 files changed

+94
-93
lines changed

23 files changed

+94
-93
lines changed

api/include/opentelemetry/metrics/provider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Provider
3838
/**
3939
* Changes the singleton MeterProvider.
4040
*/
41-
static void SetMeterProvider(nostd::shared_ptr<MeterProvider> tp) noexcept
41+
static void SetMeterProvider(const nostd::shared_ptr<MeterProvider>& tp) noexcept
4242
{
4343
std::lock_guard<common::SpinLockMutex> guard(GetLock());
4444
GetProvider() = tp;

api/include/opentelemetry/nostd/internal/absl/types/internal/variant.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ template <class ReturnType, class FunctionObject, std::size_t... BoundIndices>
221221
struct MakeVisitationMatrix<ReturnType, FunctionObject, index_sequence<>,
222222
index_sequence<BoundIndices...>> {
223223
using ResultType = ReturnType (*)(FunctionObject&&);
224+
// cppcheck-suppress [duplInheritedMember]
224225
static constexpr ResultType Run() {
225226
return &call_with_indices<ReturnType, FunctionObject,
226227
(BoundIndices - 1)...>;
@@ -722,6 +723,7 @@ struct VariantCoreAccess {
722723
Self* self, Args&&... args) {
723724
Destroy(*self);
724725
using New = typename absl::variant_alternative<NewIndex, Self>::type;
726+
// cppcheck-suppress [legacyUninitvar]
725727
New* const result = ::new (static_cast<void*>(&self->state_))
726728
New(absl::forward<Args>(args)...);
727729
self->index_ = NewIndex;
@@ -1310,6 +1312,7 @@ class VariantStateBaseDestructorNontrivial : protected VariantStateBase<T...> {
13101312
VariantStateBaseDestructorNontrivial* self;
13111313
};
13121314

1315+
// cppcheck-suppress [duplInheritedMember]
13131316
void destroy() { VisitIndices<sizeof...(T)>::Run(Destroyer{this}, index_); }
13141317

13151318
~VariantStateBaseDestructorNontrivial() { destroy(); }

api/include/opentelemetry/nostd/shared_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class shared_ptr
3737

3838
struct alignas(kAlignment) PlacementBuffer
3939
{
40-
char data[kMaxSize];
40+
char data[kMaxSize]{};
4141
};
4242

4343
class shared_ptr_wrapper

api/include/opentelemetry/plugin/tracer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DynamicLibraryHandle;
2020
class Span final : public trace::Span
2121
{
2222
public:
23-
Span(std::shared_ptr<trace::Tracer> &&tracer, nostd::shared_ptr<trace::Span> span) noexcept
23+
Span(std::shared_ptr<trace::Tracer> &&tracer, const nostd::shared_ptr<trace::Span>& span) noexcept
2424
: tracer_{std::move(tracer)}, span_{span}
2525
{}
2626

examples/http/server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class HttpServer : public HTTP_SERVER_NS::HttpRequestCallback
1919
std::atomic<bool> is_running_{false};
2020

2121
public:
22-
HttpServer(std::string server_name = "test_server", uint16_t port = 8800) : port_(port)
22+
HttpServer(const std::string &server_name = "test_server", uint16_t port = 8800) : port_(port)
2323
{
2424
server_.setServerName(server_name);
2525
server_.setKeepalive(false);
2626
}
2727

28-
void AddHandler(std::string path, HTTP_SERVER_NS::HttpRequestCallback *request_handler)
28+
void AddHandler(const std::string &path, HTTP_SERVER_NS::HttpRequestCallback *request_handler)
2929
{
3030
server_.addHandler(path, *request_handler);
3131
}

exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ struct ElasticsearchExporterOptions
5252
* from elasticsearch
5353
* @param console_debug If true, print the status of the exporter methods in the console
5454
*/
55-
ElasticsearchExporterOptions(std::string host = "localhost",
56-
int port = 9200,
57-
std::string index = "logs",
58-
int response_timeout = 30,
59-
bool console_debug = false,
60-
HttpHeaders http_headers = {})
55+
ElasticsearchExporterOptions(const std::string &host = "localhost",
56+
int port = 9200,
57+
const std::string &index = "logs",
58+
int response_timeout = 30,
59+
bool console_debug = false,
60+
const HttpHeaders &http_headers = {})
6161
: host_{host},
6262
port_{port},
6363
index_{index},

exporters/otlp/src/otlp_http_client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ OtlpHttpClient::createSession(
898898
{
899899
std::cerr << error_message << '\n';
900900
}
901-
OTEL_INTERNAL_LOG_ERROR(error_message.c_str());
901+
OTEL_INTERNAL_LOG_ERROR(error_message);
902902

903903
const auto result = opentelemetry::sdk::common::ExportResult::kFailure;
904904
result_callback(result);

exporters/otlp/src/otlp_http_exporter_options.cc

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,30 @@ namespace otlp
1616
{
1717

1818
OtlpHttpExporterOptions::OtlpHttpExporterOptions()
19-
: json_bytes_mapping(JsonBytesMappingKind::kHexId),
19+
: url(GetOtlpDefaultHttpTracesEndpoint()),
20+
content_type(GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpTracesProtocol())),
21+
json_bytes_mapping(JsonBytesMappingKind::kHexId),
2022
use_json_name(false),
2123
console_debug(false),
22-
ssl_insecure_skip_verify(false)
24+
timeout(GetOtlpDefaultTracesTimeout()),
25+
http_headers(GetOtlpDefaultTracesHeaders()),
26+
ssl_insecure_skip_verify(false),
27+
ssl_ca_cert_path(GetOtlpDefaultTracesSslCertificatePath()),
28+
ssl_ca_cert_string(GetOtlpDefaultTracesSslCertificateString()),
29+
ssl_client_key_path(GetOtlpDefaultTracesSslClientKeyPath()),
30+
ssl_client_key_string(GetOtlpDefaultTracesSslClientKeyString()),
31+
ssl_client_cert_path(GetOtlpDefaultTracesSslClientCertificatePath()),
32+
ssl_client_cert_string(GetOtlpDefaultTracesSslClientCertificateString()),
33+
ssl_min_tls(GetOtlpDefaultTracesSslTlsMinVersion()),
34+
ssl_max_tls(GetOtlpDefaultTracesSslTlsMaxVersion()),
35+
ssl_cipher(GetOtlpDefaultTracesSslTlsCipher()),
36+
ssl_cipher_suite(GetOtlpDefaultTracesSslTlsCipherSuite()),
37+
compression(GetOtlpDefaultTracesCompression())
2338
{
24-
url = GetOtlpDefaultHttpTracesEndpoint();
25-
content_type = GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpTracesProtocol());
26-
27-
timeout = GetOtlpDefaultTracesTimeout();
28-
http_headers = GetOtlpDefaultTracesHeaders();
29-
3039
#ifdef ENABLE_ASYNC_EXPORT
3140
max_concurrent_requests = 64;
3241
max_requests_per_connection = 8;
3342
#endif /* ENABLE_ASYNC_EXPORT */
34-
35-
ssl_ca_cert_path = GetOtlpDefaultTracesSslCertificatePath();
36-
ssl_ca_cert_string = GetOtlpDefaultTracesSslCertificateString();
37-
ssl_client_key_path = GetOtlpDefaultTracesSslClientKeyPath();
38-
ssl_client_key_string = GetOtlpDefaultTracesSslClientKeyString();
39-
ssl_client_cert_path = GetOtlpDefaultTracesSslClientCertificatePath();
40-
ssl_client_cert_string = GetOtlpDefaultTracesSslClientCertificateString();
41-
42-
ssl_min_tls = GetOtlpDefaultTracesSslTlsMinVersion();
43-
ssl_max_tls = GetOtlpDefaultTracesSslTlsMaxVersion();
44-
ssl_cipher = GetOtlpDefaultTracesSslTlsCipher();
45-
ssl_cipher_suite = GetOtlpDefaultTracesSslTlsCipherSuite();
46-
47-
compression = GetOtlpDefaultTracesCompression();
4843
}
4944

5045
OtlpHttpExporterOptions::~OtlpHttpExporterOptions() {}

exporters/otlp/src/otlp_http_log_record_exporter_options.cc

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,30 @@ namespace otlp
1616
{
1717

1818
OtlpHttpLogRecordExporterOptions::OtlpHttpLogRecordExporterOptions()
19-
: json_bytes_mapping(JsonBytesMappingKind::kHexId),
19+
: url(GetOtlpDefaultHttpLogsEndpoint()),
20+
content_type(GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpLogsProtocol())),
21+
json_bytes_mapping(JsonBytesMappingKind::kHexId),
2022
use_json_name(false),
2123
console_debug(false),
22-
ssl_insecure_skip_verify(false)
24+
timeout(GetOtlpDefaultLogsTimeout()),
25+
http_headers(GetOtlpDefaultLogsHeaders()),
26+
ssl_insecure_skip_verify(false),
27+
ssl_ca_cert_path(GetOtlpDefaultLogsSslCertificatePath()),
28+
ssl_ca_cert_string(GetOtlpDefaultLogsSslCertificateString()),
29+
ssl_client_key_path(GetOtlpDefaultLogsSslClientKeyPath()),
30+
ssl_client_key_string(GetOtlpDefaultLogsSslClientKeyString()),
31+
ssl_client_cert_path(GetOtlpDefaultLogsSslClientCertificatePath()),
32+
ssl_client_cert_string(GetOtlpDefaultLogsSslClientCertificateString()),
33+
ssl_min_tls(GetOtlpDefaultLogsSslTlsMinVersion()),
34+
ssl_max_tls(GetOtlpDefaultLogsSslTlsMaxVersion()),
35+
ssl_cipher(GetOtlpDefaultLogsSslTlsCipher()),
36+
ssl_cipher_suite(GetOtlpDefaultLogsSslTlsCipherSuite()),
37+
compression(GetOtlpDefaultLogsCompression())
2338
{
24-
url = GetOtlpDefaultHttpLogsEndpoint();
25-
content_type = GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpLogsProtocol());
26-
27-
timeout = GetOtlpDefaultLogsTimeout();
28-
http_headers = GetOtlpDefaultLogsHeaders();
29-
3039
#ifdef ENABLE_ASYNC_EXPORT
3140
max_concurrent_requests = 64;
3241
max_requests_per_connection = 8;
3342
#endif
34-
35-
ssl_ca_cert_path = GetOtlpDefaultLogsSslCertificatePath();
36-
ssl_ca_cert_string = GetOtlpDefaultLogsSslCertificateString();
37-
ssl_client_key_path = GetOtlpDefaultLogsSslClientKeyPath();
38-
ssl_client_key_string = GetOtlpDefaultLogsSslClientKeyString();
39-
ssl_client_cert_path = GetOtlpDefaultLogsSslClientCertificatePath();
40-
ssl_client_cert_string = GetOtlpDefaultLogsSslClientCertificateString();
41-
42-
ssl_min_tls = GetOtlpDefaultLogsSslTlsMinVersion();
43-
ssl_max_tls = GetOtlpDefaultLogsSslTlsMaxVersion();
44-
ssl_cipher = GetOtlpDefaultLogsSslTlsCipher();
45-
ssl_cipher_suite = GetOtlpDefaultLogsSslTlsCipherSuite();
46-
47-
compression = GetOtlpDefaultLogsCompression();
4843
}
4944

5045
OtlpHttpLogRecordExporterOptions::~OtlpHttpLogRecordExporterOptions() {}

exporters/otlp/src/otlp_http_metric_exporter_options.cc

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,31 @@ namespace otlp
1717
{
1818

1919
OtlpHttpMetricExporterOptions::OtlpHttpMetricExporterOptions()
20-
: json_bytes_mapping(JsonBytesMappingKind::kHexId),
20+
: url(GetOtlpDefaultMetricsEndpoint()),
21+
content_type(GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpMetricsProtocol())),
22+
json_bytes_mapping(JsonBytesMappingKind::kHexId),
2123
use_json_name(false),
2224
console_debug(false),
25+
timeout(GetOtlpDefaultMetricsTimeout()),
26+
http_headers(GetOtlpDefaultMetricsHeaders()),
2327
aggregation_temporality(PreferredAggregationTemporality::kCumulative),
24-
ssl_insecure_skip_verify(false)
28+
ssl_insecure_skip_verify(false),
29+
ssl_ca_cert_path(GetOtlpDefaultMetricsSslCertificatePath()),
30+
ssl_ca_cert_string(GetOtlpDefaultMetricsSslCertificateString()),
31+
ssl_client_key_path(GetOtlpDefaultMetricsSslClientKeyPath()),
32+
ssl_client_key_string(GetOtlpDefaultMetricsSslClientKeyString()),
33+
ssl_client_cert_path(GetOtlpDefaultMetricsSslClientCertificatePath()),
34+
ssl_client_cert_string(GetOtlpDefaultMetricsSslClientCertificateString()),
35+
ssl_min_tls(GetOtlpDefaultMetricsSslTlsMinVersion()),
36+
ssl_max_tls(GetOtlpDefaultMetricsSslTlsMaxVersion()),
37+
ssl_cipher(GetOtlpDefaultMetricsSslTlsCipher()),
38+
ssl_cipher_suite(GetOtlpDefaultMetricsSslTlsCipherSuite()),
39+
compression(GetOtlpDefaultMetricsCompression())
2540
{
26-
url = GetOtlpDefaultMetricsEndpoint();
27-
content_type = GetOtlpHttpProtocolFromString(GetOtlpDefaultHttpMetricsProtocol());
28-
29-
timeout = GetOtlpDefaultMetricsTimeout();
30-
http_headers = GetOtlpDefaultMetricsHeaders();
31-
3241
#ifdef ENABLE_ASYNC_EXPORT
3342
max_concurrent_requests = 64;
3443
max_requests_per_connection = 8;
3544
#endif
36-
37-
ssl_ca_cert_path = GetOtlpDefaultMetricsSslCertificatePath();
38-
ssl_ca_cert_string = GetOtlpDefaultMetricsSslCertificateString();
39-
ssl_client_key_path = GetOtlpDefaultMetricsSslClientKeyPath();
40-
ssl_client_key_string = GetOtlpDefaultMetricsSslClientKeyString();
41-
ssl_client_cert_path = GetOtlpDefaultMetricsSslClientCertificatePath();
42-
ssl_client_cert_string = GetOtlpDefaultMetricsSslClientCertificateString();
43-
44-
ssl_min_tls = GetOtlpDefaultMetricsSslTlsMinVersion();
45-
ssl_max_tls = GetOtlpDefaultMetricsSslTlsMaxVersion();
46-
ssl_cipher = GetOtlpDefaultMetricsSslTlsCipher();
47-
ssl_cipher_suite = GetOtlpDefaultMetricsSslTlsCipherSuite();
48-
49-
compression = GetOtlpDefaultMetricsCompression();
5045
}
5146

5247
OtlpHttpMetricExporterOptions::~OtlpHttpMetricExporterOptions() {}

0 commit comments

Comments
 (0)