Coder Social home page Coder Social logo

prome's Introduction

Prome

Prometheus for rails and optional sidekiq.

get started

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

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

default metrics

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

custom metrics

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

Contributors

lord63 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.