Skip to content
Open
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: 389
warning_limit: 385
- cmake_options: all-options-abiv2-preview
warning_limit: 395
warning_limit: 391
env:
CC: /usr/bin/clang-22
CXX: /usr/bin/clang++-22
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Increment the:
* [CODE HEALTH] Fix IWYU Clang22 warnings
[#4083](https://github.com/open-telemetry/opentelemetry-cpp/pull/4083)

* [CODE HEALTH] Fix clang-tidy narrowing-conversions warnings in otlp_populate_attribute_utils
[#4090](https://github.com/open-telemetry/opentelemetry-cpp/pull/4090)

* [CODE HEALTH] Remove unused alias declarations
[#4091](https://github.com/open-telemetry/opentelemetry-cpp/pull/4091)

Expand Down
16 changes: 8 additions & 8 deletions exporters/otlp/src/otlp_populate_attribute_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue(
}
else if (nostd::holds_alternative<uint64_t>(value))
{
proto_value->set_int_value(
nostd::get<uint64_t>(value)); // NOLINT(cppcoreguidelines-narrowing-conversions)
// uint64_t narrowed to int64_t; OTLP int_value is signed, behavior intentional.
proto_value->set_int_value(static_cast<int64_t>(nostd::get<uint64_t>(value)));
Comment thread
thc1006 marked this conversation as resolved.
}
else if (nostd::holds_alternative<double>(value))
{
Expand Down Expand Up @@ -166,10 +166,10 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue(
else if (nostd::holds_alternative<nostd::span<const uint64_t>>(value))
{
auto array_value = proto_value->mutable_array_value();
// uint64_t narrowed to int64_t; OTLP int_value is signed, behavior intentional.
for (const auto &val : nostd::get<nostd::span<const uint64_t>>(value))
{
array_value->add_values()->set_int_value(
val); // NOLINT(cppcoreguidelines-narrowing-conversions)
array_value->add_values()->set_int_value(static_cast<int64_t>(val));
}
}
else if (nostd::holds_alternative<nostd::span<const double>>(value))
Expand Down Expand Up @@ -235,8 +235,8 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue(
}
else if (nostd::holds_alternative<uint64_t>(value))
{
proto_value->set_int_value(
nostd::get<uint64_t>(value)); // NOLINT(cppcoreguidelines-narrowing-conversions)
// uint64_t narrowed to int64_t; OTLP int_value is signed, behavior intentional.
proto_value->set_int_value(static_cast<int64_t>(nostd::get<uint64_t>(value)));
}
else if (nostd::holds_alternative<double>(value))
{
Expand Down Expand Up @@ -311,10 +311,10 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue(
else if (nostd::holds_alternative<std::vector<uint64_t>>(value))
{
auto array_value = proto_value->mutable_array_value();
// uint64_t narrowed to int64_t; OTLP int_value is signed, behavior intentional.
for (const auto &val : nostd::get<std::vector<uint64_t>>(value))
{
array_value->add_values()->set_int_value(
val); // NOLINT(cppcoreguidelines-narrowing-conversions)
array_value->add_values()->set_int_value(static_cast<int64_t>(val));
}
}
else if (nostd::holds_alternative<std::vector<double>>(value))
Expand Down
Loading