Making Sense of your Data
Building A Custom DataSource
for Grafana with Vert.x
Gerald Mücke
DevCon5 GmbH
@gmuecke
About me
 IT Consultant & Java Specialist at DevCon5 (CH)
 Focal Areas
 Tool-assisted quality assurance
 Performance (-testing, -analysis, -tooling)
 Operational Topics (APM, Monitoring)
 Twitter: @gmuecke
3
The Starting Point
 Customer stored and keep response time measurement of test runs
in a MongoDB
 Lots of Data
 Timestamp & Value
 No Proper Visualization
4
What are timeseries data?
 a set of datapoints with a timestamp and a value
time
value
What is MongoDB?
 MongoDB
 NoSQL database with focus on scale
 JSON as data representation
 No HTTP endpoint (TCP based Wire Protocol)
 Aggregation framework for complex queries
6
What is Grafana?
 A Service for Visualizing Time Series Data
 Open Source
 Backend written in Go
 Frontend based on Angular
 Dashboards & Alerts
Grafana Architecture 8
Grafana Server
• Implemented in GO
• Persistence for Settings and Dashboards
• Offers Proxy for Service Calls
Browser
Angular UI Data Source Data Source Plugin...
Proxy
DB DB
Datasources for Grafana 9
Grafana Server
• Implemented in GO
• Persistence for Settings and Dashboards
• Offers Proxy for Service Calls
Browser
Datasource
Angular UI
Data Source Plugin
• Angular
• JavaScript
HTTP
Connect Angular Directly to
Mongo?
10
From 2 Tier to 3 Tier 11
Grafana
(Angular) Mongo DB
Grafana
(Angular) Mongo DB
Datasource
Service
HTTP Mongo
Wire
Protocol
Start Simple
SimpleJsonDatasource (Plugin)
3 ServiceEndpoints
 /search  Labels – names of available timeseries
 /annoations  Annotations – textual markers
 /query  Query – actual time series data
