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

Global error handler cleanup - Metrics SDK #2185

Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
704b848
initial commit
lalitb Oct 8, 2024
b8cb6af
change name for exponential histogram
lalitb Oct 8, 2024
a0b6eee
Merge branch 'main' into global-error-handler-cleanup-metrics-sdk
lalitb Oct 9, 2024
acf97fa
rever changes
lalitb Oct 9, 2024
7b48f14
Update opentelemetry-sdk/src/metrics/internal/mod.rs
lalitb Oct 9, 2024
ac61b79
convert otel_error to otel_warn for cardinality limit
lalitb Oct 9, 2024
a42d516
log both existing and new instrument values
lalitb Oct 9, 2024
dbaa7f5
Merge branch 'main' into global-error-handler-cleanup-metrics-sdk
lalitb Oct 9, 2024
73fca4d
build error
lalitb Oct 9, 2024
ee5c5f5
Merge branch 'global-error-handler-cleanup-metrics-sdk' of github.com…
lalitb Oct 9, 2024
3aa97cf
remove formatting in wrapper macros
lalitb Oct 10, 2024
de54afe
Merge branch 'main' into global-error-handler-cleanup-metrics-sdk
lalitb Oct 23, 2024
e62de04
Merge branch 'main' into global-error-handler-cleanup-metrics-sdk
lalitb Oct 23, 2024
bda9faa
review comments
lalitb Oct 23, 2024
4a34922
resolve conflict
lalitb Oct 23, 2024
0087c24
lint error
lalitb Oct 23, 2024
115e73f
add comment for exponential histogram
lalitb Oct 23, 2024
56682a4
fix
lalitb Oct 23, 2024
7e48cbf
Update opentelemetry-sdk/src/metrics/internal/mod.rs
lalitb Oct 23, 2024
d81b374
use message for otel_warn
lalitb Oct 23, 2024
4b09c92
merge conflict
lalitb Oct 23, 2024
949930e
Update opentelemetry-sdk/src/metrics/meter.rs
lalitb Oct 23, 2024
6dcc9eb
Update opentelemetry-sdk/src/metrics/internal/mod.rs
lalitb Oct 23, 2024
4b42fe8
Update opentelemetry-sdk/src/metrics/meter.rs
lalitb Oct 23, 2024
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
5 changes: 5 additions & 0 deletions opentelemetry-sdk/src/metrics/internal/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
size < STREAM_CARDINALITY_LIMIT as usize
}

/// Checks whether aggregator has hit cardinality limit for metric streams
pub(crate) fn cardinality_limit() -> usize {
STREAM_CARDINALITY_LIMIT as usize
}

Check warning on line 22 in opentelemetry-sdk/src/metrics/internal/aggregate.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/internal/aggregate.rs#L20-L22

Added lines #L20 - L22 were not covered by tests

/// Receives measurements to be aggregated.
pub(crate) trait Measure<T>: Send + Sync + 'static {
fn call(&self, measurement: T, attrs: &[KeyValue]);
Expand Down
21 changes: 17 additions & 4 deletions opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::HashMap, f64::consts::LOG2_E, sync::Mutex, time::SystemTime};

use once_cell::sync::Lazy;
use opentelemetry::{metrics::MetricsError, KeyValue};
use opentelemetry::{otel_error, KeyValue};

