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: 109
warning_limit: 86
- cmake_options: all-options-abiv2-preview
warning_limit: 109
warning_limit: 86
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ Increment the:
* [CodeHealth] Fix clang-tidy warnings part 2
[#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)

Important changes:

* [REMOVAL] Removed deprecated semantic convention header files
Expand Down
6 changes: 2 additions & 4 deletions api/test/context/propagation/composite_propagator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ class CompositePropagatorTest : public ::testing::Test
propogator_list.push_back(std::move(b3_propogator));

composite_propagator_ =
new context::propagation::CompositePropagator(std::move(propogator_list));
std::make_shared<context::propagation::CompositePropagator>(std::move(propogator_list));
}

~CompositePropagatorTest() override { delete composite_propagator_; }

protected:
context::propagation::CompositePropagator *composite_propagator_;
std::shared_ptr<context::propagation::CompositePropagator> composite_propagator_;
};

TEST_F(CompositePropagatorTest, Extract)
Expand Down
16 changes: 12 additions & 4 deletions api/test/nostd/shared_ptr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class A

~A() { destructed_ = true; }

A(const A &) = delete;
A(A &&) = delete;
A &operator=(const A &) = delete;
A &operator=(A &&) = delete;

private:
bool &destructed_;
};
Expand All @@ -33,13 +38,16 @@ class C
{
public:
virtual ~C() {}
C() = default;

C(const C &) = delete;
C(C &&) = delete;
C &operator=(const C &) = delete;
C &operator=(C &&) = delete;
};

class D : public C
{
public:
~D() override {}
};
{};

TEST(SharedPtrTest, DefaultConstruction)
{
Expand Down
5 changes: 5 additions & 0 deletions api/test/nostd/unique_ptr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class A

~A() { destructed_ = true; }

A(const A &) = delete;
A(A &&) = delete;
A &operator=(const A &) = delete;
A &operator=(A &&) = delete;

private:
bool &destructed_;
};
Expand Down
5 changes: 5 additions & 0 deletions api/test/nostd/variant_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class DestroyCounter
explicit DestroyCounter(int *count) : count_{count} {}
~DestroyCounter() { ++*count_; }

DestroyCounter(const DestroyCounter &) = default;
DestroyCounter &operator=(const DestroyCounter &) = default;
DestroyCounter(DestroyCounter &&) = default;
DestroyCounter &operator=(DestroyCounter &&) = default;

private:
int *count_;
};
Expand Down
1 change: 0 additions & 1 deletion examples/otlp/http_instrumented_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class MyThreadInstrumentation : public opentelemetry::sdk::common::ThreadInstrum
const std::string &priority)
: thread_name_(thread_name), network_name_(network_name), priority_(priority)
{}
~MyThreadInstrumentation() override = default;

void OnStart() override
{
Expand Down
5 changes: 5 additions & 0 deletions examples/plugin/plugin/tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class Span final : public trace::Span

~Span() override { std::cout << "~Span\n"; }

Span(const Span &) = delete;
Span &operator=(const Span &) = delete;
Span(Span &&) = delete;
Span &operator=(Span &&) = delete;

// opentelemetry::trace::Span
void SetAttribute(nostd::string_view /*name*/,
const common::AttributeValue & /*value*/) noexcept override
Expand Down
5 changes: 5 additions & 0 deletions exporters/elasticsearch/src/es_log_record_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ class AsyncResponseHandler : public http_client::EventHandler
console_debug_{console_debug}
{}

AsyncResponseHandler(const AsyncResponseHandler &) = delete;
AsyncResponseHandler &operator=(const AsyncResponseHandler &) = delete;
AsyncResponseHandler(AsyncResponseHandler &&) = delete;
AsyncResponseHandler &operator=(AsyncResponseHandler &&) = delete;

/**
* Cleans up the session in the destructor.
*/
Expand Down
11 changes: 7 additions & 4 deletions exporters/otlp/src/otlp_grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpGrpcAsyncCallDataBase
opentelemetry::sdk::common::ExportResult::kFailure;
GrpcAsyncCallback grpc_async_callback = nullptr;

OtlpGrpcAsyncCallDataBase() {}
virtual ~OtlpGrpcAsyncCallDataBase() {}
OtlpGrpcAsyncCallDataBase() = default;
virtual ~OtlpGrpcAsyncCallDataBase() = default;
OtlpGrpcAsyncCallDataBase(const OtlpGrpcAsyncCallDataBase &) = delete;
OtlpGrpcAsyncCallDataBase &operator=(const OtlpGrpcAsyncCallDataBase &) = delete;
OtlpGrpcAsyncCallDataBase(OtlpGrpcAsyncCallDataBase &&) = delete;
OtlpGrpcAsyncCallDataBase &operator=(OtlpGrpcAsyncCallDataBase &&) = delete;
};

