-
Notifications
You must be signed in to change notification settings - Fork 509
add validation in MetricCollector constructor and enhance related tests #3724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,17 +30,31 @@ namespace metrics | |||||
|
|
||||||
| MetricCollector::MetricCollector(opentelemetry::sdk::metrics::MeterContext *context, | ||||||
| std::shared_ptr<MetricReader> metric_reader, | ||||||
| std::unique_ptr<MetricFilter> metric_filter) | ||||||
| std::unique_ptr<MetricFilter> metric_filter) noexcept | ||||||
| : meter_context_{context}, | ||||||
| metric_reader_{std::move(metric_reader)}, | ||||||
| metric_filter_(std::move(metric_filter)) | ||||||
| { | ||||||
| metric_reader_->SetMetricProducer(this); | ||||||
| if (!context) | ||||||
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::MetricCollector] - Error constructing MetricCollector." | ||||||
| << "The context is invalid"); | ||||||
| if (metric_reader_) | ||||||
| metric_reader_->SetMetricProducer(this); | ||||||
| else | ||||||
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::MetricCollector] - Error constructing MetricCollector." | ||||||
|
||||||
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::MetricCollector] - Error constructing MetricCollector." | |
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::MetricCollector] - Error constructing MetricCollector. " |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between the error message and the stream insertion. Should be: \"Error getting aggregation temporality. \" (with trailing space) for proper formatting.
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::GetAggregationTemporality] - Error getting aggregation temporality." | |
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::GetAggregationTemporality] - Error getting aggregation temporality. " |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between the error message and the stream insertion. Should be: \"Error during collecting. \" (with trailing space) for proper formatting.
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Collect] - Error during collecting." | |
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Collect] - Error during collecting. " |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between the error message and the stream insertion. Should be: \"Error during collecting. \" (with trailing space) for proper formatting.
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Collect] - Error during collecting." | |
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Collect] - Error during collecting. " |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between the error message and the stream insertion. Should be: \"Error accessing meter_reader_. \" (with trailing space) for proper formatting.
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::ForceFlush] - Error accessing meter_reader_." | |
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::ForceFlush] - Error accessing meter_reader_. " |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between the error message and the stream insertion. Should be: \"Error accessing meter_reader_. \" (with trailing space) for proper formatting.
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Shutdown] - Error accessing meter_reader_." | |
| OTEL_INTERNAL_LOG_ERROR("[MetricCollector::Shutdown] - Error accessing meter_reader_. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between the error message and the stream insertion. Should be:
\"Error constructing MetricCollector. \"(with trailing space) for proper formatting.