Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 2.23 KB

README.md

File metadata and controls

72 lines (52 loc) · 2.23 KB

JFR playground

A proof of concept of how to collect metrics using the JDK Flight Recorder event streaming(JEP 349) and Kamon telemetry to send them to Prometheus/Pinot

Prerequisites

Kamon + Prometheus + Grafana

# Prometheus + Grafana + Metrics dashboard
docker-compose -f docker/grafana-prometheus-compose.yml up

# Example service
sbt run

# Stress the service
k6 run k6/stress.js      

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: k6/stress.js
     output: ...........

Then open the "JFR Metrics" dashboard in Grafana(localhost:3000) and Enjoy!

Bonus

Send profiling information(jdk.ObjectAllocationSample) to Pinot realtime table via Kafka and play with it ;)

# Kafka + Pinot
docker-compose -f pinot-kafka-compose.yml up

# Topic
docker exec -t kamon-jrf-playground_kafka  kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic jfr-allocation-topic

# Table Schema
curl -X POST "http://localhost:9000/schemas?override=true" -H "accept: application/json" -H "Content-Type: application/json" -d @jfr-allocation-schema.json

# Realtime Table configuration
curl -X POST "http://localhost:9000/tables" -H "accept: application/json" -H "Content-Type: application/json" -d @jfr-object-allocation-table.json

# Enable `jdk.ObjectAllocationSample` event in application.conf changing
"jdk.ObjectAllocationSample#enabled=false" to "jdk.ObjectAllocationSample#enabled=true" 

Then open the Pinot SQL Console(localhost:9000/#/query) and Enjoy!

Disclaimer

I have just scratched the surface of Pinot capabilities, and I'm sure there are other better ways of modeling than the one proposed, using other features and data types.

License

This code base is available ander the Apache License, version 2.