You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2023/01/11 08:18:53 UTC

[GitHub] [bookkeeper] zayomeng opened a new issue, #3732: Missing TYPE desc for jvm_* metrics type when using Prometheus Metric Provider

zayomeng opened a new issue, #3732:
URL: https://github.com/apache/bookkeeper/issues/3732

   **BUG REPORT**
   
   ***Describe the bug***
   
   I enabled Prometheus Metrics Provider in Apache Bookkeeper 4.15.3 Trying to scrape metrics from Bokeeper. 
   It gives such JVM state metric like this. 
   ```
   jvm_memory_direct_bytes_used{} 1.3789372E7
   jvm_threads_current{} 249.0
   jvm_threads_daemon{} 13.0
   ```
   Accroding to the Prometheus official document,  [docurl](https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information), metrics could have a `# TYPE` metric to descibe the variable type of the metric. Most time these metrics always have TYPE desc for metrics, and Bookkeper should have too.
   
   The following is the reason why it need and what problem it will cause.  
   
   
   In normal situation , like add different scrape jobs in Prometheus config file (one job only scrape for one services' metrics), this will be OK.
   But, when I used a customized metrics agent, I tried to collect the metrics and mix it together , and then used to be scraped by Prometheus (pretty like Prometheus Pushgateway's behavior, but in scrape mode not push mode). My custom collector uses Prometheus' [code](https://github.com/prometheus/client_golang/blob/main/prometheus/registry.go#L774) to marshall metrics.
   When I tried to mix Apache Pulsar's and Apache Bookkeeper's metrics , this will face a sitaution, Pulsar's JVM state metrics has TYPE desc, like this
   ```
   # TYPE jvm_threads_current gauge
   jvm_threads_current{cluster="pulsar"} 573.0
   # TYPE jvm_threads_daemon gauge
   jvm_threads_daemon{cluster="pulsar"} 13.0
   ```
   This will have same name metrics with different labels, which Pulsar's has TYPE but Bookkeeper doesn't, it will marshall failed and drop Bookkeeper's JVM state metrics.
     
   
   ***To Reproduce***
   
   Just enabled this feature and curl that metric scrape URL for Prometheus which provided by Bookkeeper. (Default in bk_server.conf is Port 8000, URL is `http://ip:8000/metrics` )
   
   ***Expected behavior***
   
   Output JVM metrics from Bookkeeper Prometheus Metrics Provider should have TYPE desc.
   
   ***Screenshots***
   
   If applicable, add screenshots to help explain your problem.
   The current output for JVM metrics from Bookkeeper.
   ![image](https://user-images.githubusercontent.com/17527860/211753334-ce6dd6d9-48bd-4203-9945-507af23c4c0b.png)
   
   The current output for JVM metrics from Pulsar Broker, the TYPE metrics is in output and correct.
   ![image](https://user-images.githubusercontent.com/17527860/211753065-c988a814-ea83-4986-8eac-329ffd835b2f.png)
   
   ***Additional context***
   
   Add any other context about the problem here.
   
   [Code from Prometheus to marshall scraped metrics output](https://github.com/prometheus/client_golang/blob/main/prometheus/registry.go#L774)
   
   [TYPE metrics' describe in Prometheus document](https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Missing TYPE desc for jvm_* metrics type when using Prometheus Metric Provider [bookkeeper]

Posted by "shoothzj (via GitHub)" <gi...@apache.org>.
shoothzj commented on issue #3732:
URL: https://github.com/apache/bookkeeper/issues/3732#issuecomment-2094055620

   tested with master code, I think it has been fixed.
   
   ```
   # TYPE jvm_memory_objects_pending_finalization gauge
   jvm_memory_objects_pending_finalization{} 0.0
   # TYPE jvm_memory_bytes_used gauge
   jvm_memory_bytes_used{area="heap"} 6.2671392E7
   jvm_memory_bytes_used{area="nonheap"} 4.7913512E7
   # TYPE jvm_memory_bytes_committed gauge
   jvm_memory_bytes_committed{area="heap"} 1.073741824E9
   jvm_memory_bytes_committed{area="nonheap"} 4.9938432E7
   # TYPE jvm_memory_bytes_max gauge
   jvm_memory_bytes_max{area="heap"} 1.073741824E9
   jvm_memory_bytes_max{area="nonheap"} -1.0
   # TYPE jvm_memory_bytes_init gauge
   jvm_memory_bytes_init{area="heap"} 1.073741824E9
   jvm_memory_bytes_init{area="nonheap"} 7667712.0
   # TYPE jvm_memory_pool_bytes_used gauge
   jvm_memory_pool_bytes_used{pool="CodeHeap 'non-nmethods'"} 1893504.0
   jvm_memory_pool_bytes_used{pool="Metaspace"} 3.4716088E7
   jvm_memory_pool_bytes_used{pool="CodeHeap 'profiled nmethods'"} 5665024.0
   jvm_memory_pool_bytes_used{pool="Compressed Class Space"} 3910000.0
   jvm_memory_pool_bytes_used{pool="G1 Eden Space"} 4.6137344E7
   jvm_memory_pool_bytes_used{pool="G1 Old Gen"} 1.2864032E7
   jvm_memory_pool_bytes_used{pool="G1 Survivor Space"} 3670016.0
   jvm_memory_pool_bytes_used{pool="CodeHeap 'non-profiled nmethods'"} 1728896.0
   # TYPE jvm_memory_pool_bytes_committed gauge
   jvm_memory_pool_bytes_committed{pool="CodeHeap 'non-nmethods'"} 2555904.0
   jvm_memory_pool_bytes_committed{pool="Metaspace"} 3.506176E7
   jvm_memory_pool_bytes_committed{pool="CodeHeap 'profiled nmethods'"} 5701632.0
   jvm_memory_pool_bytes_committed{pool="Compressed Class Space"} 4063232.0
   jvm_memory_pool_bytes_committed{pool="G1 Eden Space"} 5.24288E7
   jvm_memory_pool_bytes_committed{pool="G1 Old Gen"} 1.01711872E9
   jvm_memory_pool_bytes_committed{pool="G1 Survivor Space"} 4194304.0
   jvm_memory_pool_bytes_committed{pool="CodeHeap 'non-profiled nmethods'"} 2555904.0
   # TYPE jvm_memory_pool_bytes_max gauge
   jvm_memory_pool_bytes_max{pool="CodeHeap 'non-nmethods'"} 5828608.0
   jvm_memory_pool_bytes_max{pool="Metaspace"} -1.0
   jvm_memory_pool_bytes_max{pool="CodeHeap 'profiled nmethods'"} 1.22912768E8
   jvm_memory_pool_bytes_max{pool="Compressed Class Space"} 1.073741824E9
   jvm_memory_pool_bytes_max{pool="G1 Eden Space"} -1.0
   jvm_memory_pool_bytes_max{pool="G1 Old Gen"} 1.073741824E9
   jvm_memory_pool_bytes_max{pool="G1 Survivor Space"} -1.0
   jvm_memory_pool_bytes_max{pool="CodeHeap 'non-profiled nmethods'"} 1.22916864E8
   # TYPE jvm_memory_pool_bytes_init gauge
   jvm_memory_pool_bytes_init{pool="CodeHeap 'non-nmethods'"} 2555904.0
   jvm_memory_pool_bytes_init{pool="Metaspace"} 0.0
   jvm_memory_pool_bytes_init{pool="CodeHeap 'profiled nmethods'"} 2555904.0
   jvm_memory_pool_bytes_init{pool="Compressed Class Space"} 0.0
   jvm_memory_pool_bytes_init{pool="G1 Eden Space"} 5.3477376E7
   jvm_memory_pool_bytes_init{pool="G1 Old Gen"} 1.020264448E9
   jvm_memory_pool_bytes_init{pool="G1 Survivor Space"} 0.0
   jvm_memory_pool_bytes_init{pool="CodeHeap 'non-profiled nmethods'"} 2555904.0
   # TYPE jvm_memory_pool_collection_used_bytes gauge
   jvm_memory_pool_collection_used_bytes{pool="G1 Eden Space"} 0.0
   jvm_memory_pool_collection_used_bytes{pool="G1 Old Gen"} 1.2864032E7
   jvm_memory_pool_collection_used_bytes{pool="G1 Survivor Space"} 3670016.0
   # TYPE jvm_memory_pool_collection_committed_bytes gauge
   jvm_memory_pool_collection_committed_bytes{pool="G1 Eden Space"} 5.24288E7
   jvm_memory_pool_collection_committed_bytes{pool="G1 Old Gen"} 1.01711872E9
   jvm_memory_pool_collection_committed_bytes{pool="G1 Survivor Space"} 4194304.0
   # TYPE jvm_memory_pool_collection_max_bytes gauge
   jvm_memory_pool_collection_max_bytes{pool="G1 Eden Space"} -1.0
   jvm_memory_pool_collection_max_bytes{pool="G1 Old Gen"} 1.073741824E9
   jvm_memory_pool_collection_max_bytes{pool="G1 Survivor Space"} -1.0
   # TYPE jvm_memory_pool_collection_init_bytes gauge
   jvm_memory_pool_collection_init_bytes{pool="G1 Eden Space"} 5.3477376E7
   jvm_memory_pool_collection_init_bytes{pool="G1 Old Gen"} 1.020264448E9
   jvm_memory_pool_collection_init_bytes{pool="G1 Survivor Space"} 0.0
   # TYPE jvm_memory_direct_bytes_used gauge
   jvm_memory_direct_bytes_used{} 8388639.0
   # TYPE jvm_gc_collection_seconds summary
   jvm_gc_collection_seconds_count{gc="G1 Young Generation"} 4.0
   jvm_gc_collection_seconds_sum{gc="G1 Young Generation"} 0.124
   jvm_gc_collection_seconds_count{gc="G1 Concurrent GC"} 2.0
   jvm_gc_collection_seconds_sum{gc="G1 Concurrent GC"} 0.003
   jvm_gc_collection_seconds_count{gc="G1 Old Generation"} 0.0
   jvm_gc_collection_seconds_sum{gc="G1 Old Generation"} 0.0
   # TYPE jvm_memory_direct_bytes_max gauge
   jvm_memory_direct_bytes_max{} 2.147483648E9
   # TYPE jvm_threads_current gauge
   jvm_threads_current{} 48.0
   # TYPE jvm_threads_daemon gauge
   jvm_threads_daemon{} 14.0
   # TYPE jvm_threads_peak gauge
   jvm_threads_peak{} 48.0
   # TYPE jvm_threads_started counter
   jvm_threads_started_total{} 49.0
   # TYPE jvm_threads_deadlocked gauge
   jvm_threads_deadlocked{} 0.0
   # TYPE jvm_threads_deadlocked_monitor gauge
   jvm_threads_deadlocked_monitor{} 0.0
   # TYPE jvm_threads_state gauge
   jvm_threads_state{state="NEW"} 0.0
   jvm_threads_state{state="TERMINATED"} 0.0
   jvm_threads_state{state="RUNNABLE"} 11.0
   jvm_threads_state{state="BLOCKED"} 0.0
   jvm_threads_state{state="WAITING"} 29.0
   jvm_threads_state{state="TIMED_WAITING"} 8.0
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Missing TYPE desc for jvm_* metrics type when using Prometheus Metric Provider [bookkeeper]

Posted by "shoothzj (via GitHub)" <gi...@apache.org>.
shoothzj closed issue #3732: Missing TYPE desc for jvm_* metrics type when using Prometheus Metric Provider
URL: https://github.com/apache/bookkeeper/issues/3732


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org