use crate::{
metrics::data::{self, Aggregation, Temporality},
Expand Down Expand Up @@ -100,9 +100,22 @@
if (self.scale - scale_delta as i8) < EXPO_MIN_SCALE {
// With a scale of -10 there is only two buckets for the whole range of f64 values.
// This can only happen if there is a max size of 1.
opentelemetry::global::handle_error(MetricsError::Other(
"exponential histogram scale underflow".into(),
));

// This error is logged when a measurement is dropped because its value is either too high
// or too low, falling outside the allowable range defined by the scale and max_size.
// If these values are expected, the user should adjust the histogram configuration
// to accommodate the range.
otel_error!(

Check warning on line 108 in opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs#L108

Added line #L108 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

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

I don't know the inner workings enough to give a strong opinion - but unless this is a auto recoverable error, this can flood the error log.

Copy link
Member Author

@lalitb lalitb Oct 23, 2024

Choose a reason for hiding this comment

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

As what I can understand this part of code, this error occurs with restrictive max_size configuration, while the application is recording measurements with values that are far apart than what allowed by max_size. And error would be logged whenever the faulty measurement is recorded. If these faulty measurements are not frequent, the error log won't be flooded, else it can. Again, either some kind of throttling or simply flag to log only once need to be added. Let me know what you suggest, else I can keep TODO to revisit.

Copy link
Member

Choose a reason for hiding this comment

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

Unless we are 100% sure this cannot cause flooding of logs, lets remove the log from here, and leave a TODO to add logging once we understand more.

name: "ExponentialHistogramDataPoint.Scale.Underflow",
current_scale = self.scale,
scale_delta = scale_delta,
max_size = self.max_size,
min_scale = EXPO_MIN_SCALE,
record_min_max = self.record_min_max,
record_sum = self.record_sum,
value = format!("{:?}", v),
error = format!("The measurement will be dropped due to scale underflow. Check the histogram configuration")

Check warning on line 117 in opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs#L110-L117

Added lines #L110 - L117 were not covered by tests
);
return;
}
// Downscale
Expand Down
11 changes: 6 additions & 5 deletions opentelemetry-sdk/src/metrics/internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, AtomicUsize, Ordering};
use std::sync::{Arc, RwLock};

use aggregate::is_under_cardinality_limit;
use aggregate::{cardinality_limit, is_under_cardinality_limit};
pub(crate) use aggregate::{AggregateBuilder, ComputeAggregation, Measure};
pub(crate) use exponential_histogram::{EXPO_MAX_SCALE, EXPO_MIN_SCALE};
use once_cell::sync::Lazy;
use opentelemetry::metrics::MetricsError;
use opentelemetry::{global, otel_warn, KeyValue};
use opentelemetry::{otel_warn, KeyValue};

use crate::metrics::AttributeSet;

Expand Down Expand Up @@ -146,9 +146,10 @@
let new_tracker = AU::new_atomic_tracker(self.buckets_count);
O::update_tracker(&new_tracker, measurement, index);
trackers.insert(STREAM_OVERFLOW_ATTRIBUTES.clone(), Arc::new(new_tracker));
global::handle_error(MetricsError::Other("Warning: Maximum data points for metric stream exceeded. Entry added to overflow. Subsequent overflows to same metric until next collect will not be logged.".into()));
otel_warn!( name: "ValueMap.measure",
message = "Maximum data points for metric stream exceeded. Entry added to overflow. Subsequent overflows to same metric until next collect will not be logged."
//TODO - include name of meter, instrument
otel_warn!( name: "MetricCardinalityLimitReached",
error = format!("{}", MetricsError::Other("Maximum data points for metric stream exceeded. Entry added to overflow. Subsequent overflows to same metric until next collect will not be logged.".into())),
lalitb marked this conversation as resolved.
Show resolved Hide resolved
lalitb marked this conversation as resolved.
Show resolved Hide resolved
cardinality_limit = cardinality_limit() as u64,

Check warning on line 152 in opentelemetry-sdk/src/metrics/internal/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/internal/mod.rs#L151-L152

Added lines #L151 - L152 were not covered by tests
);
}
}
Expand Down
6 changes: 2 additions & 4 deletions opentelemetry-sdk/src/metrics/manual_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
};

use opentelemetry::{
global,
metrics::{MetricsError, Result},
otel_debug,
};

use super::{
Expand Down Expand Up @@ -77,9 +77,7 @@
if inner.sdk_producer.is_none() {
inner.sdk_producer = Some(pipeline);
} else {
global::handle_error(MetricsError::Config(
"duplicate reader registration, did not register manual reader".into(),
))
otel_debug!(name: "ManualReader.RegisterPipeline.DuplicateRegistration");

Check warning on line 80 in opentelemetry-sdk/src/metrics/manual_reader.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/manual_reader.rs#L80

Added line #L80 was not covered by tests
}
});
}
Expand Down
126 changes: 92 additions & 34 deletions opentelemetry-sdk/src/metrics/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
use std::{borrow::Cow, sync::Arc};

