1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
5 #ifdef ENABLE_METRICS_PREVIEW
7 # include "opentelemetry/_metrics/instrument.h"
8 # include "opentelemetry/nostd/shared_ptr.h"
10 OPENTELEMETRY_BEGIN_NAMESPACE
15 * ObserverResult class is necessary for the callback recording asynchronous
16 * instrument use. Callback functions asynchronous instruments are designed to
17 * accept a single ObserverResult object and update using its pointer to the
26 ObserverResult() = default;
28 ObserverResult(AsynchronousInstrument
<T
> *instrument
) : instrument_(instrument
) {}
30 virtual void observe(T value
, const common::KeyValueIterable
&labels
)
32 instrument_
->observe(value
, labels
);
36 AsynchronousInstrument
<T
> *instrument_
;
39 } // namespace metrics
40 OPENTELEMETRY_END_NAMESPACE