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
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- cmake_options: all-options-abiv1-preview
warning_limit: 31
- cmake_options: all-options-abiv2-preview
warning_limit: 33
warning_limit: 31
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 @@ -70,6 +70,9 @@ Increment the:
* [CODE HEALTH] Fix clang-tidy misc-no-recursion warnings
[#4009](https://github.com/open-telemetry/opentelemetry-cpp/pull/4009)

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

Important changes:

* Enable WITH_OTLP_RETRY_PREVIEW by default
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/metrics/sync_instruments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void LongHistogram::Record(uint64_t value,
return;
}
auto context = opentelemetry::context::Context{};
return storage_->RecordLong(value, attributes, context);
return storage_->RecordLong(static_cast<int64_t>(value), attributes, context);
}

void LongHistogram::Record(uint64_t value) noexcept
Expand All @@ -472,7 +472,7 @@ void LongHistogram::Record(uint64_t value) noexcept
return;
}
auto context = opentelemetry::context::Context{};
return storage_->RecordLong(value, context);
return storage_->RecordLong(static_cast<int64_t>(value), context);
}
#endif

Expand Down
5 changes: 5 additions & 0 deletions sdk/test/metrics/sync_instruments_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ TEST(SyncInstruments, LongHistogram)
opentelemetry::context::Context{});
histogram.Record(10, opentelemetry::common::KeyValueIterableView<M>({}),
opentelemetry::context::Context{});

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
histogram.Record(10ULL);
histogram.Record(10ULL, opentelemetry::common::KeyValueIterableView<M>({}));
#endif
}

TEST(SyncInstruments, DoubleHistogram)
Expand Down
Loading