Skip to content

HBASE-27395 Adding description to Prometheus metrics #4807

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

Merged
merged 2 commits into from
Oct 7, 2022

Conversation

lucakovacs
Copy link
Contributor

You can access metrics description while using '/prometheus' endpoint via "description=true" URL parameter.
Example: http://HOSTNAME:16010/prometheus?description=true

Apache JIRA: https://issues.apache.org/jira/browse/HBASE-27395

Change-Id: I5f76b741c3419c4f2d355252d9a958ee48784257
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 16s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 2m 28s master passed
+1 💚 compile 0m 14s master passed
+1 💚 shadedjars 3m 47s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 14s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 13s the patch passed
+1 💚 compile 0m 15s the patch passed
+1 💚 javac 0m 15s the patch passed
+1 💚 shadedjars 3m 48s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 12s the patch passed
_ Other Tests _
+1 💚 unit 0m 38s hbase-http in the patch passed.
15m 50s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #4807
Optional Tests javac javadoc unit shadedjars compile
uname Linux 076ac4e79d26 5.4.0-124-generic #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 23a5633
Default Java Temurin-1.8.0_345-b01
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/testReport/
Max. process+thread count 337 (vs. ulimit of 30000)
modules C: hbase-http U: hbase-http
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 39s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 2m 41s master passed
+1 💚 compile 0m 12s master passed
+1 💚 shadedjars 3m 56s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 12s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 27s the patch passed
+1 💚 compile 0m 12s the patch passed
+1 💚 javac 0m 12s the patch passed
+1 💚 shadedjars 3m 57s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 10s the patch passed
_ Other Tests _
+1 💚 unit 0m 39s hbase-http in the patch passed.
15m 50s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #4807
Optional Tests javac javadoc unit shadedjars compile
uname Linux bd1dc368a794 5.4.0-1071-aws #76~18.04.1-Ubuntu SMP Mon Mar 28 17:49:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 23a5633
Default Java Eclipse Adoptium-11.0.16.1+1
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/testReport/
Max. process+thread count 267 (vs. ulimit of 30000)
modules C: hbase-http U: hbase-http
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 47s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 2m 26s master passed
+1 💚 compile 0m 21s master passed
+1 💚 checkstyle 0m 9s master passed
+1 💚 spotless 0m 38s branch has no errors when running spotless:check.
+1 💚 spotbugs 0m 21s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 5s the patch passed
+1 💚 compile 0m 18s the patch passed
+1 💚 javac 0m 18s the patch passed
-0 ⚠️ checkstyle 0m 7s hbase-http: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 8m 6s Patch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚 spotless 0m 35s patch has no errors when running spotless:check.
+1 💚 spotbugs 0m 25s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 9s The patch does not generate ASF License warnings.
21m 32s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #4807
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
uname Linux 81b916881dc8 5.4.0-1083-aws #90~18.04.1-Ubuntu SMP Fri Aug 5 08:12:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 23a5633
Default Java Temurin-1.8.0_345-b01
checkstyle https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/artifact/yetus-general-check/output/diff-checkstyle-hbase-http.txt
Max. process+thread count 64 (vs. ulimit of 30000)
modules C: hbase-http U: hbase-http
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/console
versions git=2.17.1 maven=3.6.3 spotbugs=4.7.2
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Copy link

@payert payert left a comment

Choose a reason for hiding this comment

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

LGTM.

String tmpStr = req.getParameter("description");
boolean description = tmpStr != null && tmpStr.equals("true");

writeMetrics(resp.getWriter(), description);
Copy link

Choose a reason for hiding this comment

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

This could be compacted like this:
writeMetrics(resp.getWriter(), "true".equals(req.getParameter("description")));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I totally agree, should have noticed that. Thank you!

