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
4 changes: 2 additions & 2 deletions api/include/opentelemetry/context/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class Context
class DataList
{
public:
nostd::shared_ptr<DataList> next_;

char *key_;

nostd::shared_ptr<DataList> next_;

size_t key_length_;

ContextValue value_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class OStreamMetricsExporter final : public sdkmetrics::MetricsExporter
{
auto vec = agg->get_checkpoint();
size_t size = vec.size();
int i = 1;
size_t i = 1;

sout_ << "\n values : " << '[';

Expand All @@ -110,7 +110,7 @@ class OStreamMetricsExporter final : public sdkmetrics::MetricsExporter

sout_ << "\n buckets : " << '[';

for (int i = 0; i < boundaries_size; i++)
for (size_t i = 0; i < boundaries_size; i++)
{
sout_ << boundaries[i];

Expand All @@ -120,7 +120,7 @@ class OStreamMetricsExporter final : public sdkmetrics::MetricsExporter
sout_ << ']';

sout_ << "\n counts : " << '[';
for (int i = 0; i < counts_size; i++)
for (size_t i = 0; i < counts_size; i++)
{
sout_ << counts[i];

Expand All @@ -140,7 +140,7 @@ class OStreamMetricsExporter final : public sdkmetrics::MetricsExporter

sout_ << "\n buckets : " << '[';

for (int i = 0; i < boundaries_size; i++)
for (size_t i = 0; i < boundaries_size; i++)
{
sout_ << boundaries[i];

Expand All @@ -150,7 +150,7 @@ class OStreamMetricsExporter final : public sdkmetrics::MetricsExporter
sout_ << ']';

sout_ << "\n counts : " << '[';
for (int i = 0; i < counts_size; i++)
for (size_t i = 0; i < counts_size; i++)
{
sout_ << counts[i];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PrometheusCollector : public prometheus_client::Collectable
* This constructor initializes the collection for metrics to export
* in this class with default capacity
*/
explicit PrometheusCollector(int max_collection_size = 2048);
explicit PrometheusCollector(size_t max_collection_size = 2048);

/**
* Collects all metrics data from metricsToCollect collection.
Expand Down Expand Up @@ -88,7 +88,7 @@ class PrometheusCollector : public prometheus_client::Collectable
/**
* Maximum size of the metricsToCollect collection.
*/
int max_collection_size_;
size_t max_collection_size_;

/*
* Lock when operating the metricsToCollect collection
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/src/prometheus_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace prometheus
* This constructor initializes the collection for metrics to export
* in this class with default capacity
*/
PrometheusCollector::PrometheusCollector(int max_collection_size)
PrometheusCollector::PrometheusCollector(size_t max_collection_size)
: max_collection_size_(max_collection_size)
{
metrics_to_collect_ =
Expand Down
6 changes: 3 additions & 3 deletions exporters/prometheus/src/prometheus_exporter_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void PrometheusExporterUtils::SetMetricBasic(prometheus_client::ClientMetric &me
if (!label_pairs.empty())
{
metric.label.resize(label_pairs.size());
for (int i = 0; i < label_pairs.size(); ++i)
for (size_t i = 0; i < label_pairs.size(); ++i)
{
auto origin_name = label_pairs[i].first;
auto sanitized = SanitizeNames(origin_name);
Expand Down Expand Up @@ -396,7 +396,7 @@ void PrometheusExporterUtils::SetValue(std::vector<T> values,
metric->histogram.sample_count = values[1];
int cumulative = 0;
std::vector<prometheus_client::ClientMetric::Bucket> buckets;
for (int i = 0; i < boundaries.size() + 1; i++)
for (size_t i = 0; i < boundaries.size() + 1; i++)
{
prometheus_client::ClientMetric::Bucket bucket;
cumulative += counts[i];
Expand Down Expand Up @@ -444,7 +444,7 @@ void PrometheusExporterUtils::SetValue(std::vector<T> values,
if (do_quantile)
{
std::vector<prometheus_client::ClientMetric::Quantile> prometheus_quantiles;
for (int i = 0; i < quantiles.size(); i++)
for (size_t i = 0; i < quantiles.size(); i++)
{
prometheus_client::ClientMetric::Quantile quantile;
quantile.quantile = quantile_points[i];
Expand Down
20 changes: 10 additions & 10 deletions exporters/prometheus/test/prometheus_collector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ TEST(PrometheusCollector, AddMetricDataWithCounterRecordsSuccessfully)
auto after_agg = nostd::get<std::shared_ptr<metric_sdk::Aggregator<double>>>(after_agg_var);

ASSERT_EQ(before_agg->get_checkpoint().size(), after_agg->get_checkpoint().size());
for (int i = 0; i < before_agg->get_checkpoint().size(); i++)
for (size_t i = 0; i < before_agg->get_checkpoint().size(); i++)
{
ASSERT_EQ(before_agg->get_checkpoint()[i], after_agg->get_checkpoint()[i]);
}
Expand Down Expand Up @@ -267,7 +267,7 @@ TEST(PrometheusCollector, AddMetricDataWithMinMaxSumCountRecordsSuccessfully)
auto after_agg = nostd::get<std::shared_ptr<metric_sdk::Aggregator<short>>>(after_agg_var);

ASSERT_EQ(before_agg->get_checkpoint().size(), after_agg->get_checkpoint().size());
for (int i = 0; i < before_agg->get_checkpoint().size(); i++)
for (size_t i = 0; i < before_agg->get_checkpoint().size(); i++)
{
ASSERT_EQ(before_agg->get_checkpoint()[i], after_agg->get_checkpoint()[i]);
}
Expand Down Expand Up @@ -319,7 +319,7 @@ TEST(PrometheusCollector, AddMetricDataWithGaugeRecordsSuccessfully)
auto after_agg = nostd::get<std::shared_ptr<metric_sdk::Aggregator<int>>>(after_agg_var);

ASSERT_EQ(before_agg->get_checkpoint().size(), after_agg->get_checkpoint().size());
for (int i = 0; i < before_agg->get_checkpoint().size(); i++)
for (size_t i = 0; i < before_agg->get_checkpoint().size(); i++)
{
ASSERT_EQ(before_agg->get_checkpoint()[i], after_agg->get_checkpoint()[i]);
}
Expand Down Expand Up @@ -372,15 +372,15 @@ TEST(PrometheusCollector, AddMetricDataWithSketchRecordsSuccessfully)
auto after_agg = nostd::get<std::shared_ptr<metric_sdk::Aggregator<double>>>(after_agg_var);

ASSERT_EQ(before_agg->get_checkpoint().size(), after_agg->get_checkpoint().size());
for (int i = 0; i < before_agg->get_checkpoint().size(); i++)
for (size_t i = 0; i < before_agg->get_checkpoint().size(); i++)
{
ASSERT_EQ(before_agg->get_checkpoint()[i], after_agg->get_checkpoint()[i]);
}
for (int i = 0; i < before_agg->get_boundaries().size(); i++)
for (size_t i = 0; i < before_agg->get_boundaries().size(); i++)
{
ASSERT_EQ(before_agg->get_boundaries()[i], after_agg->get_boundaries()[i]);
}
for (int i = 0; i < before_agg->get_counts().size(); i++)
for (size_t i = 0; i < before_agg->get_counts().size(); i++)
{
ASSERT_EQ(before_agg->get_counts()[i], after_agg->get_counts()[i]);
}
Expand Down Expand Up @@ -433,15 +433,15 @@ TEST(PrometheusCollector, AddMetricDataWithHistogramRecordsSuccessfully)
auto after_agg = nostd::get<std::shared_ptr<metric_sdk::Aggregator<float>>>(after_agg_var);

ASSERT_EQ(before_agg->get_checkpoint().size(), after_agg->get_checkpoint().size());
for (int i = 0; i < before_agg->get_checkpoint().size(); i++)
for (size_t i = 0; i < before_agg->get_checkpoint().size(); i++)
{
ASSERT_EQ(before_agg->get_checkpoint()[i], after_agg->get_checkpoint()[i]);
}
for (int i = 0; i < before_agg->get_boundaries().size(); i++)
for (size_t i = 0; i < before_agg->get_boundaries().size(); i++)
{
ASSERT_EQ(before_agg->get_boundaries()[i], after_agg->get_boundaries()[i]);
}
for (int i = 0; i < before_agg->get_counts().size(); i++)
for (size_t i = 0; i < before_agg->get_counts().size(); i++)
{
ASSERT_EQ(before_agg->get_counts()[i], after_agg->get_counts()[i]);
}
Expand Down Expand Up @@ -512,7 +512,7 @@ TEST(PrometheusCollector, AddMetricDataWithExactRecordsSuccessfully)
else
{
ASSERT_EQ(before_agg->get_checkpoint().size(), after_agg->get_checkpoint().size());
for (int i = 0; i < before_agg->get_checkpoint().size(); i++)
for (size_t i = 0; i < before_agg->get_checkpoint().size(); i++)
{
ASSERT_EQ(before_agg->get_checkpoint()[i], after_agg->get_checkpoint()[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void assert_histogram(prometheus_client::MetricFamily &metric,
{
int cumulative_count = 0;
auto buckets = metric.metric[0].histogram.bucket;
for (int i = 0; i < buckets.size(); i++)
for (size_t i = 0; i < buckets.size(); i++)
{
auto bucket = buckets[i];
if (i != buckets.size() - 1)
Expand Down
12 changes: 6 additions & 6 deletions sdk/src/metrics/meter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void Meter::RecordShortBatch(const trace::KeyValueIterable &labels,
nostd::span<metrics_api::SynchronousInstrument<short> *> instruments,
nostd::span<const short> values) noexcept
{
for (int i = 0; i < instruments.size(); ++i)
for (size_t i = 0; i < instruments.size(); ++i)
{
instruments[i]->update(values[i], labels);
}
Expand All @@ -557,7 +557,7 @@ void Meter::RecordIntBatch(const trace::KeyValueIterable &labels,
nostd::span<metrics_api::SynchronousInstrument<int> *> instruments,
nostd::span<const int> values) noexcept
{
for (int i = 0; i < instruments.size(); ++i)
for (size_t i = 0; i < instruments.size(); ++i)
{
instruments[i]->update(values[i], labels);
}
Expand All @@ -567,7 +567,7 @@ void Meter::RecordFloatBatch(const trace::KeyValueIterable &labels,
nostd::span<metrics_api::SynchronousInstrument<float> *> instruments,
nostd::span<const float> values) noexcept
{
for (int i = 0; i < instruments.size(); ++i)
for (size_t i = 0; i < instruments.size(); ++i)
{
instruments[i]->update(values[i], labels);
}
Expand All @@ -577,7 +577,7 @@ void Meter::RecordDoubleBatch(const trace::KeyValueIterable &labels,
nostd::span<metrics_api::SynchronousInstrument<double> *> instruments,
nostd::span<const double> values) noexcept
{
for (int i = 0; i < instruments.size(); ++i)
for (size_t i = 0; i < instruments.size(); ++i)
{
instruments[i]->update(values[i], labels);
}
Expand Down Expand Up @@ -738,7 +738,7 @@ bool Meter::IsValidName(nostd::string_view name)
return false;
else
{
for (int i = 0; i < name.size(); ++i)
for (size_t i = 0; i < name.size(); ++i)
{
if (!isalnum(name[i]) && name[i] != '_' && name[i] != '.' && name[i] != '-')
return false;
Expand All @@ -761,4 +761,4 @@ bool Meter::NameAlreadyUsed(nostd::string_view name)
}
} // namespace metrics
} // namespace sdk
OPENTELEMETRY_END_NAMESPACE
OPENTELEMETRY_END_NAMESPACE
2 changes: 1 addition & 1 deletion sdk/test/metrics/sketch_aggregator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST(Sketch, NormalValues)
EXPECT_EQ(alpha.get_counts(), correct);

std::vector<double> captured_bounds = alpha.get_boundaries();
for (int i = 0; i < captured_bounds.size(); i++)
for (size_t i = 0; i < captured_bounds.size(); i++)
{
captured_bounds[i] = round(captured_bounds[i]);
}
Expand Down