use opentelemetry::{
global,
metrics::{
AsyncInstrumentBuilder, Counter, Gauge, Histogram, HistogramBuilder, InstrumentBuilder,
InstrumentProvider, MetricsError, ObservableCounter, ObservableGauge,
ObservableUpDownCounter, Result, UpDownCounter,
},
otel_error,
};

use crate::instrumentation::Scope;
Expand Down Expand Up @@ -75,14 +75,18 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
Copy link
Member

Choose a reason for hiding this comment

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

otel_error!(
name: "InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
message = "Measurements from this instrument will be ignored."
reason = fmt(err))

^ I prefer this version. Please see if this is better for end users.

Copy link
Member

Choose a reason for hiding this comment

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

Error vs Warning - this is debatable. We need to find some agreement to follow throughout.
If entire telemetry flow is affected, then Error is apt.
for missing measurements from a single instrument - warn might be sufficient. This is good to be followed up separately anyway.

name: "SdkMeter.CreateCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 82 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L80-L82

Added lines #L80 - L82 were not covered by tests
lalitb marked this conversation as resolved.
Show resolved Hide resolved
return Counter::new(Arc::new(NoopSyncInstrument::new()));
}

match resolver
.lookup(
InstrumentKind::Counter,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
None,
Expand All @@ -91,7 +95,12 @@
{
Ok(counter) => counter,
Err(err) => {
global::handle_error(err);
otel_error!(

Check warning on line 98 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L98

Added line #L98 was not covered by tests
name: "SdkMeter.CreateCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err)

Check warning on line 102 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L100-L102

Added lines #L100 - L102 were not covered by tests
);
Counter::new(Arc::new(NoopSyncInstrument::new()))
}
}
Expand All @@ -107,34 +116,41 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
name: "SdkMeter.CreateObservableCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 123 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L121-L123

Added lines #L121 - L123 were not covered by tests
return ObservableCounter::new();
}

match resolver.measures(
InstrumentKind::ObservableCounter,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
None,
) {
Ok(ms) => {
if ms.is_empty() {
otel_error!(

Check warning on line 136 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L136

Added line #L136 was not covered by tests
name: "SdkMeter.CreateObservableCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),

Check warning on line 139 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L138-L139

Added lines #L138 - L139 were not covered by tests
message = "Measurements from the instrument will be ignored. Reason: View Configuration / Drop Aggregation"
);
return ObservableCounter::new();
}

let observable = Arc::new(Observable::new(ms));

for callback in builder.callbacks {
let cb_inst = Arc::clone(&observable);
self.pipes
.register_callback(move || callback(cb_inst.as_ref()));
}

ObservableCounter::new()
}
Err(err) => {
global::handle_error(err);
Err(_err) => {
// TBD - Add error handling

Check warning on line 153 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L152-L153

Added lines #L152 - L153 were not covered by tests
lalitb marked this conversation as resolved.
Show resolved Hide resolved
ObservableCounter::new()
}
}
Expand All @@ -150,34 +166,41 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
name: "SdkMeter.CreateObservableUpDownCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 173 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L171-L173

Added lines #L171 - L173 were not covered by tests
return ObservableUpDownCounter::new();
}

match resolver.measures(
InstrumentKind::ObservableUpDownCounter,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
None,
) {
Ok(ms) => {
if ms.is_empty() {
otel_error!(

Check warning on line 186 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L186

Added line #L186 was not covered by tests
name: "SdkMeter.CreateUpDownObservableCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),

Check warning on line 189 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L188-L189

Added lines #L188 - L189 were not covered by tests
message = "Measurements from the instrument will be ignored. Reason: View Configuration / Drop Aggregation"
);
return ObservableUpDownCounter::new();
}

let observable = Arc::new(Observable::new(ms));

for callback in builder.callbacks {
let cb_inst = Arc::clone(&observable);
self.pipes
.register_callback(move || callback(cb_inst.as_ref()));
}

ObservableUpDownCounter::new()
}
Err(err) => {
global::handle_error(err);
Err(_err) => {
// TBD - Add error handling

Check warning on line 203 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L202-L203

Added lines #L202 - L203 were not covered by tests
ObservableUpDownCounter::new()
}
}
Expand All @@ -193,34 +216,41 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
name: "SdkMeter.CreateObservableGauge.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 223 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L221-L223

Added lines #L221 - L223 were not covered by tests
return ObservableGauge::new();
}

