-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
16 changed files
with
336 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "common.h" | ||
|
||
using namespace opentelemetry; | ||
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_; | ||
} |
Oops, something went wrong.