seaninryan commented on issue #534: [WIP] Proof of concept for prometheus 
endpoint
URL: https://github.com/apache/jena/pull/534#issuecomment-467156265
 
 
   I changed what I'd done to use micrometer.. the creation of the required 
objects is a bit tricky so for now I've just done it in the servlet `init()` 
method
   
   I just made it use the `JvmMemoryMetrics` class to pull in some standard 
stuff and added a `FusekiRequestsMetrics` class to get those stats that come 
from the `DataAccessPointRegistry`
   
   
   I'd spoken to @Claudenw and looked into having a core dependency on 
`micrometer-core` and maybe an `extras` dependency on 
`micrometer-registry-prometheus` but I can't see how we'd instantiate the 
correct implementation of `MeterRegistry` because the different implementations 
all have constructors with different signatures
   
   Anyway you guys might be able to offer some more insight on that... I've 
just been looking at spring-boot actuator and trying to see what they've done 
there
   
   This is what the metrics look like with what I've set up so far:
   ```
   # HELP jvm_buffer_count_buffers An estimate of the number of buffers in the 
pool
   # TYPE jvm_buffer_count_buffers gauge
   jvm_buffer_count_buffers{id="direct",} 16.0
   jvm_buffer_count_buffers{id="mapped",} 51.0
   # HELP jvm_memory_committed_bytes The amount of memory in bytes that is 
committed for the Java virtual machine to use
   # TYPE jvm_memory_committed_bytes gauge
   jvm_memory_committed_bytes{area="heap",id="PS Survivor Space",} 4.8758784E7
   jvm_memory_committed_bytes{area="heap",id="PS Old Gen",} 2.8311552E8
   jvm_memory_committed_bytes{area="heap",id="PS Eden Space",} 9.5944704E7
   jvm_memory_committed_bytes{area="nonheap",id="Metaspace",} 3.2899072E7
   jvm_memory_committed_bytes{area="nonheap",id="Code Cache",} 1.376256E7
   jvm_memory_committed_bytes{area="nonheap",id="Compressed Class Space",} 
4063232.0
   # HELP jvm_buffer_total_capacity_bytes An estimate of the total capacity of 
the buffers in this pool
   # TYPE jvm_buffer_total_capacity_bytes gauge
   jvm_buffer_total_capacity_bytes{id="direct",} 81543.0
   jvm_buffer_total_capacity_bytes{id="mapped",} 4.02663383E8
   # HELP fuseki_requests_good  
   # TYPE fuseki_requests_good gauge
   fuseki_requests_good{dataset="/data-set-1",description="Graph Store 
Protocol",endpoint="data",operation="GSP_RW",} 154.0
   fuseki_requests_good{dataset="/data-set-2",description="File 
Upload",endpoint="upload",operation="Upload",} 0.0
   fuseki_requests_good{dataset="/data-set-2",description="Graph Store Protocol 
(Read)",endpoint="get",operation="GSP_R",} 0.0
   fuseki_requests_good{dataset="/data-set-1",description="HTTP 
Quads",endpoint="",operation="Quads_RW",} 0.0
   fuseki_requests_good{dataset="/data-set-2",description="HTTP 
Quads",endpoint="",operation="Quads_RW",} 0.0
   fuseki_requests_good{dataset="/data-set-2",description="SPARQL 
Query",endpoint="sparql",operation="Query",} 0.0
   fuseki_requests_good{dataset="/data-set-1",description="File 
Upload",endpoint="upload",operation="Upload",} 0.0
   fuseki_requests_good{dataset="/data-set-1",description="SPARQL 
Update",endpoint="update",operation="Update",} 2.0
   fuseki_requests_good{dataset="/data-set-1",description="Graph Store Protocol 
(Read)",endpoint="get",operation="GSP_R",} 0.0
   fuseki_requests_good{dataset="/data-set-2",description="Graph Store 
Protocol",endpoint="data",operation="GSP_RW",} 0.0
   fuseki_requests_good{dataset="/data-set-2",description="SPARQL 
Query",endpoint="query",operation="Query",} 0.0
   fuseki_requests_good{dataset="/data-set-2",description="SPARQL 
Update",endpoint="update",operation="Update",} 0.0
   fuseki_requests_good{dataset="/data-set-1",description="SPARQL 
Query",endpoint="query",operation="Query",} 178.0
   fuseki_requests_good{dataset="/data-set-1",description="SPARQL 
Query",endpoint="sparql",operation="Query",} 0.0
   # HELP jvm_buffer_memory_used_bytes An estimate of the memory that the Java 
virtual machine is using for this buffer pool
   # TYPE jvm_buffer_memory_used_bytes gauge
   jvm_buffer_memory_used_bytes{id="direct",} 81543.0
   jvm_buffer_memory_used_bytes{id="mapped",} 4.02663383E8
   # HELP fuseki_requests  
   # TYPE fuseki_requests gauge
   fuseki_requests{dataset="/data-set-1",description="Graph Store 
Protocol",endpoint="data",operation="GSP_RW",} 154.0
   fuseki_requests{dataset="/data-set-2",description="File 
Upload",endpoint="upload",operation="Upload",} 0.0
   fuseki_requests{dataset="/data-set-2",description="Graph Store Protocol 
(Read)",endpoint="get",operation="GSP_R",} 0.0
   fuseki_requests{dataset="/data-set-1",description="HTTP 
Quads",endpoint="",operation="Quads_RW",} 0.0
   fuseki_requests{dataset="/data-set-2",description="HTTP 
Quads",endpoint="",operation="Quads_RW",} 0.0
   fuseki_requests{dataset="/data-set-2",description="SPARQL 
Query",endpoint="sparql",operation="Query",} 0.0
   fuseki_requests{dataset="/data-set-1",description="File 
Upload",endpoint="upload",operation="Upload",} 0.0
   fuseki_requests{dataset="/data-set-1",description="SPARQL 
Update",endpoint="update",operation="Update",} 2.0
   fuseki_requests{dataset="/data-set-1",description="Graph Store Protocol 
(Read)",endpoint="get",operation="GSP_R",} 0.0
   fuseki_requests{dataset="/data-set-2",description="Graph Store 
Protocol",endpoint="data",operation="GSP_RW",} 0.0
   fuseki_requests{dataset="/data-set-2",description="SPARQL 
Query",endpoint="query",operation="Query",} 0.0
   fuseki_requests{dataset="/data-set-2",description="SPARQL 
Update",endpoint="update",operation="Update",} 0.0
   fuseki_requests{dataset="/data-set-1",description="SPARQL 
Query",endpoint="query",operation="Query",} 178.0
   fuseki_requests{dataset="/data-set-1",description="SPARQL 
Query",endpoint="sparql",operation="Query",} 0.0
   # HELP jvm_memory_max_bytes The maximum amount of memory in bytes that can 
be used for memory management
   # TYPE jvm_memory_max_bytes gauge
   jvm_memory_max_bytes{area="heap",id="PS Survivor Space",} 4.8758784E7
   jvm_memory_max_bytes{area="heap",id="PS Old Gen",} 1.431830528E9
   jvm_memory_max_bytes{area="heap",id="PS Eden Space",} 6.16562688E8
   jvm_memory_max_bytes{area="nonheap",id="Metaspace",} -1.0
   jvm_memory_max_bytes{area="nonheap",id="Code Cache",} 2.5165824E8
   jvm_memory_max_bytes{area="nonheap",id="Compressed Class Space",} 
1.073741824E9
   # HELP fuseki_requests_bad  
   # TYPE fuseki_requests_bad gauge
   fuseki_requests_bad{dataset="/data-set-1",description="Graph Store 
Protocol",endpoint="data",operation="GSP_RW",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="File 
Upload",endpoint="upload",operation="Upload",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="Graph Store Protocol 
(Read)",endpoint="get",operation="GSP_R",} 0.0
   fuseki_requests_bad{dataset="/data-set-1",description="HTTP 
Quads",endpoint="",operation="Quads_RW",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="HTTP 
Quads",endpoint="",operation="Quads_RW",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="SPARQL 
Query",endpoint="sparql",operation="Query",} 0.0
   fuseki_requests_bad{dataset="/data-set-1",description="File 
Upload",endpoint="upload",operation="Upload",} 0.0
   fuseki_requests_bad{dataset="/data-set-1",description="SPARQL 
Update",endpoint="update",operation="Update",} 0.0
   fuseki_requests_bad{dataset="/data-set-1",description="Graph Store Protocol 
(Read)",endpoint="get",operation="GSP_R",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="Graph Store 
Protocol",endpoint="data",operation="GSP_RW",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="SPARQL 
Query",endpoint="query",operation="Query",} 0.0
   fuseki_requests_bad{dataset="/data-set-2",description="SPARQL 
Update",endpoint="update",operation="Update",} 0.0
   fuseki_requests_bad{dataset="/data-set-1",description="SPARQL 
Query",endpoint="query",operation="Query",} 0.0
   fuseki_requests_bad{dataset="/data-set-1",description="SPARQL 
Query",endpoint="sparql",operation="Query",} 0.0
   # HELP jvm_memory_used_bytes The amount of used memory
   # TYPE jvm_memory_used_bytes gauge
   jvm_memory_used_bytes{area="heap",id="PS Survivor Space",} 2.1266496E7
   jvm_memory_used_bytes{area="heap",id="PS Old Gen",} 8.859756E7
   jvm_memory_used_bytes{area="heap",id="PS Eden Space",} 1.3267632E7
   jvm_memory_used_bytes{area="nonheap",id="Metaspace",} 3.1906112E7
   jvm_memory_used_bytes{area="nonheap",id="Code Cache",} 1.3602752E7
   jvm_memory_used_bytes{area="nonheap",id="Compressed Class Space",} 3776040.0
   ```
   
   I need to look into how/whether what I've done would automatically pick up a 
new dataset and things like that
   
   The great thing about the subclasses of `MeterBinder` is that there are 
loads of existing dashboards on grafana that can be used to chart the metrics. 
[This one](https://grafana.com/dashboards/6756) for example. Also loads of them 
are applicable to fuseki
   
![2019-02-25-19-46-17_480x475](https://user-images.githubusercontent.com/13253395/53364154-18e21e00-3936-11e9-808e-59ab7552e980.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to