Skip to content

Commit

Permalink
[Metrics SDK] - fix spelling (AggregationTemporarily to AggregationTe…
Browse files Browse the repository at this point in the history
…mporality) (#1288)
  • Loading branch information
lalitb authored Mar 24, 2022
1 parent 3c7b44b commit 2c9ce39
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 148 deletions.
4 changes: 2 additions & 2 deletions exporters/ostream/test/ostream_metric_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ TEST(OStreamMetricsExporter, ExportSumPointData)
record->instrumentation_library_ = instrumentation_library.get();
record->point_data_ = metric_sdk::SumPointData{
opentelemetry::common::SystemTimestamp{}, opentelemetry::common::SystemTimestamp{}, 10.0,
metric_sdk::AggregationTemporarily::kUnspecified, false};
metric_sdk::AggregationTemporality::kUnspecified, false};
auto record2 = std::unique_ptr<metric_sdk::MetricData>(new metric_sdk::MetricData(*record));
record2->point_data_ = metric_sdk::SumPointData{
opentelemetry::common::SystemTimestamp{}, opentelemetry::common::SystemTimestamp{}, 20l,
metric_sdk::AggregationTemporarily::kUnspecified, false};
metric_sdk::AggregationTemporality::kUnspecified, false};
std::vector<std::unique_ptr<metric_sdk::MetricData>> records;
records.push_back(std::move(record));
records.push_back(std::move(record2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static inline void PopulateSumPointData(SumPointData &sum,
sum.end_epoch_nanos_ = end_ts;
sum.value_ = value;
sum.is_monotonic_ = is_monotonic;
sum.aggregation_temporarily_ = AggregationTemporarily::kDelta;
sum.aggregation_temporality_ = AggregationTemporality::kDelta;
}

class LongSumAggregation : public Aggregation, InstrumentMonotonicityAwareAggregation
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/data/point_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SumPointData
opentelemetry::common::SystemTimestamp start_epoch_nanos_;
opentelemetry::common::SystemTimestamp end_epoch_nanos_;
ValueType value_;
AggregationTemporarily aggregation_temporarily_;
AggregationTemporality aggregation_temporality_;
bool is_monotonic_;
};

Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum class AggregationType
kDefault
};

enum class AggregationTemporarily
enum class AggregationTemporality
{
kUnspecified,
kDelta,
Expand Down
124 changes: 0 additions & 124 deletions sdk/include/opentelemetry/sdk/metrics/measurement_processor.h

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/metric_exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MetricExporter
std::chrono::microseconds timeout = std::chrono::microseconds(0)) noexcept = 0;

private:
AggregationTemporarily aggregation_temporarily;
AggregationTemporality aggregation_temporality_;
};
} // namespace metrics
} // namespace sdk
Expand Down
6 changes: 3 additions & 3 deletions sdk/include/opentelemetry/sdk/metrics/metric_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MetricReader
{
public:
MetricReader(
AggregationTemporarily aggregation_temporarily = AggregationTemporarily::kCummulative);
AggregationTemporality aggregation_temporality = AggregationTemporality::kCummulative);

void SetMetricProducer(MetricProducer *metric_producer);

Expand All @@ -37,7 +37,7 @@ class MetricReader
*/
bool Collect(nostd::function_ref<bool(MetricData)> callback) noexcept;

AggregationTemporarily GetAggregationTemporarily() const noexcept;
AggregationTemporality GetAggregationTemporality() const noexcept;

