Skip to content

Commit 24a8c0e

Browse files
committed
vary Create call by otel version
1 parent 55a375a commit 24a8c0e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

google/cloud/storage/internal/grpc/metrics_meter_provider.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ void AddHistogramView(opentelemetry::sdk::metrics::MeterProvider& provider,
6666
// These are useful on Windows with DLLs and mixed CRTs, and we should try to
6767
// them if they are available.
6868
#if OPENTELEMETRY_VERSION_MAJOR > 1 || \
69-
(OPENTELEMETRY_VERSION_MAJOR == 1 && OPENTELEMETRY_VERSION_MINOR >= 10)
69+
(OPENTELEMETRY_VERSION_MAJOR == 1 && OPENTELEMETRY_VERSION_MINOR >= 23)
70+
(void)unit;
7071
provider.AddView(
7172
opentelemetry::sdk::metrics::InstrumentSelectorFactory::Create(
7273
opentelemetry::sdk::metrics::InstrumentType::kHistogram, name, unit),
@@ -76,6 +77,17 @@ void AddHistogramView(opentelemetry::sdk::metrics::MeterProvider& provider,
7677
name, std::move(description),
7778
opentelemetry::sdk::metrics::AggregationType::kHistogram,
7879
std::move(aggregation_config)));
80+
#elif OPENTELEMETRY_VERSION_MAJOR > 1 || \
81+
(OPENTELEMETRY_VERSION_MAJOR == 1 && OPENTELEMETRY_VERSION_MINOR >= 10)
82+
provider.AddView(
83+
opentelemetry::sdk::metrics::InstrumentSelectorFactory::Create(
84+
opentelemetry::sdk::metrics::InstrumentType::kHistogram, name, unit),
85+
opentelemetry::sdk::metrics::MeterSelectorFactory::Create(
86+
kGrpcMeterName, grpc::Version(), kGrpcSchema),
87+
opentelemetry::sdk::metrics::ViewFactory::Create(
88+
name, std::move(description), unit,
89+
opentelemetry::sdk::metrics::AggregationType::kHistogram,
90+
std::move(aggregation_config)));
7991
#else
8092
(void)unit;
8193
provider.AddView(

0 commit comments

Comments
 (0)