// When building with -fvisibility=default, we hide the symbols and vtable to ensure we always use
Expand All @@ -90,8 +94,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpGrpcAsyncCallData : public OtlpGrpcAsyncCal
ResponseType *)>
result_callback;

OtlpGrpcAsyncCallData() {}
~OtlpGrpcAsyncCallData() override {}
OtlpGrpcAsyncCallData() = default;
};
} // namespace
#endif
Expand Down
6 changes: 5 additions & 1 deletion exporters/otlp/test/otlp_file_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ namespace resource = opentelemetry::sdk::resource;
class ProtobufGlobalSymbolGuard
{
public:
ProtobufGlobalSymbolGuard() {}
ProtobufGlobalSymbolGuard() = default;
~ProtobufGlobalSymbolGuard() { google::protobuf::ShutdownProtobufLibrary(); }
ProtobufGlobalSymbolGuard(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard &operator=(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard(ProtobufGlobalSymbolGuard &&) = delete;
ProtobufGlobalSymbolGuard &operator=(ProtobufGlobalSymbolGuard &&) = delete;
};

static std::tm GetLocalTime(std::chrono::system_clock::time_point tp)
Expand Down
6 changes: 5 additions & 1 deletion exporters/otlp/test/otlp_file_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ namespace resource = opentelemetry::sdk::resource;
class ProtobufGlobalSymbolGuard
{
public:
ProtobufGlobalSymbolGuard() {}
ProtobufGlobalSymbolGuard() = default;
~ProtobufGlobalSymbolGuard() { google::protobuf::ShutdownProtobufLibrary(); }
ProtobufGlobalSymbolGuard(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard &operator=(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard(ProtobufGlobalSymbolGuard &&) = delete;
ProtobufGlobalSymbolGuard &operator=(ProtobufGlobalSymbolGuard &&) = delete;
};

template <class T, size_t N>
Expand Down
6 changes: 5 additions & 1 deletion exporters/otlp/test/otlp_file_log_record_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ namespace otlp
class ProtobufGlobalSymbolGuard
{
public:
ProtobufGlobalSymbolGuard() {}
ProtobufGlobalSymbolGuard() = default;
~ProtobufGlobalSymbolGuard() { google::protobuf::ShutdownProtobufLibrary(); }
ProtobufGlobalSymbolGuard(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard &operator=(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard(ProtobufGlobalSymbolGuard &&) = delete;
ProtobufGlobalSymbolGuard &operator=(ProtobufGlobalSymbolGuard &&) = delete;
};

template <class T, size_t N>
Expand Down
6 changes: 5 additions & 1 deletion exporters/otlp/test/otlp_file_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ namespace otlp
class ProtobufGlobalSymbolGuard
{
public:
ProtobufGlobalSymbolGuard() {}
ProtobufGlobalSymbolGuard() = default;
~ProtobufGlobalSymbolGuard() { google::protobuf::ShutdownProtobufLibrary(); }
ProtobufGlobalSymbolGuard(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard &operator=(const ProtobufGlobalSymbolGuard &) = delete;
ProtobufGlobalSymbolGuard(ProtobufGlobalSymbolGuard &&) = delete;
ProtobufGlobalSymbolGuard &operator=(ProtobufGlobalSymbolGuard &&) = delete;
};

template <class IntegerType>
Expand Down
2 changes: 0 additions & 2 deletions exporters/otlp/test/otlp_grpc_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class OtlpMockTraceServiceStub : public proto::collector::trace::v1::MockTraceSe
public:
async_interface(OtlpMockTraceServiceStub *owner) : stub_(owner) {}

virtual ~async_interface() override = default;

void Export(
::grpc::ClientContext *context,
const ::opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest *request,
Expand Down
4 changes: 0 additions & 4 deletions exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ class OtlpMockTraceServiceStub : public proto::collector::trace::v1::MockTraceSe
public:
async_interface(OtlpMockTraceServiceStub *owner) : stub_(owner) {}

~async_interface() override = default;

void Export(
::grpc::ClientContext *context,
const ::opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest *request,
Expand Down Expand Up @@ -188,8 +186,6 @@ class OtlpMockLogsServiceStub : public proto::collector::logs::v1::MockLogsServi
public:
async_interface(OtlpMockLogsServiceStub *owner) : stub_(owner) {}

~async_interface() override = default;

void Export(
::grpc::ClientContext *context,
const ::opentelemetry::proto::collector::logs::v1::ExportLogsServiceRequest *request,
Expand Down
1 change: 0 additions & 1 deletion exporters/otlp/test/otlp_metrics_serialization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "opentelemetry/exporters/otlp/otlp_metric_utils.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/nostd/variant.h"
#include "opentelemetry/sdk/common/attribute_utils.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/metrics/data/circular_buffer.h"
Expand Down
4 changes: 0 additions & 4 deletions ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class CustomEventHandler : public http_client::EventHandler

CustomEventHandler() : is_called_(false), got_response_(false) {}

~CustomEventHandler() override = default;

std::atomic<bool> is_called_;
std::atomic<bool> got_response_;
};
Expand Down Expand Up @@ -700,8 +698,6 @@ TEST_F(BasicCurlHttpTests, BackgroundThreadWaitMore)
#ifdef ENABLE_OTLP_COMPRESSION_PREVIEW
struct GzipEventHandler : public CustomEventHandler
{
~GzipEventHandler() override = default;

void OnResponse(http_client::Response & /* response */) noexcept override {}

void OnEvent(http_client::SessionState state, nostd::string_view reason) noexcept override
Expand Down
5 changes: 5 additions & 0 deletions sdk/include/opentelemetry/sdk/common/global_log_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ inline std::string LevelToString(LogLevel level)
class LogHandler
{
public:
LogHandler() = default;
virtual ~LogHandler();
LogHandler(const LogHandler &) = default;
LogHandler(LogHandler &&) = default;
LogHandler &operator=(const LogHandler &) = default;
LogHandler &operator=(LogHandler &&) = default;

virtual void Handle(LogLevel level,
const char *file,
Expand Down
23 changes: 15 additions & 8 deletions sdk/include/opentelemetry/sdk/metrics/data/point_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class SumPointData
{
public:
// TODO: remove ctors and initializers when GCC<5 stops shipping on Ubuntu
SumPointData(SumPointData &&) = default;
SumPointData(const SumPointData &) = default;
SumPointData &operator=(SumPointData &&) = default;
SumPointData() = default;
SumPointData(SumPointData &&) = default;
SumPointData(const SumPointData &) = default;
SumPointData &operator=(SumPointData &&) = default;
SumPointData() = default;
SumPointData &operator=(const SumPointData &other) = default;
~SumPointData() = default;

ValueType value_ = {};
bool is_monotonic_ = true;
Expand All @@ -38,10 +40,12 @@ class LastValuePointData
{
public:
// TODO: remove ctors and initializers when GCC<5 stops shipping on Ubuntu
LastValuePointData(LastValuePointData &&) = default;
LastValuePointData(const LastValuePointData &) = default;
LastValuePointData &operator=(LastValuePointData &&) = default;
LastValuePointData() = default;
LastValuePointData(LastValuePointData &&) = default;
LastValuePointData(const LastValuePointData &) = default;
LastValuePointData &operator=(LastValuePointData &&) = default;
LastValuePointData() = default;
LastValuePointData &operator=(const LastValuePointData &other) = default;
~LastValuePointData() = default;

ValueType value_ = {};
bool is_lastvalue_valid_ = {};
Expand All @@ -57,6 +61,9 @@ class HistogramPointData
HistogramPointData(const HistogramPointData &) = default;
HistogramPointData() = default;
HistogramPointData(std::vector<double> &boundaries) : boundaries_(boundaries) {}
HistogramPointData &operator=(const HistogramPointData &other) = default;
~HistogramPointData() = default;

std::vector<double> boundaries_ = {};
ValueType sum_ = {};
ValueType min_ = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ static GlobalLogHandlerChecker &ConstructChecker()
class CustomLogHandler : public opentelemetry::sdk::common::internal_log::LogHandler
{
public:
CustomLogHandler() = default;
CustomLogHandler(const CustomLogHandler &) = default;
CustomLogHandler(CustomLogHandler &&) = default;
CustomLogHandler &operator=(const CustomLogHandler &) = default;
CustomLogHandler &operator=(CustomLogHandler &&) = default;

~CustomLogHandler() override
{
GlobalLogHandlerChecker::custom_handler_destroyed = true;
Expand Down
3 changes: 1 addition & 2 deletions sdk/test/metrics/meter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ class MeterCreateInstrumentTest : public ::testing::Test
class TestProcessor : public sdk::metrics::AttributesProcessor
{
public:
explicit TestProcessor() = default;
~TestProcessor() override = default;
explicit TestProcessor() = default;

sdk::metrics::MetricAttributes process(
const opentelemetry::common::KeyValueIterable &attributes) const noexcept override
Expand Down
Loading