Skip to content
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

MINIFICPP-2502 Add processorBulletins C2 metric node to FlowInformation #1920

Open
wants to merge 2 commits into
base: MINIFICPP-2512
Choose a base branch
from

Conversation

lordgamez
Copy link
Contributor

https://issues.apache.org/jira/browse/MINIFICPP-2502

Depends on #1918


Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.

@lordgamez lordgamez force-pushed the MINIFICPP-2502 branch 2 times, most recently from 032cc42 to 90baa4e Compare January 28, 2025 19:05
@lordgamez lordgamez marked this pull request as ready for review January 29, 2025 08:15
@martinzink martinzink added the minifi-api Targets the minifi-api branch label Jan 30, 2025
@@ -109,6 +140,7 @@ class LoggerBase : public Logger {

private:
std::atomic<int> max_log_size_{LOG_BUFFER_SIZE};
std::vector<std::function<void(LOG_LEVEL level, const std::string&)>> log_callbacks_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need multiple callbacks? If not, I'd say keep it simple and only have one.

Comment on lines +83 to +111
inline std::string mapLogLevelToString(LOG_LEVEL level) {
switch (level) {
case trace: return "TRACE";
case debug: return "DEBUG";
case info: return "INFO";
case warn: return "WARN";
case err: return "ERROR";
case critical: return "CRITICAL";
case off: return "OFF";
}
throw std::invalid_argument(fmt::format("Invalid LOG_LEVEL {}", magic_enum::enum_underlying(level)));
}

inline LOG_LEVEL mapStringToLogLevel(const std::string& level_str) {
if (level_str == "TRACE") {
return trace;
} else if (level_str == "DEBUG") {
return debug;
} else if (level_str == "INFO") {
return info;
} else if (level_str == "WARN") {
return warn;
} else if (level_str == "ERROR") {
return err;
} else if (level_str == "CRITICAL") {
return critical;
}
throw std::invalid_argument(fmt::format("Invalid LOG_LEVEL {}", level_str));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mapping is already defined elsewhere, check LogUtils.h (and maybe rename it if you have a better idea)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I checked LogUtils.h only contains mappings for the enum class LogLevelOption, but not for the enum LOG_LEVEL. As I remember we had a brief discussion about standardizing log level representation last year as we have different log level representations in different classes all around the project, but that should be done in a separate PR.

Comment on lines 129 to 130
auto message = stringify(std::move(fmt), map_args(std::forward<Args>(args))...);
log_string(level, message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change? it pessimizes the code by forcing another copy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a previous iteration it was used in multiple functions, it was left this way by mistake after it was changed, fixed in 37c777f

@lordgamez lordgamez removed the minifi-api Targets the minifi-api branch label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants