• Stars
    star
    795
  • Rank 54,990 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 9 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

See statistic about your workers

Sidekiq::Statistic

Build Status Code Climate Gitter

Improved display of statistics for your Sidekiq workers and jobs.

Screenshots

Index page:

sidekiq-history_index

Worker page with table (per day):

sidekiq-history_worker

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-statistic'

And then execute:

$ bundle

Usage

Using Rails

Read Sidekiq documentation to configure Sidekiq Web UI in your routes.rb.

When Sidekiq Web UI is active you're going be able to see the option Statistic on the menu.

Using a standalone application

Read Sidekiq documentation to configure Sidekiq in your Rack server.

Next add require 'sidekiq-statistic' to your config.ru.

# config.ru
require 'sidekiq/web'
require 'sidekiq-statistic'

use Rack::Session::Cookie, secret: 'some unique secret string here'
run Sidekiq::Web

Configuration

The Statistic configuration is an initializer that GEM uses to configure itself. The option max_timelist_length is used to avoid memory leak, in practice, whenever the cache size reaches that number, the GEM is going to remove 25% of the key values, avoiding inflating memory.

Sidekiq::Statistic.configure do |config|
  config.max_timelist_length = 250_000
end

Supported Sidekiq versions

Statistic support the following Sidekiq versions:

  • Sidekiq 6.
  • Sidekiq 5.
  • Sidekiq 4.
  • Sidekiq 3.5.

JSON API

/api/statistic.json

Returns statistic for each worker.

Params:

  • dateFrom - Date start (format: yyyy-mm-dd)
  • dateTo - Date end (format: yyyy-mm-dd)

Example:

$ curl http://example.com/sidekiq/api/statistic.json?dateFrom=2015-07-30&dateTo=2015-07-31

# =>
  {
    "workers": [
      {
        "name": "Worker",
        "last_job_status": "passed",
        "number_of_calls": {
          "success": 1,
          "failure": 0,
          "total": 1
        },
        "runtime": {
          "last": "2015-07-31 10:42:13 UTC",
          "max": 4.002,
          "min": 4.002,
          "average": 4.002,
          "total": 4.002
        }
      },

      ...
    ]
  }

/api/statistic/:worker_name.json

Returns worker statistic for each day in range.

Params:

  • dateFrom - Date start (format: yyyy-mm-dd)
  • dateTo - Date end (format: yyyy-mm-dd)

Example:

$ curl http://example.com/sidekiq/api/statistic/Worker.json?dateFrom=2015-07-30&dateTo=2015-07-31

# =>
{
  "days": [
    {
      "date": "2015-07-31",
      "failure": 0,
      "success": 1,
      "total": 1,
      "last_job_status": "passed",
      "runtime": {
        "last": null,
        "max": 0,
        "min": 0,
        "average": 0,
        "total": 0
      }
    },

    ...
  ]
}

Update statistic inside middleware

You can update your worker statistic inside middleware. For this you should to update sidekiq:statistic redis hash. This hash has the following structure:

  • sidekiq:statistic - redis hash with all statistic
    • yyyy-mm-dd:WorkerName:passed - count of passed jobs for Worker name on yyyy-mm-dd
    • yyyy-mm-dd:WorkerName:failed - count of failed jobs for Worker name on yyyy-mm-dd
    • yyyy-mm-dd:WorkerName:last_job_status - string with status (passed or failed) for last job
    • yyyy-mm-dd:WorkerName:last_time - date of last job performing
    • yyyy-mm-dd:WorkerName:queue - name of job queue (default by default)

For time information you should push the runtime value to yyyy-mm-dd:WorkerName:timeslist redis list.

How it works

Big image 'how it works'

how-it-works

Contributing

  1. Fork it ( https://github.com/davydovanton/sidekiq-statistic/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

More Repositories

1

awesome-hanami

A collection of awesome Hanami Gems and projects
Ruby
406
star
2

kan

Simple, functional authorization library and role management for ruby
Ruby
234
star
3

stop_active_support_anywhere

Stop use Active Support in not rails related projects
Ruby
146
star
4

shallow_attributes

Simple and lightweight Virtus analog.
Ruby
99
star
5

rubyjobs.dev

Job boards for Russian-speaking Ruby developers
Ruby
80
star
6

novel

Orchestration SAGA builder for ruby
Ruby
47
star
7

hanami-architecture

Ideas and suggestions about architecture for hanami projects
47
star
8

rspec-hanami

RSpec Matchers for Hanami
Ruby
46
star
9

cqrs-ruby-example

Example of using CQRS with ruby, hanami-api, rom, dry-system and kafka
Ruby
42
star
10

AnyBar_rb

Ruby wrapper for AnyBar.app
Ruby
37
star
11

ruby-service-template

Simple (Micro)Service template based on dry-system, hanami-api, hanami 2.0, rom, rabbitmq, kafka, psql, and other microlibraries.
Ruby
31
star
12

relative_time

Micro lib without any dependency for getting relative time
Ruby
22
star
13

hanami-serializer

Serializer library for hanami applications
Ruby
22
star
14

dotfiles

My dotfiles
Vim Script
21
star
15

rodauth_hanami

Example app for integrate rodauth server to hanami app
Ruby
16
star
16

web_bouncer

Simple and module auth lib for any rack projects
Ruby
16
star
17

popug-inventory

HTML
16
star
18

layerd-arch-style-with-dry-example

Example of layered architecture style builded with dry-rb libs
Ruby
16
star
19

hanami_event_example

Simple hanami app with hanami events
Ruby
15
star
20

hanami-bootstrap

Bootstrap wrapper for hanami framework.
Ruby
14
star
21

hanami-pagination

Ruby
14
star
22

cookie_box

Follow and controll issues from several repositories from one place
Ruby
12
star
23

hanami-scaffold

Make hanami scaffolds faster
Ruby
12
star
24

octostar

Improved search for your github stars
Ruby
11
star
25

event_schema_registry

Simple implantation of schema registry for JSON schema events
Ruby
11
star
26

rom_sql_graph

Display your DB (sql) association graph
Ruby
9
star
27

soa-readiness-checklist

Check your system for SOA readiness
9
star
28

state_changer

The state machine for change your data between states.
Ruby
9
star
29

dry-system-hanami

Folder resolver for dry-system in hanami projects
Ruby
8
star
30

hanami-zsh

Zsh plugin for hanami.
7
star
31

hanami-rodauth

This repository is no longer maintain: Roudauth wrapper for hanami apps
Ruby
7
star
32

rlisp

Simple scheme interpreter written on ruby
Ruby
7
star
33

ivento

Simple event sourcing framework in functional style
Ruby
7
star
34

hanami-bench

Benchmarks for hanami
Ruby
6
star
35

link-shortener

Simple hanami link shortener application
Ruby
6
star
36

ruby-job-task

Тестовое задание на позицию ruby разработчика
Ruby
6
star
37

vim-html2slim

Vim plugin for convert HTML(erb) to Slim
Vim Script
6
star
38

AnyBar_cr

Simple crystal wrapper for AnyBar
Crystal
5
star
39

hanami-project-template

Template repository for all new project
Ruby
5
star
40

igoods-service-template

Igoods service template
Ruby
4
star
41

excess.zsh-theme

Simple zsh color theme
4
star
42

davydovanton.github.io

HTML
4
star
43

grape-rodauth

Simple grape app with rodauth
Ruby
4
star
44

kaminari-hanami

This repository is no longer maintain: Kaminari integration for @hanami
Ruby
4
star
45

yeelight-lamp-client

Ruby client for yeelight lamps
Ruby
4
star
46

pepe

Pepe for you ruby console
Ruby
3
star
47

dry-http-client

This repository is no longer maintain: Fundctional HTTP client based on dry stack.
Ruby
3
star
48

rubyunderhood

Коллективный твиттер-аккаунт для ruby разработчиков с новым автором каждую неделю.
3
star
49

hanami-graphql-example

Simple example of GQL in hanami application
Ruby
2
star
50

hanami-action-documentation

Automatically generate documentation for you actions
Ruby
2
star
51

system-analysis-example-system

2
star
52

event_sourcing_ruby

Simple repository for playing with event sourcing conceptions from F#
Ruby
2
star
53

hanami-workshop

Simple hanami app for workshop
Ruby
2
star
54

lotus-webpack-reactjs

Simple lotus app with webpack and react js
JavaScript
2
star
55

arch-katas-solution

Personal repository for arch kata solutions (rus)
1
star
56

hanami-auth

This repository is no longer maintain. Prototype for hanami auth (bad way)
Ruby
1
star
57

service-separation-checklist

Simple checklist for service separation
1
star
58

hanami-interactor-matcher

This repository is no longer maintain: Simple dry-matcher for hanami interactor
Ruby
1
star
59

bruevich

Ruby
1
star
60

momiji

Post framework
Ruby
1
star
61

hanami-operation-generator

Simple library for generating operations for hanami-dry-system project
Ruby
1
star
62

data_matrix

simple way for creating grids for any data objects and for any frameworks
Ruby
1
star