Skip to content

Commit bbf970a

Browse files
authored
[CODE HEALTH] Move remaining misc-use-internal-linkage sites into anonymous namespaces (#4350)
1 parent e79ab1f commit bbf970a

6 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ Increment the:
1515

1616
## [Unreleased]
1717

18+
* [CODE HEALTH] Move remaining `misc-use-internal-linkage` classes/enums into
19+
anonymous namespaces: `OtlpFileSystemBackend`/`OtlpFileOstreamBackend` in
20+
the OTLP file exporter, `ResponseHandler`/`AsyncResponseHandler`/
21+
`json_assign_visitor` in the Elasticsearch log exporter, and the
22+
`TestMode`/`test_mode` enums in the OTLP functional test binaries.
23+
[#4196](https://github.com/open-telemetry/opentelemetry-cpp/issues/4196)
1824
* [METRICS SDK] Fix Windows metrics tail latency on the synchronous record path:
1925
`SyncMetricStorage::attribute_hashmap_lock_` now uses `std::mutex` instead of
2026
`common::SpinLockMutex`. The spin lock's final `sleep_for(1ms)` back-off is

‎exporters/elasticsearch/src/es_log_record_exporter.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ namespace exporter
4141
{
4242
namespace logs
4343
{
44+
namespace
45+
{
4446
/**
4547
* This class handles the response message from the Elasticsearch request
4648
*/
@@ -349,6 +351,7 @@ class AsyncResponseHandler : public http_client::EventHandler
349351
bool console_debug_ = false;
350352
};
351353
#endif
354+
} // namespace
352355

353356
ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter()
354357
: ElasticsearchLogRecordExporter(ElasticsearchExporterOptions())

‎exporters/elasticsearch/src/es_log_recordable.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
namespace nlohmann
3333
{
34+
namespace
35+
{
3436
template <class T>
3537
struct json_assign_visitor
3638
{
@@ -53,6 +55,7 @@ struct json_assign_visitor
5355
}
5456
}
5557
};
58+
} // namespace
5659

5760
template <>
5861
struct adl_serializer<opentelemetry::sdk::common::OwnedAttributeValue>

‎exporters/otlp/src/otlp_file_client.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,6 @@ void ConvertListFieldToJson(nlohmann::json &value,
973973

974974
// NOLINTEND(misc-no-recursion) suppressing for performance as if implemented with stack needs
975975
// Dynamic memory allocation
976-
} // namespace
977976

978977
class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
979978
{
@@ -1615,6 +1614,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileOstreamBackend : public OtlpFileAppende
16151614
private:
16161615
std::reference_wrapper<std::ostream> os_;
16171616
};
1617+
} // namespace
16181618

16191619
OtlpFileClient::OtlpFileClient(OtlpFileClientOptions &&options,
16201620
OtlpFileClientRuntimeOptions &&runtime_options)

‎functional/otlp/func_grpc_main.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ const int TEST_FAILED = 1;
3939
Command line parameters.
4040
*/
4141

42+
namespace
43+
{
4244
enum class TestMode : std::uint8_t
4345
{
4446
kNone,
4547
kHttp,
4648
kHttps
4749
};
50+
} // namespace
4851

4952
static bool opt_help = false;
5053
static bool opt_list = false;

‎functional/otlp/func_http_main.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ const int TEST_FAILED = 1;
3838
Command line parameters.
3939
*/
4040

41+
namespace
42+
{
4143
enum test_mode : std::uint8_t
4244
{
4345
MODE_NONE,
4446
MODE_HTTP,
4547
MODE_HTTPS
4648
};
49+
} // namespace
4750

4851
static bool opt_help = false;
4952
static bool opt_list = false;

0 commit comments

Comments
 (0)