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: 490
warning_limit: 330
- cmake_options: all-options-abiv2-preview
warning_limit: 492
warning_limit: 332
env:
CC: /usr/bin/clang-18
CXX: /usr/bin/clang++-18
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ Increment the:
* [EXAMPLES] Deprecated semantic conventions used
[#3905](https://github.com/open-telemetry/opentelemetry-cpp/pull/3905)

* [CODE HEALTH] Fix clang-tidy misc-use-internal-linkage warnings
[#3600](https://github.com/open-telemetry/opentelemetry-cpp/pull/3600)

Important changes:

* [BUILD] Revisit EventLogger deprecation
Expand Down
4 changes: 2 additions & 2 deletions api/test/baggage/baggage_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

using namespace opentelemetry::baggage;

std::string header_with_custom_entries(size_t num_entries)
static std::string header_with_custom_entries(size_t num_entries)
{
std::string header;
for (size_t i = 0; i < num_entries; i++)
Expand All @@ -31,7 +31,7 @@ std::string header_with_custom_entries(size_t num_entries)
return header;
}

std::string header_with_custom_size(size_t key_value_size, size_t num_entries)
static std::string header_with_custom_size(size_t key_value_size, size_t num_entries)
{
std::string header = "";
for (size_t i = 0; i < num_entries; i++)
Expand Down
4 changes: 2 additions & 2 deletions api/test/nostd/function_ref_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

using namespace opentelemetry::nostd;

int Call(function_ref<int()> f)
static int Call(function_ref<int()> f)
{
return f();
}

int Return3()
static int Return3()
{
return 3;
}
Expand Down
60 changes: 30 additions & 30 deletions api/test/singleton/singleton_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

using namespace opentelemetry;

void do_something()
static void do_something()
{
do_something_in_a();
do_something_in_b();
Expand Down Expand Up @@ -111,33 +111,33 @@ void do_something()
#endif /* BAZEL_BUILD */
}

int span_a_lib_count = 0;
int span_a_f1_count = 0;
int span_a_f2_count = 0;
int span_b_lib_count = 0;
int span_b_f1_count = 0;
int span_b_f2_count = 0;
int span_c_lib_count = 0;
int span_c_f1_count = 0;
int span_c_f2_count = 0;
int span_d_lib_count = 0;
int span_d_f1_count = 0;
int span_d_f2_count = 0;
int span_e_lib_count = 0;
int span_e_f1_count = 0;
int span_e_f2_count = 0;
int span_f_lib_count = 0;
int span_f_f1_count = 0;
int span_f_f2_count = 0;
int span_g_lib_count = 0;
int span_g_f1_count = 0;
int span_g_f2_count = 0;
int span_h_lib_count = 0;
int span_h_f1_count = 0;
int span_h_f2_count = 0;
int unknown_span_count = 0;

void reset_counts()
static int span_a_lib_count = 0;
static int span_a_f1_count = 0;
static int span_a_f2_count = 0;
static int span_b_lib_count = 0;
static int span_b_f1_count = 0;
static int span_b_f2_count = 0;
static int span_c_lib_count = 0;
static int span_c_f1_count = 0;
static int span_c_f2_count = 0;
static int span_d_lib_count = 0;
static int span_d_f1_count = 0;
static int span_d_f2_count = 0;
static int span_e_lib_count = 0;
static int span_e_f1_count = 0;
static int span_e_f2_count = 0;
static int span_f_lib_count = 0;
static int span_f_f1_count = 0;
static int span_f_f2_count = 0;
static int span_g_lib_count = 0;
static int span_g_f1_count = 0;
static int span_g_f2_count = 0;
static int span_h_lib_count = 0;
static int span_h_f1_count = 0;
static int span_h_f2_count = 0;
static int unknown_span_count = 0;

static void reset_counts()
{
span_a_lib_count = 0;
span_a_f1_count = 0;
Expand Down Expand Up @@ -331,7 +331,7 @@ class MyTracerProvider : public trace::TracerProvider
#endif
};

void setup_otel()
static void setup_otel()
{
std::shared_ptr<opentelemetry::trace::TracerProvider> provider = MyTracerProvider::Create();

Expand All @@ -343,7 +343,7 @@ void setup_otel()
trace_api::Provider::SetTracerProvider(provider);
}

void cleanup_otel()
static void cleanup_otel()
{
std::shared_ptr<opentelemetry::trace::TracerProvider> provider(
new opentelemetry::trace::NoopTracerProvider());
Expand Down
2 changes: 1 addition & 1 deletion exporters/ostream/src/metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace metrics
{

template <typename Container>
inline void printVec(std::ostream &os, Container &vec)
static inline void printVec(std::ostream &os, Container &vec)
{
using T = typename std::decay<decltype(*vec.begin())>::type;
os << '[';
Expand Down
2 changes: 1 addition & 1 deletion exporters/ostream/src/span_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace exporter
namespace trace
{

std::ostream &operator<<(std::ostream &os, trace_api::SpanKind span_kind)
static std::ostream &operator<<(std::ostream &os, trace_api::SpanKind span_kind)
{
switch (span_kind)
{
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/test/otlp_http_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ static nostd::span<T, N> MakeSpan(T (&array)[N])
return nostd::span<T, N>(array);
}

OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_type,
bool async_mode)
static OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_type,
bool async_mode)
{
std::shared_ptr<opentelemetry::sdk::common::ThreadInstrumentation> not_instrumented;
OtlpHttpExporterOptions options;
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/test/otlp_http_log_record_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ static nostd::span<T, N> MakeSpan(T (&array)[N])
return nostd::span<T, N>(array);
}

OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_type,
bool async_mode)
static OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_type,
bool async_mode)
{
std::shared_ptr<opentelemetry::sdk::common::ThreadInstrumentation> not_instrumented;
OtlpHttpLogRecordExporterOptions options;
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/test/otlp_http_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ static IntegerType JsonToInteger(nlohmann::json value)
return value.get<IntegerType>();
}

OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_type,
bool async_mode)
static OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_type,
bool async_mode)
{
std::shared_ptr<opentelemetry::sdk::common::ThreadInstrumentation> not_instrumented;
OtlpHttpMetricExporterOptions options;
Expand Down
10 changes: 5 additions & 5 deletions exporters/prometheus/src/exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace exporter
namespace metrics
{

inline const std::string GetPrometheusDefaultHttpEndpoint()
static inline const std::string GetPrometheusDefaultHttpEndpoint()
{
constexpr char kPrometheusEndpointEnv[] = "PROMETHEUS_EXPORTER_ENDPOINT";
constexpr char kPrometheusEndpointDefault[] = "localhost:9464";
Expand All @@ -25,7 +25,7 @@ inline const std::string GetPrometheusDefaultHttpEndpoint()
return exists ? endpoint : kPrometheusEndpointDefault;
}

inline bool GetPrometheusWithoutOtelScope()
static inline bool GetPrometheusWithoutOtelScope()
{
constexpr char kPrometheusWithoutOtelScope[] = "OTEL_CPP_PROMETHEUS_EXPORTER_WITHOUT_OTEL_SCOPE";

Expand All @@ -36,7 +36,7 @@ inline bool GetPrometheusWithoutOtelScope()
return exists ? setting : false;
}

inline bool GetPrometheusPopulateTargetInfo()
static inline bool GetPrometheusPopulateTargetInfo()
{
constexpr char kPrometheusPopulateTargetInfo[] =
"OTEL_CPP_PROMETHEUS_EXPORTER_POPULATE_TARGET_INFO";
Expand All @@ -48,7 +48,7 @@ inline bool GetPrometheusPopulateTargetInfo()
return exists ? setting : true;
}

inline bool GetPrometheusWithoutUnits()
static inline bool GetPrometheusWithoutUnits()
{
constexpr char kPrometheusWithoutUnits[] = "OTEL_CPP_PROMETHEUS_EXPORTER_WITHOUT_UNITS";
bool setting{};
Expand All @@ -58,7 +58,7 @@ inline bool GetPrometheusWithoutUnits()
return exists ? setting : false;
}

inline bool GetPrometheusWithoutTypeSuffix()
static inline bool GetPrometheusWithoutTypeSuffix()
{
constexpr char kPrometheusWithoutTypeSuffix[] =
"OTEL_CPP_PROMETHEUS_EXPORTER_WITHOUT_TYPE_SUFFIX";
Expand Down
18 changes: 9 additions & 9 deletions exporters/prometheus/test/exporter_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ class SanitizeNameTester
} // namespace exporter

template <typename T>
void assert_basic(prometheus_client::MetricFamily &metric,
const std::string &expected_name,
const std::string &description,
prometheus_client::MetricType type,
size_t label_num,
std::vector<T> vals)
static void assert_basic(prometheus_client::MetricFamily &metric,
const std::string &expected_name,
const std::string &description,
prometheus_client::MetricType type,
size_t label_num,
std::vector<T> vals)
{
ASSERT_EQ(metric.name, expected_name); // name sanitized
ASSERT_EQ(metric.help, description); // description not changed
Expand Down Expand Up @@ -130,9 +130,9 @@ void assert_basic(prometheus_client::MetricFamily &metric,
}
}

void assert_histogram(prometheus_client::MetricFamily &metric,
const std::list<double> &boundaries,
std::vector<int> correct)
static void assert_histogram(prometheus_client::MetricFamily &metric,
const std::list<double> &boundaries,
std::vector<int> correct)
{
int cumulative_count = 0;
auto buckets = metric.metric[0].histogram.bucket;
Expand Down
6 changes: 3 additions & 3 deletions exporters/zipkin/src/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ void Recordable::SetIdentity(const trace_api::SpanContext &span_context,
span_["traceId"] = std::string(trace_id_lower_base16, 32);
}

void PopulateAttribute(nlohmann::json &attribute,
nostd::string_view key,
const common::AttributeValue &value)
static void PopulateAttribute(nlohmann::json &attribute,
nostd::string_view key,
const common::AttributeValue &value)
{
// Assert size of variant to ensure that this method gets updated if the variant
// definition changes
Expand Down
2 changes: 1 addition & 1 deletion exporters/zipkin/test/zipkin_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class IsValidMessageMatcher
std::string trace_id_;
};

PolymorphicMatcher<IsValidMessageMatcher> IsValidMessage(const std::string &trace_id)
static PolymorphicMatcher<IsValidMessageMatcher> IsValidMessage(const std::string &trace_id)
{
return MakePolymorphicMatcher(IsValidMessageMatcher(trace_id));
}
Expand Down
2 changes: 1 addition & 1 deletion ext/src/http/client/curl/http_client_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ nostd::shared_ptr<HttpCurlGlobalInitializer> HttpCurlGlobalInitializer::GetInsta
#ifdef ENABLE_OTLP_COMPRESSION_PREVIEW
// Original source:
// https://stackoverflow.com/questions/12398377/is-it-possible-to-have-zlib-read-from-and-write-to-the-same-memory-buffer/12412863#12412863
int deflateInPlace(z_stream *strm, unsigned char *buf, uint32_t len, uint32_t *max_len)
static int deflateInPlace(z_stream *strm, unsigned char *buf, uint32_t len, uint32_t *max_len)
{
// must be large enough to hold zlib or gzip header (if any) and one more byte -- 11 works for the
// worst case here, but if gzip encoding is used and a deflateSetHeader() call is inserted in this
Expand Down
2 changes: 1 addition & 1 deletion ext/test/w3c_tracecontext_http_test_server/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class NoopEventHandler : public http_client::EventHandler
} // namespace

// Sends an HTTP POST request to the given url, with the given body.
void send_request(curl::HttpClient &client, const std::string &url, const std::string &body)
static void send_request(curl::HttpClient &client, const std::string &url, const std::string &body)
{
static std::shared_ptr<http_client::EventHandler> handler(new NoopEventHandler());

Expand Down
Loading
Loading