SlideShare a Scribd company logo
1 of 13
Download to read offline
Collecting metrics with
Prometheus and
VictoriaMetric
Aliaksandr Valialkin, VictoriaMetrics
Let me introduce myself
● VictoriaMetrics founder and core developer
● Fasthttp creator
● Fond of performance optimizations
What is Prometheus?
● The most popular monitoring system
● Metrics’ collector
● Time Series DB
● Rules evaluator and alerter
What Prometheus can do?
● Collecting metrics from pre-configured targets
● Storing metrics in the local and remote DBs
● Executing queries against metrics stored in the DB
● Sending alerts on pre-configured rules
● Helping to build nice dashboards in Grafana
Ruby + Prometheus
● https://github.com/reinh/statsd +
https://github.com/prometheus/statsd_exporter
● https://github.com/prometheus/client_ruby - hard to use properly due
to support pre-fork (unicorn) servers issue
https://github.com/reinh/statsd usage
# Set up a global Statsd client for a server on localhost:9125
$statsd = Statsd.new 'localhost', 9125
# Send some stats
$statsd.increment 'garets'
$statsd.timing 'glork', 320
$statsd.gauge 'bork', 100
# Use {#time} to time the execution of a block
$statsd.time('account.activate') { @account.activate! }
# Create a namespaced statsd client and increment 'account.activate'
statsd = Statsd.new('localhost').tap{|sd| sd.namespace = 'account'}
statsd.increment 'activate'
Local DB issues in Prometheus
● Doesn’t scale outside the node
● Has limited size and retention (15 days)
Remote DB to rescue
● Remote DB may transparently scale to many nodes
● Remote DB may deal better with big retentions
● Remote DB may collect and query data from multiple Prometheus
instances
● Remote storages for Prometheus -
https://prometheus.io/docs/operating/integrations/#remote-endpoints-
and-storage
What is VictoriaMetrics?
● Long-term remote storage for Prometheus
● Single-node version is available at
https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/Single-server-VictoriaMetrics
● SaaS is in progress at https://victoriametrics.com
● There is SaaS playground at https://play.victoriametrics.com/signIn
VictoriaMetrics features
● Fast and cost-effective - see articles at https://medium.com/@valyala
● Easy to operate - just a single executable without dependencies
● Supports PromQL - native query language for Prometheus
● Accepts metrics in InfluxDB and Graphite formats
Questions?

More Related Content

More from Ruby Meditation

More from Ruby Meditation (20)

Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
 
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
 
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
 
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26
New features in Rails 6 -  Nihad Abbasov (RUS) | Ruby Meditation 26New features in Rails 6 -  Nihad Abbasov (RUS) | Ruby Meditation 26
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26
 
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
 
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
 
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
 
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
 
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
 
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
 
Rails App performance at the limit - Bogdan Gusiev
Rails App performance at the limit - Bogdan GusievRails App performance at the limit - Bogdan Gusiev
Rails App performance at the limit - Bogdan Gusiev
 
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
 
Postgres vs Elasticsearch while enriching data - Vlad Somov | Ruby Meditaiton...
Postgres vs Elasticsearch while enriching data - Vlad Somov | Ruby Meditaiton...Postgres vs Elasticsearch while enriching data - Vlad Somov | Ruby Meditaiton...
Postgres vs Elasticsearch while enriching data - Vlad Somov | Ruby Meditaiton...
 
Database Sharding in Rails Applications – Vitalik Danchenko | Ruby Meditatio...
 Database Sharding in Rails Applications – Vitalik Danchenko | Ruby Meditatio... Database Sharding in Rails Applications – Vitalik Danchenko | Ruby Meditatio...
Database Sharding in Rails Applications – Vitalik Danchenko | Ruby Meditatio...
 
Building MVP from business owner’s perspective – Piotr Latoszek | Ruby Medita...
Building MVP from business owner’s perspective – Piotr Latoszek | Ruby Medita...Building MVP from business owner’s perspective – Piotr Latoszek | Ruby Medita...
Building MVP from business owner’s perspective – Piotr Latoszek | Ruby Medita...
 