12
https://github.com/grafana/simple-json-datasource
/search Format
Request
{
"target" : "select metric",
"refId" : "E"
}
Response
[
"Metric Name 1",
"Metric Name2",
]
An array of strings
13
/annotations Format
Request
{ "annotation" : {
"name" : "Test",
"iconColor" : "rgba(255, 96, 96, 1)",
"datasource" : "Simple Example DS",
"enable" : true,
"query" : "{"name":"Timeseries A"}" },
"range" : {
"from" : "2016-06-13T12:23:47.387Z",
"to" : "2016-06-13T12:24:19.217Z" },
"rangeRaw" : {
"from" : "2016-06-13T12:23:47.387Z",
"to" : "2016-06-13T12:24:19.217Z"
} }
Response
[ { "annotation": {
"name": "Test",
"iconColor": "rgba(255, 96, 96, 1)",
"datasource": "Simple Example DS",
"enable": true,
"query": "{"name":"Timeseries A"}" },
"time": 1465820629774,
"title": "Marker",
"tags": [
"Tag 1",
"Tag 2" ] } ]
14
/query Format
Request
{ "panelId" : 1,
"maxDataPoints" : 1904,
"format" : "json",
"range" : {
"from" : "2016-06-13T12:23:47.387Z",
"to" : "2016-06-13T12:24:19.217Z" },
"rangeRaw" : {
"from" : "2016-06-13T12:23:47.387Z",
"to" : "2016-06-13T12:24:19.217Z" },
"interval" : "20ms",
"targets" : [ {
"target" : "Time series A",
"refId" : "A" },] }
Response
[ { "target":"Timeseries A",
"datapoints":[
[1936,1465820629774],
[2105,1465820632673],
[4187,1465820635570],
[30001,1465820645243] },
{ "target":"Timeseries B",
"datapoints":[ ] }
]
15
Structure of the Source Data
{
"_id" : ObjectId("56375bc54f3c4caedfe68aca"),
"t" : {
"eDesc" : "Some more verbose description of the datapoint than the name",
"eId" : "56375ae24f3c4caedfe68a07",
"name" : "a name of the datapoint series",
"profile" : "P01",
"rnId" : "56375b694f3c4caedfe68aa0",
"rnStatus" : "OK",
"uId" : "anonymous"
},
"n" : {
"begin" : NumberLong("1446468494689"),
"value" : NumberLong(283)
}
}
16
Custom Datasource
 Should be
 Lightweight
 Fast / Performant
 Simple
17
Microservice?
 Options for implementation
 Java EE Microservice (i.e. Wildfly Swarm)
 Springboot Microservice
 Vert.x Microservice
 Node.js
 ...
19
The Alternative Options
Node.js
 Single Threaded
 Child Worker Processes
 Javascript Only
 Not best-choice for heavy
computation
Spring / Java EE
 Multithreaded
 Clusterable
 Java Only
 Solid Workhorses, cumbersome at
times
21
Why Vert.x?
 High Performance, Low Footprint
 Asynchronous, Non-Blocking
 Actor-like Concurrency
 Event & Worker Verticles
 Message Driven
 Polyglott
 Java, Groovy, Javascript, Scala …
 Scalable
 Distributed Eventbus
 Multi-threaded Event Loops
22
Asynchronous non-blocking vs
Synchronous blocking
23
Event Loop 24
Photo: Andreas Praefcke
Event Loop and Verticles 25
Photo: RokerHRO
3rd Floor, Verticle A
2nd Floor, Verticle B
1st Floor, Verticle C
26
27
Event Loop 28
Verticle
Verticle
Verticle
EventI/O
Event Bus 30
Verticle
Verticle
Verticle
Eventbus
Message
CPU
Multi-Reactor 31
Core Core Core Core
Eventbus
Other Vert.x
Instance
Browser
Verticle Verticle
Event & Worker Verticles
Event Driven Verticles Worker Verticles
32
Verticle
Verticle
Verticle
Thread Pool
Thread Pool
Verticle
Verticle
Verticle
Verticle
Verticle
Implementing the datasource
 Http Routes
 Pre-Processing
 Optional, for example: Split Request
 Query Database for Time Data Points
 Post Processing
 Optional, for example: Merge, Calculations
33
Step 1 – The naive approach
 Find all datapoints within range
34
Step 2 – Split Request
 Split request into chunks (#chunks = #cores)
 Use multiple Verticle Instance in parallel (#instances = #cores) ?
35
CPU
Step 4 – Aggregate Datapoints
 Use Mongo Aggregation Pipeline
 Reduce Datapoints returned to service
37
Step 5 – Percentiles (Service)
 Fetch all data
 Calculate percentiles in service
38
CPU
Step 6 – Percentiles (DB)
 Build aggregation pipeline to calculate percentiles
 Algorithm, see
http://www.dummies.com/education/math/statistics/how-to-
calculate-percentiles-in-statistics/
39
DB
CPUCPU
Datasource Architecture 40
HTTP
Service
Split
Request
Eventbus
Query
Database
Query
Database
Query
Database
Query
Database
Merge
Result
HTTP
Request
HTTP
Response
DB
Post
Process
Post
Process
Post
Process
Post
Process
Eventbus
Remember the
CELL BE?
 CPU of the PS3
 Central Bus (EIB)
 1 General Purpose CPU
 Runs the Game (Event) Loop
 8 SPUs
 Special Processing
 Sound
 Physics
 AI
 ...
41
Adding more stats & calculation
 Push Calculation to DB if possible
 Add more workers / node for complex (post-) processing
 Aggregate results before post-processing
 DB performance is king
42
Takeaways
 Grafana is powerful tool for visualizing data
 Information becomes consumable through visualization
 Information is essential for decision making
 Vert.x is
 Reactive, Non-Blocking, Asynchronous, Scalable
 Running on JVM
 Polyglott
 Fun
47
Source code on:
https://github.com/gmuecke/grafana-vertx-datasource
Gerald Mücke www.devcon5.ch
DevCon5 @gmuecke

More Related Content

PDF
Predictive Datacenter Analytics with Strymon
PDF
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
PPTX
Flink 0.10 @ Bay Area Meetup (October 2015)
PDF
Graphite, an introduction
PDF
Azure Stream Analytics Project : On-demand real-time analytics
PDF
Massive Simulations In Spark: Distributed Monte Carlo For Global Health Forec...
PPTX
Druid at naver.com - part 1
PDF
Demystifying DataFrame and Dataset
Predictive Datacenter Analytics with Strymon
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Flink 0.10 @ Bay Area Meetup (October 2015)
Graphite, an introduction
Azure Stream Analytics Project : On-demand real-time analytics
Massive Simulations In Spark: Distributed Monte Carlo For Global Health Forec...
Druid at naver.com - part 1
Demystifying DataFrame and Dataset

What's hot (20)

PDF
Virtual Knowledge Graphs for Federated Log Analysis
PDF
Knowledge Graph for Cybersecurity: An Introduction By Kabul Kurniawan
PPTX
Michael Häusler – Everyday flink
PPTX
Apache Flink Training: DataSet API Basics
PDF
Processing large-scale graphs with Google(TM) Pregel
PDF
Postgres Performance for Humans
PDF
A Deeper Dive into EXPLAIN
 
PDF
Scaling up data science applications
PDF
Brief introduction on Hadoop,Dremel, Pig, FlumeJava and Cassandra
PDF
Realtime Data Analysis Patterns
PPTX
Exploring Titan and Spark GraphX for Analyzing Time-Varying Electrical Networks
PDF
Graphite
PDF
Collecting metrics with Graphite and StatsD
PDF
Monitoring Postgres at Scale | PostgresConf US 2018 | Lukas Fittl
PDF
Real time analytics at any scale | PostgreSQL User Group NL | Marco Slot
PDF
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
PDF
Deep Dive Into Catalyst: Apache Spark 2.0’s Optimizer
PDF
Distributed Computing on PostgreSQL | PGConf EU 2017 | Marco Slot
PDF
Time Series Data with InfluxDB
PPTX
Supercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
Virtual Knowledge Graphs for Federated Log Analysis
Knowledge Graph for Cybersecurity: An Introduction By Kabul Kurniawan
Michael Häusler – Everyday flink
Apache Flink Training: DataSet API Basics
Processing large-scale graphs with Google(TM) Pregel
Postgres Performance for Humans
A Deeper Dive into EXPLAIN
 
Scaling up data science applications
Brief introduction on Hadoop,Dremel, Pig, FlumeJava and Cassandra
Realtime Data Analysis Patterns
Exploring Titan and Spark GraphX for Analyzing Time-Varying Electrical Networks
Graphite
Collecting metrics with Graphite and StatsD
Monitoring Postgres at Scale | PostgresConf US 2018 | Lukas Fittl
Real time analytics at any scale | PostgreSQL User Group NL | Marco Slot
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Deep Dive Into Catalyst: Apache Spark 2.0’s Optimizer
Distributed Computing on PostgreSQL | PGConf EU 2017 | Marco Slot
Time Series Data with InfluxDB
Supercharge your Analytics with ClickHouse, v.2. By Vadim Tkachenko
Ad

Viewers also liked (10)

PDF
Must.kill.mutants. TopConf Tallinn 2016
PDF
Using Real-Time Patch with LTSI Kernel
PPTX
Engaging with your Audience using E-newsletters
PDF
Ejclase mpi
PDF
Integração do Zabbix com Grafana
PDF
Alerting in Grafana, Grafanacon 2015
PDF
PDF
Fall in Love with Graphs and Metrics using Grafana
PPTX
Art nouveau y sus principales representantes
PPTX
MongoDB 3.4: Deep Dive on Views, Zones, and MongoDB Compass
Must.kill.mutants. TopConf Tallinn 2016
Using Real-Time Patch with LTSI Kernel
Engaging with your Audience using E-newsletters
Ejclase mpi
Integração do Zabbix com Grafana
Alerting in Grafana, Grafanacon 2015
Fall in Love with Graphs and Metrics using Grafana
Art nouveau y sus principales representantes
MongoDB 3.4: Deep Dive on Views, Zones, and MongoDB Compass
Ad

Similar to Making sense of your data (20)

PDF
Making sense of your data jug
PDF
Reactive data analysis with vert.x
PDF
Time Series With OrientDB - Fosdem 2015
PPTX
Il tempo vola: rappresentare e manipolare sequenze di eventi e time series co...
PPTX
OrientDB - Time Series and Event Sequences - Codemotion Milan 2014
PDF
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
PDF
Lab pratico per la progettazione di soluzioni MongoDB in ambito Internet of T...
PDF
MongoDB Solution for Internet of Things and Big Data
PDF
MongoDB and the Internet of Things
PDF
Time-Evolving Graph Processing On Commodity Clusters
PPTX
MongoDB for Time Series Data: Setting the Stage for Sensor Management
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PDF
Beautiful Monitoring With Grafana and InfluxDB
PPTX
Webinar: MongoDB Use Cases within the Oil, Gas, and Energy Industries
PDF
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
PDF
Thu bernstein key_warp_speed
PDF
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
PDF
A Fast and Efficient Time Series Storage Based on Apache Solr
PDF
Chronix: A fast and efficient time series storage based on Apache Solr
PDF
Graphite & Metrictank - Meetup Tel Aviv Yafo
Making sense of your data jug
Reactive data analysis with vert.x
Time Series With OrientDB - Fosdem 2015
Il tempo vola: rappresentare e manipolare sequenze di eventi e time series co...
OrientDB - Time Series and Event Sequences - Codemotion Milan 2014
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
Lab pratico per la progettazione di soluzioni MongoDB in ambito Internet of T...
MongoDB Solution for Internet of Things and Big Data
MongoDB and the Internet of Things
Time-Evolving Graph Processing On Commodity Clusters
MongoDB for Time Series Data: Setting the Stage for Sensor Management
Dev Jumpstart: Build Your First App with MongoDB
Beautiful Monitoring With Grafana and InfluxDB
Webinar: MongoDB Use Cases within the Oil, Gas, and Energy Industries
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Thu bernstein key_warp_speed
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
A Fast and Efficient Time Series Storage Based on Apache Solr
Chronix: A fast and efficient time series storage based on Apache Solr
Graphite & Metrictank - Meetup Tel Aviv Yafo

Recently uploaded (20)

PDF
Website Design Services for Small Businesses.pdf
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PPTX
CNN LeNet5 Architecture: Neural Networks
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
assetexplorer- product-overview - presentation
PDF
Microsoft Office 365 Crack Download Free
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
Computer Software - Technology and Livelihood Education
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
CCleaner 6.39.11548 Crack 2025 License Key
Website Design Services for Small Businesses.pdf
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
CNN LeNet5 Architecture: Neural Networks
"Secure File Sharing Solutions on AWS".pptx
assetexplorer- product-overview - presentation
Microsoft Office 365 Crack Download Free
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Computer Software - Technology and Livelihood Education
Time Tracking Features That Teams and Organizations Actually Need
MCP Security Tutorial - Beginner to Advanced
Topaz Photo AI Crack New Download (Latest 2025)
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Advanced SystemCare Ultimate Crack + Portable (2025)
Monitoring Stack: Grafana, Loki & Promtail
Weekly report ppt - harsh dattuprasad patel.pptx
CCleaner 6.39.11548 Crack 2025 License Key

Making sense of your data

  • 1. Making Sense of your Data Building A Custom DataSource for Grafana with Vert.x Gerald Mücke DevCon5 GmbH @gmuecke
  • 2. About me  IT Consultant & Java Specialist at DevCon5 (CH)  Focal Areas  Tool-assisted quality assurance  Performance (-testing, -analysis, -tooling)  Operational Topics (APM, Monitoring)  Twitter: @gmuecke 3
  • 3. The Starting Point  Customer stored and keep response time measurement of test runs in a MongoDB  Lots of Data  Timestamp & Value  No Proper Visualization 4
  • 4. What are timeseries data?  a set of datapoints with a timestamp and a value time value
  • 5. What is MongoDB?  MongoDB  NoSQL database with focus on scale  JSON as data representation  No HTTP endpoint (TCP based Wire Protocol)  Aggregation framework for complex queries 6
  • 6. What is Grafana?  A Service for Visualizing Time Series Data  Open Source  Backend written in Go  Frontend based on Angular  Dashboards & Alerts
  • 7. Grafana Architecture 8 Grafana Server • Implemented in GO • Persistence for Settings and Dashboards • Offers Proxy for Service Calls Browser Angular UI Data Source Data Source Plugin... Proxy DB DB
  • 8. Datasources for Grafana 9 Grafana Server • Implemented in GO • Persistence for Settings and Dashboards • Offers Proxy for Service Calls Browser Datasource Angular UI Data Source Plugin • Angular • JavaScript HTTP
  • 10. From 2 Tier to 3 Tier 11 Grafana (Angular) Mongo DB Grafana (Angular) Mongo DB Datasource Service HTTP Mongo Wire Protocol
  • 11. Start Simple SimpleJsonDatasource (Plugin) 3 ServiceEndpoints  /search  Labels – names of available timeseries  /annoations  Annotations – textual markers  /query  Query – actual time series data 12 https://github.com/grafana/simple-json-datasource
  • 12. /search Format Request { "target" : "select metric", "refId" : "E" } Response [ "Metric Name 1", "Metric Name2", ] An array of strings 13
  • 13. /annotations Format Request { "annotation" : { "name" : "Test", "iconColor" : "rgba(255, 96, 96, 1)", "datasource" : "Simple Example DS", "enable" : true, "query" : "{"name":"Timeseries A"}" }, "range" : { "from" : "2016-06-13T12:23:47.387Z", "to" : "2016-06-13T12:24:19.217Z" }, "rangeRaw" : { "from" : "2016-06-13T12:23:47.387Z", "to" : "2016-06-13T12:24:19.217Z" } } Response [ { "annotation": { "name": "Test", "iconColor": "rgba(255, 96, 96, 1)", "datasource": "Simple Example DS", "enable": true, "query": "{"name":"Timeseries A"}" }, "time": 1465820629774, "title": "Marker", "tags": [ "Tag 1", "Tag 2" ] } ] 14
  • 14. /query Format Request { "panelId" : 1, "maxDataPoints" : 1904, "format" : "json", "range" : { "from" : "2016-06-13T12:23:47.387Z", "to" : "2016-06-13T12:24:19.217Z" }, "rangeRaw" : { "from" : "2016-06-13T12:23:47.387Z", "to" : "2016-06-13T12:24:19.217Z" }, "interval" : "20ms", "targets" : [ { "target" : "Time series A", "refId" : "A" },] } Response [ { "target":"Timeseries A", "datapoints":[ [1936,1465820629774], [2105,1465820632673], [4187,1465820635570], [30001,1465820645243] }, { "target":"Timeseries B", "datapoints":[ ] } ] 15
  • 15. Structure of the Source Data { "_id" : ObjectId("56375bc54f3c4caedfe68aca"), "t" : { "eDesc" : "Some more verbose description of the datapoint than the name", "eId" : "56375ae24f3c4caedfe68a07", "name" : "a name of the datapoint series", "profile" : "P01", "rnId" : "56375b694f3c4caedfe68aa0", "rnStatus" : "OK", "uId" : "anonymous" }, "n" : { "begin" : NumberLong("1446468494689"), "value" : NumberLong(283) } } 16
  • 16. Custom Datasource  Should be  Lightweight  Fast / Performant  Simple 17
  • 17. Microservice?  Options for implementation  Java EE Microservice (i.e. Wildfly Swarm)  Springboot Microservice  Vert.x Microservice  Node.js  ... 19
  • 18. The Alternative Options Node.js  Single Threaded  Child Worker Processes  Javascript Only  Not best-choice for heavy computation Spring / Java EE  Multithreaded  Clusterable  Java Only  Solid Workhorses, cumbersome at times 21
  • 19. Why Vert.x?  High Performance, Low Footprint  Asynchronous, Non-Blocking  Actor-like Concurrency  Event & Worker Verticles  Message Driven  Polyglott  Java, Groovy, Javascript, Scala …  Scalable  Distributed Eventbus  Multi-threaded Event Loops 22
  • 21. Event Loop 24 Photo: Andreas Praefcke
  • 22. Event Loop and Verticles 25 Photo: RokerHRO 3rd Floor, Verticle A 2nd Floor, Verticle B 1st Floor, Verticle C
  • 23. 26
  • 24. 27
  • 27. CPU Multi-Reactor 31 Core Core Core Core Eventbus Other Vert.x Instance Browser Verticle Verticle
  • 28. Event & Worker Verticles Event Driven Verticles Worker Verticles 32 Verticle Verticle Verticle Thread Pool Thread Pool Verticle Verticle Verticle Verticle Verticle
  • 29. Implementing the datasource  Http Routes  Pre-Processing  Optional, for example: Split Request  Query Database for Time Data Points  Post Processing  Optional, for example: Merge, Calculations 33
  • 30. Step 1 – The naive approach  Find all datapoints within range 34
  • 31. Step 2 – Split Request  Split request into chunks (#chunks = #cores)  Use multiple Verticle Instance in parallel (#instances = #cores) ? 35 CPU
  • 32. Step 4 – Aggregate Datapoints  Use Mongo Aggregation Pipeline  Reduce Datapoints returned to service 37
  • 33. Step 5 – Percentiles (Service)  Fetch all data  Calculate percentiles in service 38 CPU
  • 34. Step 6 – Percentiles (DB)  Build aggregation pipeline to calculate percentiles  Algorithm, see http://www.dummies.com/education/math/statistics/how-to- calculate-percentiles-in-statistics/ 39 DB
  • 36. Remember the CELL BE?  CPU of the PS3  Central Bus (EIB)  1 General Purpose CPU  Runs the Game (Event) Loop  8 SPUs  Special Processing  Sound  Physics  AI  ... 41
  • 37. Adding more stats & calculation  Push Calculation to DB if possible  Add more workers / node for complex (post-) processing  Aggregate results before post-processing  DB performance is king 42
  • 38. Takeaways  Grafana is powerful tool for visualizing data  Information becomes consumable through visualization  Information is essential for decision making  Vert.x is  Reactive, Non-Blocking, Asynchronous, Scalable  Running on JVM  Polyglott  Fun 47 Source code on: https://github.com/gmuecke/grafana-vertx-datasource