From 5788287d49235a057d95937528edbbc51c86f3c5 Mon Sep 17 00:00:00 2001 From: Ehsan Saei <71217171+esigo@users.noreply.github.com> Date: Sun, 28 Aug 2022 21:03:36 +0200 Subject: [PATCH] metrics warnings (#1583) --- sdk/include/opentelemetry/sdk/metrics/instruments.h | 3 ++- sdk/test/metrics/async_metric_storage_test.cc | 1 - sdk/test/metrics/metric_reader_test.cc | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/metrics/instruments.h b/sdk/include/opentelemetry/sdk/metrics/instruments.h index 22fdba2879..a529095600 100644 --- a/sdk/include/opentelemetry/sdk/metrics/instruments.h +++ b/sdk/include/opentelemetry/sdk/metrics/instruments.h @@ -4,6 +4,7 @@ #pragma once #ifndef ENABLE_METRICS_PREVIEW # include +# include "opentelemetry/common/macros.h" # include "opentelemetry/sdk/common/attribute_utils.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -61,7 +62,7 @@ struct InstrumentDescriptor using MetricAttributes = opentelemetry::sdk::common::OrderedAttributeMap; using AggregationTemporalitySelector = std::function; -static InstrumentClass GetInstrumentClass(InstrumentType type) +OPENTELEMETRY_MAYBE_UNUSED static InstrumentClass GetInstrumentClass(InstrumentType type) { if (type == InstrumentType::kCounter || type == InstrumentType::kHistogram || type == InstrumentType::kUpDownCounter) diff --git a/sdk/test/metrics/async_metric_storage_test.cc b/sdk/test/metrics/async_metric_storage_test.cc index 5bda35553d..0a7d81cf5c 100644 --- a/sdk/test/metrics/async_metric_storage_test.cc +++ b/sdk/test/metrics/async_metric_storage_test.cc @@ -98,7 +98,6 @@ TEST_P(WritableMetricStorageTestFixture, TestAggregation) std::shared_ptr collector(new MockCollectorHandle(temporality)); std::vector> collectors; collectors.push_back(collector); - size_t count_attributes = 0; std::unique_ptr default_attributes_processor{ new DefaultAttributesProcessor{}}; diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index 9a6f31d61c..68aac58cf1 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -27,7 +27,6 @@ class MockMetricReader : public MetricReader TEST(MetricReaderTest, BasicTests) { - AggregationTemporality aggr_temporality = AggregationTemporality::kDelta; std::unique_ptr metric_reader1(new MockMetricReader()); EXPECT_EQ(metric_reader1->GetAggregationTemporality(InstrumentType::kCounter), AggregationTemporality::kCumulative);