-
Notifications
You must be signed in to change notification settings - Fork 2.9k
NIFI-15351 Show NiFi build information in Prometheus metrics #10655
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
Conversation
|
@agturley Thanks for the contribution. In the scan build there is the following error and in the Validate build there is the following errors These errors must be fixed before this PR can be accepted. |
|
Hopefully I addressed the build errors. Thanks! |
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
Show resolved
Hide resolved
| LOGGER.debug("Could not retrieve NiFi bundle details for version info metric: {}", e.getMessage()); | ||
| } |
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.
Stack trace may be helpful
| LOGGER.debug("Could not retrieve NiFi bundle details for version info metric: {}", e.getMessage()); | |
| } | |
| LOGGER.debug("Could not retrieve NiFi bundle details for version info metric", e); | |
| } |
|
added license block and added stack trace to debug message |
exceptionfactory
left a comment
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.
Thanks for this addition @agturley. The basic approach looks good, I recommended a few adjustments.
| public static class VersionDetails { | ||
|
|
||
| public final String nifiVersion; | ||
| public final String revision; | ||
| public final String tag; | ||
| public final String buildBranch; | ||
| public final String javaVersion; | ||
| public final String javaVendor; | ||
| public final String osVersion; | ||
| public final String osName; | ||
| public final String osArchitecture; |
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.
Instead of a class with public variables, this should be a record.
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
Outdated
Show resolved
Hide resolved
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
Outdated
Show resolved
Hide resolved
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
Outdated
Show resolved
Hide resolved
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
Outdated
Show resolved
Hide resolved
| // 1. Retrieve the calculated version details | ||
| final VersionInfoRegistry.VersionDetails details = versionInfoRegistry.getVersionDetails(); | ||
| versionInfoRegistry.setDataPoint(1, "NIFI_VERSION_INFO", instanceId, | ||
| details.nifiVersion, details.javaVersion, details.revision, details.tag, | ||
| details.buildBranch, details.osName, details.osVersion, details.osArchitecture, details.javaVendor); | ||
| } |
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.
It looks like this block needs to be indented.
|
made the requested changes. I also changed the the actual output from "nifi_version" to "framework_version". Should I change this back or leave it as-is. |
pvillard31
left a comment
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.
Please make sure to fix the checkstyle issues:
Warning: src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java:[26,8] (imports) UnusedImports: Unused import - java.util.Objects.
Warning: src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java:[33,47] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
Warning: src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java:[56] (regexp) RegexpSinglelineJava: Line has trailing whitespace.
Warning: src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java:[67,7] (whitespace) WhitespaceAround: '{' is not followed by whitespace.
Warning: src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java:[67,8] (whitespace) WhitespaceAround: '}' is not preceded with whitespace.
You can confirm everything is ok by building locally the nifi-web-api module using mvn clean install -Pcontrib-check
Thanks, that renaming looks good. This looks closer to completion, but needs to resolve the Checkstyle warnings. |
|
compliance tests are passing now. let me know if there is anything else missed. Thanks! |
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.
Thanks for the updates @agturley.
Recent changes to the repository configuration require commits to be signed. The Contributor Guide now includes a section on enabling commit signing with links to configuring Git and registering your key in GitHub.
If you can follow those steps, you can squash the commits in this branch, then force-push an update with the signed commits to prepare this for final review.
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
Outdated
Show resolved
Hide resolved
...ifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/PrometheusMetricsUtil.java
Outdated
Show resolved
Hide resolved
ac046f7 to
70fe04c
Compare
|
Pushed the requested changes. Please let me know if there is anything else. |
pvillard31
left a comment
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.
+1, merging, taking care of the checkstyle/PMD issue as part of the merge
Summary
NIFI-15351
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation