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: 172
warning_limit: 109
- cmake_options: all-options-abiv2-preview
warning_limit: 173
warning_limit: 109
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 @@ -33,6 +33,9 @@ Increment the:
* [CodeHealth] Fix clang-tidy warnings part 1
[#3493](https://github.com/open-telemetry/opentelemetry-cpp/pull/3493)

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

Important changes:

* [REMOVAL] Removed deprecated semantic convention header files
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,25 @@ doc](https://docs.google.com/document/d/1i1E4-_y4uJ083lCutKGDhkpi3n4_e774SBLi9hP
For edit access, get in touch on
[Slack](https://cloud-native.slack.com/archives/C01N3AT62SJ).

[Maintainers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer)
([@open-telemetry/cpp-maintainers](https://github.com/orgs/open-telemetry/teams/cpp-maintainers)):
### Maintainers

* [Ehsan Saei](https://github.com/esigo)
* [Lalit Kumar Bhasin](https://github.com/lalitb), Microsoft
* [Marc Alff](https://github.com/marcalff), Oracle
* [Tom Tan](https://github.com/ThomsonTan), Microsoft

[Approvers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver)
([@open-telemetry/cpp-approvers](https://github.com/orgs/open-telemetry/teams/cpp-approvers)):
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).

### Approvers

* [Doug Barker](https://github.com/dbarker)
* [Josh Suereth](https://github.com/jsuereth), Google
* [Pranav Sharma](https://github.com/psx95), Google
* [WenTao Ou](https://github.com/owent), Tencent

[Emeritus
Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager):
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).

### Emeritus Maintainer/Approver/Triager

* [Alolita Sharma](https://github.com/alolita)
* [Emil Mikulic](https://github.com/g-easy)
Expand All @@ -111,6 +112,8 @@ Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/ma
* [Reiley Yang](https://github.com/reyang)
* [Ryan Burn](https://github.com/rnburn)

For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).

### Thanks to all the people who have contributed

[![contributors](https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-cpp)](https://github.com/open-telemetry/opentelemetry-cpp/graphs/contributors)
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/plugin/hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/plugin/factory.h"
#include "opentelemetry/version.h"

#ifdef _WIN32
Expand Down Expand Up @@ -42,7 +43,6 @@ namespace plugin
{

struct LoaderInfo;
class FactoryImpl;

using OpenTelemetryHook =
nostd::unique_ptr<Factory::FactoryImpl> (*)(const LoaderInfo &loader_info,
Expand Down
6 changes: 5 additions & 1 deletion api/test/logs/logger_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ class TestLogger : public Logger

using Logger::EmitLogRecord;

void EmitLogRecord(nostd::unique_ptr<opentelemetry::logs::LogRecord> &&) noexcept override {}
void EmitLogRecord(
nostd::unique_ptr<opentelemetry::logs::LogRecord> &&log_record) noexcept override
{
auto log_record_ptr = std::move(log_record);
}
};

// Define a basic LoggerProvider class that returns an instance of the logger class defined above
Expand Down
2 changes: 1 addition & 1 deletion examples/multi_processor/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::shared_ptr<InMemorySpanData> InitTracer()
trace_sdk::TracerProviderFactory::Create(std::move(processors));

// Set the global trace provider
trace_sdk::Provider::SetTracerProvider(std::move(provider));
trace_sdk::Provider::SetTracerProvider(provider);

return data;
}
Expand Down
21 changes: 10 additions & 11 deletions examples/otlp/http_instrumented_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,46 +103,45 @@ class MyThreadInstrumentation : public opentelemetry::sdk::common::ThreadInstrum
{
std::cout << ", priority " << priority_;
}
std::cout << std::endl << std::flush;
std::cout << "\n" << std::flush;
}

void OnEnd() override
{
std::lock_guard<std::mutex> lock_guard(serialize);
std::cout << "OnEnd() thread " << thread_name_ << ", id " << std::this_thread::get_id()
<< std::endl
std::cout << "OnEnd() thread " << thread_name_ << ", id " << std::this_thread::get_id() << "\n"
<< std::flush;
}

void BeforeWait() override
{
std::lock_guard<std::mutex> lock_guard(serialize);
std::cout << "BeforeWait() thread " << thread_name_ << ", id " << std::this_thread::get_id()
<< ", waiting" << std::endl
<< ", waiting\n"
<< std::flush;
}

void AfterWait() override
{
std::lock_guard<std::mutex> lock_guard(serialize);
std::cout << "AfterWait() thread " << thread_name_ << ", id " << std::this_thread::get_id()
<< ", done waiting" << std::endl
<< ", done waiting\n"
<< std::flush;
}

void BeforeLoad() override
{
std::lock_guard<std::mutex> lock_guard(serialize);
std::cout << "BeforeLoad() thread " << thread_name_ << ", id " << std::this_thread::get_id()
<< ", about to work" << std::endl
<< ", about to work\n"
<< std::flush;
}

void AfterLoad() override
{
std::lock_guard<std::mutex> lock_guard(serialize);
std::cout << "AfterLoad() thread " << thread_name_ << ", id " << std::this_thread::get_id()
<< ", done working" << std::endl
<< ", done working\n"
<< std::flush;
}

Expand Down Expand Up @@ -341,25 +340,25 @@ int main(int argc, char *argv[])
logger_opts.url = "http://localhost:4318/v1/logs";
}

std::cout << "Initializing opentelemetry-cpp" << std::endl << std::flush;
std::cout << "Initializing opentelemetry-cpp\n" << std::flush;

InitTracer();
InitMetrics();
InitLogger();

std::cout << "Application payload" << std::endl << std::flush;
std::cout << "Application payload\n" << std::flush;

foo_library();

std::string name{"otlp_http_metric_example"};
foo_library::observable_counter_example(name);

std::cout << "Shutting down opentelemetry-cpp" << std::endl << std::flush;
std::cout << "Shutting down opentelemetry-cpp\n" << std::flush;

CleanupLogger();
CleanupMetrics();
CleanupTracer();

std::cout << "Done" << std::endl << std::flush;
std::cout << "Done\n" << std::flush;
return 0;
}
24 changes: 12 additions & 12 deletions exporters/ostream/test/ostream_log_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ TEST(OstreamLogExporter, DefaultLogRecordToCout)
" severity_text : INVALID\n",
" body : \n",
" resource : \n",
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
" telemetry.sdk.name: opentelemetry\n",
" telemetry.sdk.language: cpp\n",
" attributes : \n",
Expand All @@ -136,7 +136,7 @@ TEST(OstreamLogExporter, DefaultLogRecordToCout)
" trace_flags : 00\n",
" scope : \n",
" name : otel-cpp\n",
" version : " OPENTELEMETRY_SDK_VERSION "\n",
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
" attributes : \n",
" scope.attr.key: scope.attr.value\n",
Expand Down Expand Up @@ -199,7 +199,7 @@ TEST(OStreamLogRecordExporter, SimpleLogToCout)
" severity_text : TRACE\n"
" body : Message\n",
" resource : \n",
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
" telemetry.sdk.name: opentelemetry\n",
" telemetry.sdk.language: cpp\n",
" attributes : \n",
Expand All @@ -210,7 +210,7 @@ TEST(OStreamLogRecordExporter, SimpleLogToCout)
" trace_flags : 00\n",
" scope : \n",
" name : otel-cpp\n",
" version : " OPENTELEMETRY_SDK_VERSION "\n",
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
" attributes : \n",
" scope.attr.key: scope.attr.value\n",
Expand Down Expand Up @@ -270,7 +270,7 @@ TEST(OStreamLogRecordExporter, LogWithStringAttributesToCerr)
" severity_text : INVALID\n",
" body : \n",
" resource : \n",
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
" telemetry.sdk.name: opentelemetry\n",
" telemetry.sdk.language: cpp\n",
" service.name: unknown_service\n",
Expand All @@ -284,7 +284,7 @@ TEST(OStreamLogRecordExporter, LogWithStringAttributesToCerr)
" trace_flags : 00\n",
" scope : \n",
" name : otel-cpp\n",
" version : " OPENTELEMETRY_SDK_VERSION "\n",
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
" attributes : \n",
" scope.attr.key: scope.attr.value\n",
Expand Down Expand Up @@ -352,7 +352,7 @@ TEST(OStreamLogRecordExporter, LogWithVariantTypesToClog)
" body : \n",
" resource : \n",
" service.name: unknown_service\n",
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
" telemetry.sdk.name: opentelemetry\n",
" telemetry.sdk.language: cpp\n",
" res1: [1,2,3]\n",
Expand All @@ -365,7 +365,7 @@ TEST(OStreamLogRecordExporter, LogWithVariantTypesToClog)
" trace_flags : 00\n",
" scope : \n",
" name : otel-cpp\n",
" version : " OPENTELEMETRY_SDK_VERSION "\n",
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
" attributes : \n",
" scope.attr.key: scope.attr.value\n",
Expand Down Expand Up @@ -425,7 +425,7 @@ TEST(OStreamLogRecordExporter, IntegrationTest)
" severity_text : DEBUG\n",
" body : Hello\n",
" resource : \n",
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
" service.name: unknown_service\n",
" telemetry.sdk.name: opentelemetry\n",
" telemetry.sdk.language: cpp\n",
Expand All @@ -437,7 +437,7 @@ TEST(OStreamLogRecordExporter, IntegrationTest)
" trace_flags : 00\n",
" scope : \n",
" name : opentelelemtry_library\n",
" version : " OPENTELEMETRY_SDK_VERSION "\n",
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
" schema_url : https://opentelemetry.io/schemas/1.11.0\n",
" attributes : \n",
" scope.attr.key: 123\n",
Expand Down Expand Up @@ -496,7 +496,7 @@ TEST(OStreamLogRecordExporter, IntegrationTestWithEventId)
" severity_text : DEBUG\n",
" body : Hello {key1} {key2}\n",
" resource : \n",
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
" service.name: unknown_service\n",
" telemetry.sdk.name: opentelemetry\n",
" telemetry.sdk.language: cpp\n",
Expand All @@ -508,7 +508,7 @@ TEST(OStreamLogRecordExporter, IntegrationTestWithEventId)
" trace_flags : 00\n",
" scope : \n",
" name : opentelelemtry_library\n",
" version : " OPENTELEMETRY_SDK_VERSION "\n",
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
" schema_url : https://opentelemetry.io/schemas/1.11.0\n",
" attributes : \n",
" scope.attr.key: 123\n",
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/src/otlp_file_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
{
if (file_pattern[i] == '%')
{
int checked = static_cast<int>(file_pattern[i + 1]);
int checked = static_cast<unsigned char>(file_pattern[i + 1]);
if (checked > 0 && checked < 128 && check_interval[checked] > 0)
{
if (0 == check_file_path_interval_ ||
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/src/otlp_grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpGrpcAsyncCallData : public OtlpGrpcAsyncCal
result_callback;

OtlpGrpcAsyncCallData() {}
virtual ~OtlpGrpcAsyncCallData() {}
~OtlpGrpcAsyncCallData() override {}
};
} // namespace
#endif
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/src/otlp_http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void ConvertListFieldToJson(nlohmann::json &value,
OtlpHttpClient::OtlpHttpClient(OtlpHttpClientOptions &&options)
: is_shutdown_(false),
options_(std::move(options)),
http_client_(http_client::HttpClientFactory::Create(options.thread_instrumentation)),
http_client_(http_client::HttpClientFactory::Create(options_.thread_instrumentation)),
start_session_counter_(0),
finished_session_counter_(0)
{
Expand Down
8 changes: 4 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,7 +125,7 @@ class OtlpMockTraceServiceStub : public proto::collector::trace::v1::MockTraceSe
public:
async_interface(OtlpMockTraceServiceStub *owner) : stub_(owner) {}

virtual ~async_interface() override = default;
~async_interface() override = default;

void Export(
::grpc::ClientContext *context,
Expand Down Expand Up @@ -188,7 +188,7 @@ class OtlpMockLogsServiceStub : public proto::collector::logs::v1::MockLogsServi
public:
async_interface(OtlpMockLogsServiceStub *owner) : stub_(owner) {}

virtual ~async_interface() override = default;
~async_interface() override = default;

void Export(
::grpc::ClientContext *context,
Expand Down Expand Up @@ -255,15 +255,15 @@ class OtlpGrpcLogRecordExporterTestPeer : public ::testing::Test
const std::shared_ptr<OtlpGrpcClient> &client)
{
return std::unique_ptr<sdk::logs::LogRecordExporter>(
new OtlpGrpcLogRecordExporter(std::move(stub_interface), std::move(client)));
new OtlpGrpcLogRecordExporter(std::move(stub_interface), client));
}

std::unique_ptr<sdk::trace::SpanExporter> GetExporter(
std::unique_ptr<proto::collector::trace::v1::TraceService::StubInterface> &stub_interface,
const std::shared_ptr<OtlpGrpcClient> &client)
{
return std::unique_ptr<sdk::trace::SpanExporter>(
new OtlpGrpcExporter(std::move(stub_interface), std::move(client)));
new OtlpGrpcExporter(std::move(stub_interface), client));
}

// Get the options associated with the given exporter.
Expand Down
6 changes: 2 additions & 4 deletions sdk/src/common/global_log_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ namespace
struct GlobalLogHandlerData
{
nostd::shared_ptr<LogHandler> handler;
LogLevel log_level;
LogLevel log_level{LogLevel::Warning};

GlobalLogHandlerData()
: handler(nostd::shared_ptr<LogHandler>(new DefaultLogHandler)), log_level(LogLevel::Warning)
{}
GlobalLogHandlerData() : handler(nostd::shared_ptr<LogHandler>(new DefaultLogHandler)) {}
~GlobalLogHandlerData() { is_singleton_destroyed = true; }

GlobalLogHandlerData(const GlobalLogHandlerData &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/trace/span.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void Span::AddLinks(const opentelemetry::trace::SpanContextKeyValueIterable &lin
return;
}

links.ForEachKeyValue([&](opentelemetry::trace::SpanContext span_context,
links.ForEachKeyValue([&](const opentelemetry::trace::SpanContext &span_context,
const common::KeyValueIterable &attributes) {
recordable_->AddLink(span_context, attributes);
return true;
Expand Down
7 changes: 5 additions & 2 deletions sdk/test/common/circular_buffer_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <memory>
#include <random>
#include <thread>
#include <utility>
#include <vector>
#include "benchmark/benchmark.h"

Expand All @@ -29,8 +30,10 @@ static uint64_t ConsumeBufferNumbers(BaselineCircularBuffer<uint64_t> &buffer) n
{
uint64_t result = 0;
buffer.Consume([&](std::unique_ptr<uint64_t> &&x) {
result += *x;
x.reset();
auto val = std::move(x);

result += *val;
val.reset();
});
return result;
}
Expand Down
Loading
Loading