fgerlits commented on a change in pull request #1081:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1081#discussion_r640457552
##########
File path: extensions/pdh/PerformanceDataMonitor.cpp
##########
@@ -249,32 +265,54 @@ void
PerformanceDataMonitor::addCustomPDHCountersFromProperty(const std::string&
}
}
-void PerformanceDataMonitor::setupMembersFromProperties(const
std::shared_ptr<core::ProcessContext>& context) {
- std::string predefined_groups;
- if (context->getProperty(PredefinedGroups.getName(), predefined_groups)) {
- logger_->log_trace("Predefined group configured to be %s",
predefined_groups);
- addCountersFromPredefinedGroupsProperty(predefined_groups);
- }
-
+void PerformanceDataMonitor::setupCountersFromProperties(const
std::shared_ptr<core::ProcessContext>& context) {
std::string custom_pdh_counters;
if (context->getProperty(CustomPDHCounters.getName(), custom_pdh_counters)) {
logger_->log_trace("Custom PDH counters configured to be %s",
custom_pdh_counters);
addCustomPDHCountersFromProperty(custom_pdh_counters);
}
+}
+
+void PerformanceDataMonitor::setupPredefinedGroupsFromProperties(const
std::shared_ptr<core::ProcessContext>& context) {
+ std::string predefined_groups;
+ if (context->getProperty(PredefinedGroups.getName(), predefined_groups)) {
+ logger_->log_trace("Predefined group configured to be %s",
predefined_groups);
+ addCountersFromPredefinedGroupsProperty(predefined_groups);
+ }
+}
+void PerformanceDataMonitor::setupOutputFormatFromProperties(const
std::shared_ptr<core::ProcessContext>& context) {
std::string output_format_string;
if (context->getProperty(OutputFormatProperty.getName(),
output_format_string)) {
- if (output_format_string == OPEN_TELEMETRY_FORMAT_STR) {
- logger_->log_trace("OutputFormat is configured to be OpenTelemetry");
+ if (output_format_string == PRETTY_OPEN_TELEMETRY_FORMAT_STR ||
output_format_string == COMPACT_OPEN_TELEMETRY_FORMAT_STR) {
output_format_ = OutputFormat::OPENTELEMETRY;
- } else if (output_format_string == JSON_FORMAT_STR) {
- logger_->log_trace("OutputFormat is configured to be JSON");
+ pretty_output_ = output_format_string ==
PRETTY_OPEN_TELEMETRY_FORMAT_STR;
+ } else if (output_format_string == PRETTY_JSON_FORMAT_STR ||
output_format_string == COMPACT_JSON_FORMAT_STR) {
output_format_ = OutputFormat::JSON;
+ pretty_output_ = output_format_string == PRETTY_JSON_FORMAT_STR;
} else {
- logger_->log_error("Invalid OutputFormat, defaulting to JSON");
- output_format_ = OutputFormat::JSON;
+ throw Exception(PROCESS_SCHEDULE_EXCEPTION, "Invalid
PerformanceDataMonitor Output Format: " + output_format_string);
}
}
+ logger_->log_trace("OutputFormat is configured to be %s %s", pretty_output_
? "pretty" : "compact", output_format_ == OutputFormat::JSON ? "JSON" :
"OpenTelemtry");
Review comment:
typo: OpenTelemtry -> OpenTelemetry
##########
File path: extensions/pdh/tests/PerformanceDataMonitorTests.cpp
##########
@@ -136,8 +136,9 @@ TEST_CASE("PerformanceDataMonitorCustomPDHCountersTest",
"[performancedatamonito
Review comment:
I have seen the assertion at line 127 fail seemingly randomly in some CI
jobs (I think they were all Windows 2017 jobs). Any idea why that happens?
##########
File path: extensions/pdh/PerformanceDataCounter.h
##########
@@ -18,6 +18,7 @@
#include <string>
#include "rapidjson/document.h"
+#include "utils/OptionalUtils.h"
Review comment:
this `#include` is not used
##########
File path: extensions/pdh/PerformanceDataMonitor.cpp
##########
@@ -45,9 +45,13 @@ core::Property PerformanceDataMonitor::CustomPDHCounters(
core::Property PerformanceDataMonitor::OutputFormatProperty(
core::PropertyBuilder::createProperty("Output Format")->
withDescription("Format of the created flowfiles")->
- withAllowableValue<std::string>(JSON_FORMAT_STR)->
- withAllowableValue(OPEN_TELEMETRY_FORMAT_STR)->
- withDefaultValue(JSON_FORMAT_STR)->build());
+ withAllowableValues<std::string>({ PRETTY_JSON_FORMAT_STR,
COMPACT_JSON_FORMAT_STR, PRETTY_OPEN_TELEMETRY_FORMAT_STR,
COMPACT_OPEN_TELEMETRY_FORMAT_STR })->
Review comment:
I would prefer two separate properties: `Output Format = JSON |
OPEN_TELEMETRY` and `Output Style = PRETTY | COMPACT`, as that would make the
code simpler, and I think the interface would be clearer, too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]