/**
* Shutdown the meter reader.
Expand All @@ -62,7 +62,7 @@ class MetricReader

private:
MetricProducer *metric_producer_;
AggregationTemporarily aggregation_temporarily_;
AggregationTemporality aggregation_temporality_;
mutable opentelemetry::common::SpinLockMutex lock_;
bool shutdown_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MeterContext;
class CollectorHandle
{
public:
virtual AggregationTemporarily GetAggregationTemporarily() noexcept = 0;
virtual AggregationTemporality GetAggregationTemporality() noexcept = 0;
};

/**
Expand All @@ -33,7 +33,7 @@ class MetricCollector : public MetricProducer, public CollectorHandle
MetricCollector(std::shared_ptr<MeterContext> &&context,
std::unique_ptr<MetricReader> metric_reader);

AggregationTemporarily GetAggregationTemporarily() noexcept override;
AggregationTemporality GetAggregationTemporality() noexcept override;

/**
* The callback to be called for each metric exporter. This will only be those
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/metrics/metric_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ namespace sdk
namespace metrics
{

MetricReader::MetricReader(AggregationTemporarily aggregation_temporarily)
: aggregation_temporarily_(aggregation_temporarily)
MetricReader::MetricReader(AggregationTemporality aggregation_temporality)
: aggregation_temporality_(aggregation_temporality)
{}

void MetricReader::SetMetricProducer(MetricProducer *metric_producer)
{
metric_producer_ = metric_producer;
}

AggregationTemporarily MetricReader::GetAggregationTemporarily() const noexcept
AggregationTemporality MetricReader::GetAggregationTemporality() const noexcept
{
return aggregation_temporarily_;
return aggregation_temporality_;
}

bool MetricReader::Collect(nostd::function_ref<bool(MetricData)> callback) noexcept
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/metrics/state/metric_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ MetricCollector::MetricCollector(
metric_reader_->SetMetricProducer(this);
}

AggregationTemporarily MetricCollector::GetAggregationTemporarily() noexcept
AggregationTemporality MetricCollector::GetAggregationTemporality() noexcept
{
return metric_reader_->GetAggregationTemporarily();
return metric_reader_->GetAggregationTemporality();
}

bool MetricCollector::Collect(nostd::function_ref<bool(MetricData)> callback) noexcept
Expand Down
4 changes: 2 additions & 2 deletions sdk/test/metrics/async_metric_storage_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using namespace opentelemetry::sdk::resource;
class MockMetricReader : public MetricReader
{
public:
MockMetricReader(AggregationTemporarily aggr_temporarily) : MetricReader(aggr_temporarily) {}
MockMetricReader(AggregationTemporality aggr_temporality) : MetricReader(aggr_temporality) {}

virtual bool OnForceFlush(std::chrono::microseconds timeout) noexcept override { return true; }

Expand All @@ -44,7 +44,7 @@ TEST(AsyncMetricStorageTest, BasicTests)

std::vector<std::unique_ptr<opentelemetry::sdk::metrics::MetricExporter>> exporters;
std::shared_ptr<MeterContext> meter_context(new MeterContext(std::move(exporters)));
std::unique_ptr<MetricReader> metric_reader(new MockMetricReader(AggregationTemporarily::kDelta));
std::unique_ptr<MetricReader> metric_reader(new MockMetricReader(AggregationTemporality::kDelta));

std::shared_ptr<CollectorHandle> collector = std::shared_ptr<CollectorHandle>(
new MetricCollector(std::move(meter_context), std::move(metric_reader)));
Expand Down
10 changes: 5 additions & 5 deletions sdk/test/metrics/metric_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace opentelemetry::sdk::metrics;
class MockMetricReader : public MetricReader
{
public:
MockMetricReader(AggregationTemporarily aggr_temporarily) : MetricReader(aggr_temporarily) {}
MockMetricReader(AggregationTemporality aggr_temporality) : MetricReader(aggr_temporality) {}

virtual bool OnForceFlush(std::chrono::microseconds timeout) noexcept override { return true; }

Expand All @@ -25,15 +25,15 @@ class MockMetricReader : public MetricReader

TEST(MetricReaderTest, BasicTests)
{
AggregationTemporarily aggr_temporarily = AggregationTemporarily::kDelta;
std::unique_ptr<MetricReader> metric_reader1(new MockMetricReader(aggr_temporarily));
EXPECT_EQ(metric_reader1->GetAggregationTemporarily(), aggr_temporarily);
AggregationTemporality aggr_temporality = AggregationTemporality::kDelta;
std::unique_ptr<MetricReader> metric_reader1(new MockMetricReader(aggr_temporality));
EXPECT_EQ(metric_reader1->GetAggregationTemporality(), aggr_temporality);

std::vector<std::unique_ptr<sdk::metrics::MetricExporter>> exporters;
std::shared_ptr<MeterContext> meter_context1(new MeterContext(std::move(exporters)));
EXPECT_NO_THROW(meter_context1->AddMetricReader(std::move(metric_reader1)));

std::unique_ptr<MetricReader> metric_reader2(new MockMetricReader(aggr_temporarily));
std::unique_ptr<MetricReader> metric_reader2(new MockMetricReader(aggr_temporality));
std::shared_ptr<MeterContext> meter_context2(new MeterContext(std::move(exporters)));
MetricProducer *metric_producer =
new MetricCollector(std::move(meter_context2), std::move(metric_reader2));
Expand Down

1 comment on commit 2c9ce39

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 2c9ce39 Previous: 3c7b44b Ratio
BM_SpinLockThrashing/1/process_time/real_time 0.6689283847808838 ms/iter 0.1661120298029613 ms/iter 4.03

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.