Skip to content

Commit

Permalink
Merge branch 'main' into fix_get_tracer_abiv2_2032
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Oct 19, 2023
2 parents ecf6db7 + d9ad76f commit a892095
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Increment the:

* [BUILD] Remove WITH_REMOVE_METER_PREVIEW, use WITH_ABI_VERSION_2 instead
[#2370](https://github.com/open-telemetry/opentelemetry-cpp/pull/2370)
* [BUILD] Make WITH_OTLP_HTTP_SSL_PREVIEW mainstream
[#2378](https://github.com/open-telemetry/opentelemetry-cpp/pull/2378)
* [API] Add InstrumentationScope attributes in TracerProvider::GetTracer()
[#2371](https://github.com/open-telemetry/opentelemetry-cpp/pull/2371)

Expand All @@ -30,6 +32,15 @@ Important changes:
* When building with `CMake` option `WITH_ABI_VERSION_1=ON` (by default)
the `ABI` is unchanged, and the fix is not available.

* [BUILD] Make WITH_OTLP_HTTP_SSL_PREVIEW mainstream
[#2378](https://github.com/open-telemetry/opentelemetry-cpp/pull/2378)
* The experimental `CMake` option `WITH_OTLP_HTTP_SSL_PREVIEW`
is now promoted to stable. The default is changed to `ON`.
* The experimental `CMake` option `WITH_OTLP_HTTP_SSL_TLS_PREVIEW`
is now promoted to stable. The default is changed to `ON`.
* These build options are scheduled to be removed by the next release,
building without SSL/TLS will no longer be possible.

Breaking changes:

* [BUILD] Remove WITH_REMOVE_METER_PREVIEW, use WITH_ABI_VERSION_2 instead
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ endif()

option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)

# EXPERIMENTAL
option(WITH_OTLP_HTTP_SSL_PREVIEW "Whether to enable otlp http ssl export" OFF)
# STABLE
option(WITH_OTLP_HTTP_SSL_PREVIEW "Whether to enable otlp http ssl export" ON)

# EXPERIMENTAL
# STABLE
option(WITH_OTLP_HTTP_SSL_TLS_PREVIEW
"Whether to enable otlp http ssl tls min/max/cipher options" OFF)
"Whether to enable otlp http ssl tls min/max/cipher options" ON)

# Exemplar specs status is experimental, so behind feature flag by default
option(WITH_METRICS_EXEMPLAR_PREVIEW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class DefaultAggregation
case AggregationType::kSum:
return (instrument_descriptor.value_type_ == InstrumentValueType::kLong)
? std::move(std::unique_ptr<Aggregation>(new LongSumAggregation(is_monotonic)))
: std::move(std::unique_ptr<Aggregation>(new DoubleSumAggregation(true)));
: std::move(
std::unique_ptr<Aggregation>(new DoubleSumAggregation(is_monotonic)));
break;
case AggregationType::kHistogram: {
if (instrument_descriptor.value_type_ == InstrumentValueType::kLong)
Expand Down
26 changes: 18 additions & 8 deletions sdk/test/metrics/sum_aggregation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ TEST(CounterToSum, Double)
ASSERT_EQ(1000275.0, opentelemetry::nostd::get<double>(actual.value_));
}

TEST(UpDownCounterToSum, Double)
class UpDownCounterToSumFixture : public ::testing::TestWithParam<bool>
{};

TEST_P(UpDownCounterToSumFixture, Double)
{
bool is_matching_view = GetParam();
MeterProvider mp;
auto m = mp.GetMeter("meter1", "version1", "schema1");
std::string instrument_name = "updowncounter1";
Expand All @@ -133,13 +137,16 @@ TEST(UpDownCounterToSum, Double)
std::shared_ptr<MetricReader> reader{new MockMetricReader(std::move(exporter))};
mp.AddMetricReader(reader);

std::unique_ptr<View> view{
new View("view1", "view1_description", instrument_unit, AggregationType::kSum)};
std::unique_ptr<InstrumentSelector> instrument_selector{
new InstrumentSelector(InstrumentType::kUpDownCounter, instrument_name, instrument_unit)};
std::unique_ptr<MeterSelector> meter_selector{new MeterSelector("meter1", "version1", "schema1")};
mp.AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view));

if (is_matching_view)
{
std::unique_ptr<View> view{
new View("view1", "view1_description", instrument_unit, AggregationType::kSum)};
std::unique_ptr<InstrumentSelector> instrument_selector{
new InstrumentSelector(InstrumentType::kUpDownCounter, instrument_name, instrument_unit)};
std::unique_ptr<MeterSelector> meter_selector{
new MeterSelector("meter1", "version1", "schema1")};
mp.AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view));
}
auto h = m->CreateDoubleUpDownCounter(instrument_name, instrument_desc, instrument_unit);

h->Add(5, {});
Expand Down Expand Up @@ -168,4 +175,7 @@ TEST(UpDownCounterToSum, Double)
const auto &actual = actuals.at(0);
ASSERT_EQ(15.0, opentelemetry::nostd::get<double>(actual.value_));
}
INSTANTIATE_TEST_SUITE_P(UpDownCounterToSum,
UpDownCounterToSumFixture,
::testing::Values(true, false));
#endif

0 comments on commit a892095

Please sign in to comment.