Class MetricCollector

Inheritance Relationships

Base Types

  • public opentelemetry::sdk::metrics::MetricProducer (Class MetricProducer)

  • public opentelemetry::sdk::metrics::CollectorHandle

Class Documentation

class MetricCollector : public opentelemetry::sdk::metrics::MetricProducer, public opentelemetry::sdk::metrics::CollectorHandle

An internal opaque interface that the MetricReader receives as MetricProducer. It acts as the storage key to the internal metric stream state for each MetricReader.

Public Functions

MetricCollector(MeterContext *context, std::shared_ptr<MetricReader> metric_reader)
~MetricCollector() override = default
AggregationTemporality GetAggregationTemporality(InstrumentType instrument_type) noexcept override
virtual bool Collect(nostd::function_ref<bool(ResourceMetrics &metric_data)> callback) noexcept override

The callback to be called for each metric exporter. This will only be those metrics that have been produced since the last time this method was called.

Returns:

a status of completion of method.

bool ForceFlush(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept