Skip to content

Commit 281e744

Browse files
committed
merged from upstream
2 parents d8bc239 + f74d413 commit 281e744

File tree

17 files changed

+85
-69
lines changed

17 files changed

+85
-69
lines changed

.github/workflows/clang-tidy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
include:
1919
- cmake_options: all-options-abiv1-preview
20-
warning_limit: 172
20+
warning_limit: 109
2121
- cmake_options: all-options-abiv2-preview
22-
warning_limit: 173
22+
warning_limit: 109
2323
steps:
2424
- name: Harden the runner (Audit all outbound calls)
2525
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Increment the:
3333
* [CodeHealth] Fix clang-tidy warnings part 1
3434
[#3493](https://github.com/open-telemetry/opentelemetry-cpp/pull/3493)
3535

36+
* [CodeHealth] Fix clang-tidy warnings part 2
37+
[#3496](https://github.com/open-telemetry/opentelemetry-cpp/pull/3496)
38+
3639
Important changes:
3740

3841
* [REMOVAL] Removed deprecated semantic convention header files

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,25 @@ doc](https://docs.google.com/document/d/1i1E4-_y4uJ083lCutKGDhkpi3n4_e774SBLi9hP
8686
For edit access, get in touch on
8787
[Slack](https://cloud-native.slack.com/archives/C01N3AT62SJ).
8888

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

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

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

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

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

108109
* [Alolita Sharma](https://github.com/alolita)
109110
* [Emil Mikulic](https://github.com/g-easy)
@@ -113,6 +114,8 @@ Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/ma
113114
* [Reiley Yang](https://github.com/reyang)
114115
* [Ryan Burn](https://github.com/rnburn)
115116

117+
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).
118+
116119
### Thanks to all the people who have contributed
117120

118121
[![contributors](https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-cpp)](https://github.com/open-telemetry/opentelemetry-cpp/graphs/contributors)

api/include/opentelemetry/plugin/hook.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "opentelemetry/version.h"
77
#include "opentelemetry/nostd/unique_ptr.h"
8+
#include "opentelemetry/plugin/factory.h"
89

910
#ifdef _WIN32
1011

@@ -42,7 +43,6 @@ namespace plugin
4243
{
4344

4445
struct LoaderInfo;
45-
class FactoryImpl;
4646

4747
using OpenTelemetryHook =
4848
nostd::unique_ptr<Factory::FactoryImpl> (*)(const LoaderInfo &loader_info,

api/test/logs/logger_test.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ class TestLogger : public Logger
206206

207207
using Logger::EmitLogRecord;
208208

209-
void EmitLogRecord(nostd::unique_ptr<opentelemetry::logs::LogRecord> &&) noexcept override {}
209+
void EmitLogRecord(
210+
nostd::unique_ptr<opentelemetry::logs::LogRecord> &&log_record) noexcept override
211+
{
212+
auto log_record_ptr = std::move(log_record);
213+
}
210214
};
211215

212216
// Define a basic LoggerProvider class that returns an instance of the logger class defined above

examples/multi_processor/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ std::shared_ptr<InMemorySpanData> InitTracer()
5050
trace_sdk::TracerProviderFactory::Create(std::move(processors));
5151

5252
// Set the global trace provider
53-
trace_sdk::Provider::SetTracerProvider(std::move(provider));
53+
trace_sdk::Provider::SetTracerProvider(provider);
5454

5555
return data;
5656
}

examples/otlp/http_instrumented_main.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,46 +103,45 @@ class MyThreadInstrumentation : public opentelemetry::sdk::common::ThreadInstrum
103103
{
104104
std::cout << ", priority " << priority_;
105105
}
106-
std::cout << std::endl << std::flush;
106+
std::cout << "\n" << std::flush;
107107
}
108108

109109
void OnEnd() override
110110
{
111111
std::lock_guard<std::mutex> lock_guard(serialize);
112-
std::cout << "OnEnd() thread " << thread_name_ << ", id " << std::this_thread::get_id()
113-
<< std::endl
112+
std::cout << "OnEnd() thread " << thread_name_ << ", id " << std::this_thread::get_id() << "\n"
114113
<< std::flush;
115114
}
116115

117116
void BeforeWait() override
118117
{
119118
std::lock_guard<std::mutex> lock_guard(serialize);
120119
std::cout << "BeforeWait() thread " << thread_name_ << ", id " << std::this_thread::get_id()
121-
<< ", waiting" << std::endl
120+
<< ", waiting\n"
122121
<< std::flush;
123122
}
124123

125124
void AfterWait() override
126125
{
127126
std::lock_guard<std::mutex> lock_guard(serialize);
128127
std::cout << "AfterWait() thread " << thread_name_ << ", id " << std::this_thread::get_id()
129-
<< ", done waiting" << std::endl
128+
<< ", done waiting\n"
130129
<< std::flush;
131130
}
132131

133132
void BeforeLoad() override
134133
{
135134
std::lock_guard<std::mutex> lock_guard(serialize);
136135
std::cout << "BeforeLoad() thread " << thread_name_ << ", id " << std::this_thread::get_id()
137-
<< ", about to work" << std::endl
136+
<< ", about to work\n"
138137
<< std::flush;
139138
}
140139

141140
void AfterLoad() override
142141
{
143142
std::lock_guard<std::mutex> lock_guard(serialize);
144143
std::cout << "AfterLoad() thread " << thread_name_ << ", id " << std::this_thread::get_id()
145-
<< ", done working" << std::endl
144+
<< ", done working\n"
146145
<< std::flush;
147146
}
148147

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

344-
std::cout << "Initializing opentelemetry-cpp" << std::endl << std::flush;
343+
std::cout << "Initializing opentelemetry-cpp\n" << std::flush;
345344

346345
InitTracer();
347346
InitMetrics();
348347
InitLogger();
349348

350-
std::cout << "Application payload" << std::endl << std::flush;
349+
std::cout << "Application payload\n" << std::flush;
351350

352351
foo_library();
353352

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

357-
std::cout << "Shutting down opentelemetry-cpp" << std::endl << std::flush;
356+
std::cout << "Shutting down opentelemetry-cpp\n" << std::flush;
358357

359358
CleanupLogger();
360359
CleanupMetrics();
361360
CleanupTracer();
362361

363-
std::cout << "Done" << std::endl << std::flush;
362+
std::cout << "Done\n" << std::flush;
364363
return 0;
365364
}

exporters/ostream/test/ostream_log_test.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ TEST(OstreamLogExporter, DefaultLogRecordToCout)
125125
" severity_text : INVALID\n",
126126
" body : \n",
127127
" resource : \n",
128-
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
128+
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
129129
" telemetry.sdk.name: opentelemetry\n",
130130
" telemetry.sdk.language: cpp\n",
131131
" attributes : \n",
@@ -136,7 +136,7 @@ TEST(OstreamLogExporter, DefaultLogRecordToCout)
136136
" trace_flags : 00\n",
137137
" scope : \n",
138138
" name : otel-cpp\n",
139-
" version : " OPENTELEMETRY_SDK_VERSION "\n",
139+
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
140140
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
141141
" attributes : \n",
142142
" scope.attr.key: scope.attr.value\n",
@@ -199,7 +199,7 @@ TEST(OStreamLogRecordExporter, SimpleLogToCout)
199199
" severity_text : TRACE\n"
200200
" body : Message\n",
201201
" resource : \n",
202-
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
202+
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
203203
" telemetry.sdk.name: opentelemetry\n",
204204
" telemetry.sdk.language: cpp\n",
205205
" attributes : \n",
@@ -210,7 +210,7 @@ TEST(OStreamLogRecordExporter, SimpleLogToCout)
210210
" trace_flags : 00\n",
211211
" scope : \n",
212212
" name : otel-cpp\n",
213-
" version : " OPENTELEMETRY_SDK_VERSION "\n",
213+
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
214214
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
215215
" attributes : \n",
216216
" scope.attr.key: scope.attr.value\n",
@@ -270,7 +270,7 @@ TEST(OStreamLogRecordExporter, LogWithStringAttributesToCerr)
270270
" severity_text : INVALID\n",
271271
" body : \n",
272272
" resource : \n",
273-
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
273+
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
274274
" telemetry.sdk.name: opentelemetry\n",
275275
" telemetry.sdk.language: cpp\n",
276276
" service.name: unknown_service\n",
@@ -284,7 +284,7 @@ TEST(OStreamLogRecordExporter, LogWithStringAttributesToCerr)
284284
" trace_flags : 00\n",
285285
" scope : \n",
286286
" name : otel-cpp\n",
287-
" version : " OPENTELEMETRY_SDK_VERSION "\n",
287+
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
288288
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
289289
" attributes : \n",
290290
" scope.attr.key: scope.attr.value\n",
@@ -352,7 +352,7 @@ TEST(OStreamLogRecordExporter, LogWithVariantTypesToClog)
352352
" body : \n",
353353
" resource : \n",
354354
" service.name: unknown_service\n",
355-
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
355+
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
356356
" telemetry.sdk.name: opentelemetry\n",
357357
" telemetry.sdk.language: cpp\n",
358358
" res1: [1,2,3]\n",
@@ -365,7 +365,7 @@ TEST(OStreamLogRecordExporter, LogWithVariantTypesToClog)
365365
" trace_flags : 00\n",
366366
" scope : \n",
367367
" name : otel-cpp\n",
368-
" version : " OPENTELEMETRY_SDK_VERSION "\n",
368+
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
369369
" schema_url : https://opentelemetry.io/schemas/1.15.0\n",
370370
" attributes : \n",
371371
" scope.attr.key: scope.attr.value\n",
@@ -425,7 +425,7 @@ TEST(OStreamLogRecordExporter, IntegrationTest)
425425
" severity_text : DEBUG\n",
426426
" body : Hello\n",
427427
" resource : \n",
428-
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
428+
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
429429
" service.name: unknown_service\n",
430430
" telemetry.sdk.name: opentelemetry\n",
431431
" telemetry.sdk.language: cpp\n",
@@ -437,7 +437,7 @@ TEST(OStreamLogRecordExporter, IntegrationTest)
437437
" trace_flags : 00\n",
438438
" scope : \n",
439439
" name : opentelelemtry_library\n",
440-
" version : " OPENTELEMETRY_SDK_VERSION "\n",
440+
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
441441
" schema_url : https://opentelemetry.io/schemas/1.11.0\n",
442442
" attributes : \n",
443443
" scope.attr.key: 123\n",
@@ -496,7 +496,7 @@ TEST(OStreamLogRecordExporter, IntegrationTestWithEventId)
496496
" severity_text : DEBUG\n",
497497
" body : Hello {key1} {key2}\n",
498498
" resource : \n",
499-
" telemetry.sdk.version: " OPENTELEMETRY_VERSION "\n",
499+
std::string{" telemetry.sdk.version: "} + OPENTELEMETRY_VERSION + "\n",
500500
" service.name: unknown_service\n",
501501
" telemetry.sdk.name: opentelemetry\n",
502502
" telemetry.sdk.language: cpp\n",
@@ -508,7 +508,7 @@ TEST(OStreamLogRecordExporter, IntegrationTestWithEventId)
508508
" trace_flags : 00\n",
509509
" scope : \n",
510510
" name : opentelelemtry_library\n",
511-
" version : " OPENTELEMETRY_SDK_VERSION "\n",
511+
std::string{" version : "} + OPENTELEMETRY_SDK_VERSION + "\n",
512512
" schema_url : https://opentelemetry.io/schemas/1.11.0\n",
513513
" attributes : \n",
514514
" scope.attr.key: 123\n",

exporters/otlp/src/otlp_file_client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
12011201
{
12021202
if (file_pattern[i] == '%')
12031203
{
1204-
int checked = static_cast<int>(file_pattern[i + 1]);
1204+
int checked = static_cast<unsigned char>(file_pattern[i + 1]);
12051205
if (checked > 0 && checked < 128 && check_interval[checked] > 0)
12061206
{
12071207
if (0 == check_file_path_interval_ ||

exporters/otlp/src/otlp_grpc_client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpGrpcAsyncCallData : public OtlpGrpcAsyncCal
9191
result_callback;
9292

9393
OtlpGrpcAsyncCallData() {}
94-
virtual ~OtlpGrpcAsyncCallData() {}
94+
~OtlpGrpcAsyncCallData() override {}
9595
};
9696
} // namespace
9797
#endif

0 commit comments

Comments
 (0)