Skip to content

Commit 78a684c

Browse files
authored
[Metrics API] Remove unnecessary public observe methods (#2190)
1 parent af4527c commit 78a684c

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

opentelemetry/src/metrics/instruments/counter.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ impl<T> fmt::Debug for ObservableCounter<T> {
5353
}
5454
}
5555

56-
impl<T> ObservableCounter<T> {
57-
/// Records an increment to the counter.
58-
///
59-
/// It is only valid to call this within a callback. If called outside of the
60-
/// registered callback it should have no effect on the instrument, and an
61-
/// error will be reported via the error handler.
62-
pub fn observe(&self, value: T, attributes: &[KeyValue]) {
63-
self.0.observe(value, attributes)
64-
}
65-
}
66-
6756
impl<T> AsyncInstrument<T> for ObservableCounter<T> {
6857
fn observe(&self, measurement: T, attributes: &[KeyValue]) {
6958
self.0.observe(measurement, attributes)

opentelemetry/src/metrics/instruments/gauge.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,9 @@ where
4949
}
5050
}
5151

52-
impl<T> ObservableGauge<T> {
53-
/// Records the state of the instrument.
54-
///
55-
/// It is only valid to call this within a callback. If called outside of the
56-
/// registered callback it should have no effect on the instrument, and an
57-
/// error will be reported via the error handler.
58-
pub fn observe(&self, measurement: T, attributes: &[KeyValue]) {
59-
self.0.observe(measurement, attributes)
60-
}
61-
}
62-
6352
impl<M> AsyncInstrument<M> for ObservableGauge<M> {
6453
fn observe(&self, measurement: M, attributes: &[KeyValue]) {
65-
self.observe(measurement, attributes)
54+
self.0.observe(measurement, attributes)
6655
}
6756
}
6857

opentelemetry/src/metrics/instruments/up_down_counter.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ impl<T> ObservableUpDownCounter<T> {
5959
pub fn new(inner: Arc<dyn AsyncInstrument<T>>) -> Self {
6060
ObservableUpDownCounter(inner)
6161
}
62-
63-
/// Records the increment or decrement to the counter.
64-
///
65-
/// It is only valid to call this within a callback. If called outside of the
66-
/// registered callback it should have no effect on the instrument, and an
67-
/// error will be reported via the error handler.
68-
pub fn observe(&self, value: T, attributes: &[KeyValue]) {
69-
self.0.observe(value, attributes)
70-
}
7162
}
7263

7364
impl<T> AsyncInstrument<T> for ObservableUpDownCounter<T> {

0 commit comments

Comments
 (0)