Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metrics] Switch to explicit 64 bit integers #1686

Merged
merged 25 commits into from
Oct 25, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
CreateInt64ObservableCounter
  • Loading branch information
esigo committed Oct 22, 2022
commit b7c50efa4246b1e3ab87ff6f64d9edc4b7d17195
2 changes: 1 addition & 1 deletion api/include/opentelemetry/metrics/meter.h
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ class Meter
* @param description a brief description of what the Observable Counter is used for.
* @param unit the unit of metric values following https://unitsofmeasure.org/ucum.html.
*/
virtual nostd::shared_ptr<ObservableInstrument> CreateUInt64ObservableCounter(
virtual nostd::shared_ptr<ObservableInstrument> CreateInt64ObservableCounter(
nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept = 0;
2 changes: 1 addition & 1 deletion api/include/opentelemetry/metrics/noop.h
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ class NoopMeter final : public Meter
return nostd::shared_ptr<Counter<double>>{new NoopCounter<double>(name, description, unit)};
}

nostd::shared_ptr<ObservableInstrument> CreateUInt64ObservableCounter(
nostd::shared_ptr<ObservableInstrument> CreateInt64ObservableCounter(
nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept override
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/meter.h
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ class Meter final : public opentelemetry::metrics::Meter
nostd::string_view description = "",
nostd::string_view unit = "") noexcept override;

nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument> CreateUInt64ObservableCounter(
nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument> CreateInt64ObservableCounter(
nostd::string_view name,
nostd::string_view description = "",
nostd::string_view unit = "") noexcept override;
8 changes: 4 additions & 4 deletions sdk/src/metrics/meter.cc
Original file line number Diff line number Diff line change
@@ -61,10 +61,10 @@ nostd::shared_ptr<metrics::Counter<double>> Meter::CreateDoubleCounter(
new DoubleCounter(instrument_descriptor, std::move(storage))};
}

nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument>
Meter::CreateUInt64ObservableCounter(nostd::string_view name,
nostd::string_view description,
nostd::string_view unit) noexcept
nostd::shared_ptr<opentelemetry::metrics::ObservableInstrument> Meter::CreateInt64ObservableCounter(
nostd::string_view name,
nostd::string_view description,
nostd::string_view unit) noexcept
{
InstrumentDescriptor instrument_descriptor = {
std::string{name.data(), name.size()}, std::string{description.data(), description.size()},
2 changes: 1 addition & 1 deletion sdk/test/metrics/meter_test.cc
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ TEST(MeterTest, BasicAsyncTests)
{
MetricReader *metric_reader_ptr = nullptr;
auto meter = InitMeter(&metric_reader_ptr);
auto observable_counter = meter->CreateUInt64ObservableCounter("observable_counter");
auto observable_counter = meter->CreateInt64ObservableCounter("observable_counter");
observable_counter->AddCallback(asyc_generate_measurements, nullptr);

size_t count = 0;