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

ZOOKEEPER-4818 Add metric JVM_HEAP_BYTES_USED, JVM_HEAP_BYTES_MAX, and JVM_HEAP_BYTES_FREE #2170

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joseph-bennett-sf
Copy link

@maoling
Copy link
Member

maoling commented Jun 17, 2024

We already had this feature?

  1. enable the metricsProvider.exportJvmInfo
cat conf/zoo.cfg
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
metricsProvider.httpHost=0.0.0.0
metricsProvider.httpPort=7000
metricsProvider.exportJvmInfo=true
  1. curl http://localhost:7000/metrics |grep "jvm_memory_bytes_"

@joseph-bennett-sf
Copy link
Author

We already had this feature?

Is this only for the prometheus metrics provider? This information should ideally be available for implementations using other methods for exporting metrics. Please see ZOOKEEPER-4818

@maoling
Copy link
Member

maoling commented Jun 19, 2024

when applying this patch and enables the prometheus, the server cannot start up.

2024-06-19 17:24:51,895 [myid:] - ERROR [main:o.a.z.s.ZooKeeperServerMain@70] - Invalid arguments, exiting abnormally
java.lang.IllegalArgumentException: Collector already registered that provides name: jvm_memory_bytes_used
	at io.prometheus.client.CollectorRegistry.register(CollectorRegistry.java:54)
	at io.prometheus.client.SimpleCollector$Builder.register(SimpleCollector.java:246)
	at org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider$PrometheusSummary.<init>(PrometheusMetricsProvider.java:499)
metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
metricsProvider.httpHost=0.0.0.0
metricsProvider.httpPort=7000

@joseph-bennett-sf
Copy link
Author

@maoling Thanks for the review. I believe this is due to the metric names conflicting with those that Prometheus exports. I have updated the names so that they do not conflict with each other.

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.

2 participants