Prometheus for rails and optional sidekiq.
In your Gemfile, add this
gem 'prome', github: 'getqujing/prome'
In config/routes.rb, mount the metrics endpoint
require 'prome/web'
mount Prome::Web, at: "/metrics"
And you are good to go.
Sidekiq server side metrics are served by a standalone web server, by default it will listen to 0.0.0.0:9310
when you start the sidekiq server.
The bind address can be configured like this, in config/initializers/prometheus.rb
Prome.configure do |config|
config.sidekiq_metrics_host = "127.0.0.1"
config.sidekiq_metrics_port = 3001
end
name | type | description |
---|---|---|
rails_requests_total |
counter | number of HTTP requests rails processed |
rails_request_duration_seconds |
histogram | A histogram of the response latency |
rails_view_runtime_seconds |
histogram | view rendering time per request |
rails_db_runtime_seconds |
histogram | activerecord execution time per request |
sidekiq_jobs_executed_total |
counter | number of jobs sidekiq executed |
sidekiq_jobs_success_total |
counter | number of jobs successfully processed by sidekiq |
sidekiq_jobs_failed_total |
counter | number of jobs failed in sidekiq |
sidekiq_job_runtime_seconds |
histogram | job execution time |
sidekiq_jobs_enqueued_total |
counter | number of jobs sidekiq enqueued. |
sidekiq_jobs_waiting_count |
gauge | number of jobs waiting to process in sidekiq. |
Note: all sidekiq related metrics are started from the moment using this gem, not equal to Sidekiq::Stats
Register the metric in initializer
Prome.configure do |config|
Prome.counter(:app_posts_created_total, "A counter of total number of posts created.")
# Prome also responds to :histogram, :gauge, :summary, just register what you want :)
end
In Post
model
class Post < ApplicationRecord
after_create do
Prome.get(:app_posts_created_total).increment({})
end
end
prome's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.