Class MeterProvider
Defined in File meter_provider.h
Inheritance Relationships
Base Type
public opentelemetry::metrics::MeterProvider
(Class MeterProvider)
Class Documentation
-
class MeterProvider : public opentelemetry::metrics::MeterProvider
Public Functions
-
MeterProvider(std::unique_ptr<ViewRegistry> views = std::unique_ptr<ViewRegistry>(new ViewRegistry()), const sdk::resource::Resource &resource = sdk::resource::Resource::Create({})) noexcept
Initialize a new meter provider
- Parameters:
views – The views for this meter provider
resource – The resources for this meter provider.
-
explicit MeterProvider(std::unique_ptr<MeterContext> context) noexcept
Initialize a new meter provider with a specified context
- Parameters:
context – The owned meter configuration/pipeline for this provider.
-
nostd::shared_ptr<opentelemetry::metrics::Meter> GetMeter(nostd::string_view name, nostd::string_view version = "", nostd::string_view schema_url = "") noexcept override
-
const sdk::resource::Resource &GetResource() const noexcept
Obtain the resource associated with this meter provider.
- Returns:
The resource for this meter provider.
Attaches a metric reader to list of configured readers for this Meter providers.
Note: This reader may not receive any in-flight meter data, but will get newly created meter data. Note: This method is not thread safe, and should ideally be called from main thread.
- Parameters:
reader – The metric reader for this meter provider. This must not be a nullptr.
-
void AddView(std::unique_ptr<InstrumentSelector> instrument_selector, std::unique_ptr<MeterSelector> meter_selector, std::unique_ptr<View> view) noexcept
Attaches a View
to list of configured Views for this Meter provider.
Note: This view may not receive any in-flight meter data, but will get newly created meter data. Note: This method is not thread safe, and should ideally be called from main thread.
- Parameters:
view – The Views for this meter provider. This must not be a nullptr.
-
bool Shutdown() noexcept
Shutdown the meter provider.
-
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept
Force flush the meter provider.
-
~MeterProvider() override
-
MeterProvider(std::unique_ptr<ViewRegistry> views = std::unique_ptr<ViewRegistry>(new ViewRegistry()), const sdk::resource::Resource &resource = sdk::resource::Resource::Create({})) noexcept