@@ -57,13 +60,19 @@ static String toPrometheusName(String metricRecordName, String metricName) {
*/
@RestrictedApi(explanation = "Should only be called in tests or self", link = "",
allowedOnPath = ".*/src/test/.*|.*/PrometheusHadoopServlet\\.java")
void writeMetrics(Writer writer) throws IOException {
void writeMetrics(Writer writer, boolean desc) throws IOException {
Copy link

Choose a reason for hiding this comment

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

Maybe 'describe' is better argument name than 'desc'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use 'desc', because 'description' is used as a local variable name in the function


if (desc) {
String description = metrics.description();
if (!description.isEmpty()) writer.append("# HELP ").append(description).append("\n");
Copy link

Choose a reason for hiding this comment

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

When you append a single char to the writer you can use the append(char c) instead if of append(CharSequence csq). I mean
.append('\n')
instead of
.append("\n")
Doesn't make much difference but slightly cheaper..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it, thanks for the info!

Notes:
- Made some improvements in the code based on the review
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 2s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 2m 11s master passed
+1 💚 compile 0m 15s master passed
+1 💚 shadedjars 3m 48s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 11s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 14s the patch passed
+1 💚 compile 0m 14s the patch passed
+1 💚 javac 0m 14s the patch passed
+1 💚 shadedjars 3m 47s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 12s the patch passed
_ Other Tests _
+1 💚 unit 0m 38s hbase-http in the patch passed.
15m 35s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #4807
Optional Tests javac javadoc unit shadedjars compile
uname Linux 14e7e023f7ae 5.4.0-124-generic #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / eb6b274
Default Java Temurin-1.8.0_345-b01
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/testReport/
Max. process+thread count 346 (vs. ulimit of 30000)
modules C: hbase-http U: hbase-http
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 46s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 2m 51s master passed
+1 💚 compile 0m 13s master passed
+1 💚 shadedjars 3m 57s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 13s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 27s the patch passed
+1 💚 compile 0m 13s the patch passed
+1 💚 javac 0m 13s the patch passed
+1 💚 shadedjars 3m 56s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 11s the patch passed
_ Other Tests _
+1 💚 unit 0m 39s hbase-http in the patch passed.
16m 46s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #4807
Optional Tests javac javadoc unit shadedjars compile
uname Linux b29c5503d836 5.4.0-1071-aws #76~18.04.1-Ubuntu SMP Mon Mar 28 17:49:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / eb6b274
Default Java Eclipse Adoptium-11.0.16.1+1
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/testReport/
Max. process+thread count 292 (vs. ulimit of 30000)
modules C: hbase-http U: hbase-http
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 46s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 2m 25s master passed
+1 💚 compile 0m 22s master passed
+1 💚 checkstyle 0m 8s master passed
+1 💚 spotless 0m 39s branch has no errors when running spotless:check.
+1 💚 spotbugs 0m 22s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 6s the patch passed
+1 💚 compile 0m 17s the patch passed
+1 💚 javac 0m 17s the patch passed
-0 ⚠️ checkstyle 0m 6s hbase-http: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 8m 4s Patch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚 spotless 0m 39s patch has no errors when running spotless:check.
+1 💚 spotbugs 0m 27s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 8s The patch does not generate ASF License warnings.
21m 58s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #4807
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
uname Linux 751e650bf60c 5.4.0-1083-aws #90~18.04.1-Ubuntu SMP Fri Aug 5 08:12:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / eb6b274
Default Java Temurin-1.8.0_345-b01
checkstyle https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/artifact/yetus-general-check/output/diff-checkstyle-hbase-http.txt
Max. process+thread count 67 (vs. ulimit of 30000)
modules C: hbase-http U: hbase-http
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/console
versions git=2.17.1 maven=3.6.3 spotbugs=4.7.2
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@meszibalu meszibalu merged commit 46d37a7 into apache:master Oct 7, 2022
asfgit pushed a commit that referenced this pull request Oct 7, 2022
Signed-off-by: Tamas Payer <payert@apache.org>
Signed-off-by: Balazs Meszaros <meszibalu@apache.org>
vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
Signed-off-by: Tamas Payer <payert@apache.org>
Signed-off-by: Balazs Meszaros <meszibalu@apache.org>
(cherry picked from commit f5df769)
Change-Id: I7718263ee568a51bab9ed4ed03b0e26f915ab31c
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.

4 participants