Growing Rails Apps - Dmitry Zhlobo | Ruby Meditation #23
Growing Rails Apps - Dmitry Zhlobo | Ruby Meditation #23Growing Rails Apps - Dmitry Zhlobo | Ruby Meditation #23
Growing Rails Apps - Dmitry Zhlobo | Ruby Meditation #23
 
Residence permit EU - Gennadii Miroshnychenko
Residence permit EU - Gennadii MiroshnychenkoResidence permit EU - Gennadii Miroshnychenko
Residence permit EU - Gennadii Miroshnychenko
 
Practical SOLID with Rails - Andrii Savchenko
Practical SOLID with Rails - Andrii SavchenkoPractical SOLID with Rails - Andrii Savchenko
Practical SOLID with Rails - Andrii Savchenko
 
Open education - Artem Suchov
Open education - Artem SuchovOpen education - Artem Suchov
Open education - Artem Suchov
 
Inside Out Ruby: Using MRI as a C library - Artur Pyrogovskyi
Inside Out Ruby: Using MRI as a C library - Artur PyrogovskyiInside Out Ruby: Using MRI as a C library - Artur Pyrogovskyi
Inside Out Ruby: Using MRI as a C library - Artur Pyrogovskyi
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

Collecting metrics with Prometheus and VictoriaMetrics - Aliaksandr Valialkin (RUS) | Ruby Meditation 26

  • 1. Collecting metrics with Prometheus and VictoriaMetric Aliaksandr Valialkin, VictoriaMetrics
  • 2. Let me introduce myself ● VictoriaMetrics founder and core developer ● Fasthttp creator ● Fond of performance optimizations
  • 3. What is Prometheus? ● The most popular monitoring system ● Metrics’ collector ● Time Series DB ● Rules evaluator and alerter
  • 4. What Prometheus can do? ● Collecting metrics from pre-configured targets ● Storing metrics in the local and remote DBs ● Executing queries against metrics stored in the DB ● Sending alerts on pre-configured rules ● Helping to build nice dashboards in Grafana
  • 5.
  • 6. Ruby + Prometheus ● https://github.com/reinh/statsd + https://github.com/prometheus/statsd_exporter ● https://github.com/prometheus/client_ruby - hard to use properly due to support pre-fork (unicorn) servers issue
  • 7. https://github.com/reinh/statsd usage # Set up a global Statsd client for a server on localhost:9125 $statsd = Statsd.new 'localhost', 9125 # Send some stats $statsd.increment 'garets' $statsd.timing 'glork', 320 $statsd.gauge 'bork', 100 # Use {#time} to time the execution of a block $statsd.time('account.activate') { @account.activate! } # Create a namespaced statsd client and increment 'account.activate' statsd = Statsd.new('localhost').tap{|sd| sd.namespace = 'account'} statsd.increment 'activate'
  • 8. Local DB issues in Prometheus ● Doesn’t scale outside the node ● Has limited size and retention (15 days)
  • 9. Remote DB to rescue ● Remote DB may transparently scale to many nodes ● Remote DB may deal better with big retentions ● Remote DB may collect and query data from multiple Prometheus instances ● Remote storages for Prometheus - https://prometheus.io/docs/operating/integrations/#remote-endpoints- and-storage
  • 10.
  • 11. What is VictoriaMetrics? ● Long-term remote storage for Prometheus ● Single-node version is available at https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/Single-server-VictoriaMetrics ● SaaS is in progress at https://victoriametrics.com ● There is SaaS playground at https://play.victoriametrics.com/signIn
  • 12. VictoriaMetrics features ● Fast and cost-effective - see articles at https://medium.com/@valyala ● Easy to operate - just a single executable without dependencies ● Supports PromQL - native query language for Prometheus ● Accepts metrics in InfluxDB and Graphite formats