1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#include "common.h"
#include <utility>
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_;
}
|