Skip to content

HBASE-27395 Adding description to Prometheus metrics - #4807

Merged
meszibalu merged 2 commits into
apache:masterfrom
lucakovacs:HBASE-27395
Oct 7, 2022
Merged

HBASE-27395 Adding description to Prometheus metrics#4807
meszibalu merged 2 commits into
apache:masterfrom
lucakovacs:HBASE-27395

Conversation

@lucakovacs

Copy link
Copy Markdown
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
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 16sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 28smaster passed
+1 💚compile0m 14smaster passed
+1 💚shadedjars3m 47sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 14smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 13sthe patch passed
+1 💚compile0m 15sthe patch passed
+1 💚javac0m 15sthe patch passed
+1 💚shadedjars3m 48spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 12sthe patch passed
_ Other Tests _
+1 💚unit0m 38shbase-http in the patch passed.
15m 50s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 23a5633
Default JavaTemurin-1.8.0_345-b01
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/testReport/
Max. process+thread count337 (vs. ulimit of 30000)
modulesC: hbase-http U: hbase-http
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 39sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 41smaster passed
+1 💚compile0m 12smaster passed
+1 💚shadedjars3m 56sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 12smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 27sthe patch passed
+1 💚compile0m 12sthe patch passed
+1 💚javac0m 12sthe patch passed
+1 💚shadedjars3m 57spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 10sthe patch passed
_ Other Tests _
+1 💚unit0m 39shbase-http in the patch passed.
15m 50s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 23a5633
Default JavaEclipse Adoptium-11.0.16.1+1
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/testReport/
Max. process+thread count267 (vs. ulimit of 30000)
modulesC: hbase-http U: hbase-http
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 47sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall2m 26smaster passed
+1 💚compile0m 21smaster passed
+1 💚checkstyle0m 9smaster passed
+1 💚spotless0m 38sbranch has no errors when running spotless:check.
+1 💚spotbugs0m 21smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 5sthe patch passed
+1 💚compile0m 18sthe patch passed
+1 💚javac0m 18sthe patch passed
-0 ⚠️checkstyle0m 7shbase-http: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck8m 6sPatch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚spotless0m 35spatch has no errors when running spotless:check.
+1 💚spotbugs0m 25sthe patch passed
_ Other Tests _
+1 💚asflicense0m 9sThe patch does not generate ASF License warnings.
21m 32s
SubsystemReport/Notes
DockerClientAPI=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 Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 23a5633
Default JavaTemurin-1.8.0_345-b01
checkstylehttps://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 count64 (vs. ulimit of 30000)
modulesC: hbase-http U: hbase-http
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/1/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.7.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@payertpayert left a comment

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
ContributorAuthor

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!

@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
Copy Markdown

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
Copy Markdown
ContributorAuthor

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
Copy Markdown

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
Copy Markdown
ContributorAuthor

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
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 2sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 11smaster passed
+1 💚compile0m 15smaster passed
+1 💚shadedjars3m 48sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 11smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 14sthe patch passed
+1 💚compile0m 14sthe patch passed
+1 💚javac0m 14sthe patch passed
+1 💚shadedjars3m 47spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 12sthe patch passed
_ Other Tests _
+1 💚unit0m 38shbase-http in the patch passed.
15m 35s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / eb6b274
Default JavaTemurin-1.8.0_345-b01
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/testReport/
Max. process+thread count346 (vs. ulimit of 30000)
modulesC: hbase-http U: hbase-http
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 46sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 51smaster passed
+1 💚compile0m 13smaster passed
+1 💚shadedjars3m 57sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 13smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 27sthe patch passed
+1 💚compile0m 13sthe patch passed
+1 💚javac0m 13sthe patch passed
+1 💚shadedjars3m 56spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 11sthe patch passed
_ Other Tests _
+1 💚unit0m 39shbase-http in the patch passed.
16m 46s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / eb6b274
Default JavaEclipse Adoptium-11.0.16.1+1
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/testReport/
Max. process+thread count292 (vs. ulimit of 30000)
modulesC: hbase-http U: hbase-http
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 46sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall2m 25smaster passed
+1 💚compile0m 22smaster passed
+1 💚checkstyle0m 8smaster passed
+1 💚spotless0m 39sbranch has no errors when running spotless:check.
+1 💚spotbugs0m 22smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 6sthe patch passed
+1 💚compile0m 17sthe patch passed
+1 💚javac0m 17sthe patch passed
-0 ⚠️checkstyle0m 6shbase-http: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck8m 4sPatch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚spotless0m 39spatch has no errors when running spotless:check.
+1 💚spotbugs0m 27sthe patch passed
_ Other Tests _
+1 💚asflicense0m 8sThe patch does not generate ASF License warnings.
21m 58s
SubsystemReport/Notes
DockerClientAPI=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 Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / eb6b274
Default JavaTemurin-1.8.0_345-b01
checkstylehttps://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 count67 (vs. ulimit of 30000)
modulesC: hbase-http U: hbase-http
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4807/2/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.7.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@meszibalu
meszibalu merged commit 46d37a7 into apache:masterOct 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 freeto 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

@lucakovacs@Apache-HBase@meszibalu@payert