| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- // Copyright The OpenTelemetry Authors
- // SPDX-License-Identifier: Apache-2.0
- #include "common.h"
- #include <utility>
- #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
- using namespace opentelemetry::sdk::instrumentationscope;
- using namespace opentelemetry::sdk::metrics;
- using namespace opentelemetry::sdk::common;
- // MockMetricExporter
- ExportResult MockMetricExporter::Export(const ResourceMetrics & /*resource_metrics*/) noexcept
- {
- return ExportResult::kSuccess;
- }
- AggregationTemporality MockMetricExporter::GetAggregationTemporality(
- InstrumentType /*instrument_type*/) const noexcept
- {
- return AggregationTemporality::kCumulative;
- }
- bool MockMetricExporter::ForceFlush(std::chrono::microseconds /* timeout */) noexcept
- {
- return true;
- }
- bool MockMetricExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept
- {
- return true;
- }
- // MockMetricReader
- MockMetricReader::MockMetricReader(std::unique_ptr<PushMetricExporter> exporter)
- : exporter_(std::move(exporter))
- {}
- MockMetricReader::MockMetricReader() : exporter_{new MockMetricExporter()} {}
- AggregationTemporality MockMetricReader::GetAggregationTemporality(
- InstrumentType instrument_type) const noexcept
- {
- return exporter_->GetAggregationTemporality(instrument_type);
- }
- bool MockMetricReader::OnForceFlush(std::chrono::microseconds /* timeout */) noexcept
- {
- return true;
- }
- bool MockMetricReader::OnShutDown(std::chrono::microseconds /* timeout */) noexcept
- {
- return true;
- }
- void MockMetricReader::OnInitialized() noexcept {}
- // MockCollectorHandle
- MockCollectorHandle::MockCollectorHandle(AggregationTemporality temp) : temporality_(temp) {}
- AggregationTemporality MockCollectorHandle::GetAggregationTemporality(
- InstrumentType /* instrument_type */) noexcept
- {
- return temporality_;
- }
|