match resolver.measures(
InstrumentKind::ObservableGauge,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
None,
) {
Ok(ms) => {
if ms.is_empty() {
otel_error!(

Check warning on line 236 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L236

Added line #L236 was not covered by tests
name: "SdkMeter.CreateObservableGauge.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),

Check warning on line 239 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L238-L239

Added lines #L238 - L239 were not covered by tests
message = "Measurements from the instrument will be ignored. Reason: View Configuration / Drop Aggregation"
);
return ObservableGauge::new();
}

let observable = Arc::new(Observable::new(ms));

for callback in builder.callbacks {
let cb_inst = Arc::clone(&observable);
self.pipes
.register_callback(move || callback(cb_inst.as_ref()));
}

ObservableGauge::new()
}
Err(err) => {
global::handle_error(err);
Err(_err) => {
//TBD - Add error handling

Check warning on line 253 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L252-L253

Added lines #L252 - L253 were not covered by tests
ObservableGauge::new()
}
}
Expand All @@ -236,14 +266,18 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
name: "SdkMeter.CreateUpDownCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 273 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L271-L273

Added lines #L271 - L273 were not covered by tests
return UpDownCounter::new(Arc::new(NoopSyncInstrument::new()));
}

match resolver
.lookup(
InstrumentKind::UpDownCounter,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
None,
Expand All @@ -252,7 +286,12 @@
{
Ok(updown_counter) => updown_counter,
Err(err) => {
global::handle_error(err);
otel_error!(

Check warning on line 289 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L289

Added line #L289 was not covered by tests
name: "SdkMeter.CreateUpDownCounter.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err)

Check warning on line 293 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L291-L293

Added lines #L291 - L293 were not covered by tests
);
UpDownCounter::new(Arc::new(NoopSyncInstrument::new()))
}
}
Expand All @@ -268,14 +307,18 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
name: "SdkMeter.CreateGauge.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 314 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L312-L314

Added lines #L312 - L314 were not covered by tests
return Gauge::new(Arc::new(NoopSyncInstrument::new()));
}

match resolver
.lookup(
InstrumentKind::Gauge,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
None,
Expand All @@ -284,7 +327,12 @@
{
Ok(gauge) => gauge,
Err(err) => {
global::handle_error(err);
otel_error!(

Check warning on line 330 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L330

Added line #L330 was not covered by tests
name: "SdkMeter.CreateGauge.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err)

Check warning on line 334 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L332-L334

Added lines #L332 - L334 were not covered by tests
);
Gauge::new(Arc::new(NoopSyncInstrument::new()))
}
}
Expand All @@ -300,14 +348,19 @@
{
let validation_result = validate_instrument_config(builder.name.as_ref(), &builder.unit);
if let Err(err) = validation_result {
global::handle_error(err);
otel_error!(
name: "SdkMeter.CreateHistogram.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err));

Check warning on line 355 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L353-L355

Added lines #L353 - L355 were not covered by tests

return Histogram::new(Arc::new(NoopSyncInstrument::new()));
}

match resolver
.lookup(
InstrumentKind::Histogram,
builder.name,
builder.name.clone(),
builder.description,
builder.unit,
builder.boundaries,
Expand All @@ -316,7 +369,12 @@
{
Ok(histogram) => histogram,
Err(err) => {
global::handle_error(err);
otel_error!(

Check warning on line 372 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L372

Added line #L372 was not covered by tests
name: "SdkMeter.CreateHistogram.InstrumentCreationFailed",
meter_name = self.scope.name.as_ref(),
instrument_name = builder.name.as_ref(),
error = format!("Measurements from the instrument will be ignored. Reason: {}", err)

Check warning on line 376 in opentelemetry-sdk/src/metrics/meter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/meter.rs#L374-L376

Added lines #L374 - L376 were not covered by tests
);
Histogram::new(Arc::new(NoopSyncInstrument::new()))
}
}
Expand Down
Loading
Loading