{"id":23131209,"url":"https://github.com/emartech/sidekiq_middlewares","last_synced_at":"2025-04-04T07:27:38.506Z","repository":{"id":56895587,"uuid":"93056501","full_name":"emartech/sidekiq_middlewares","owner":"emartech","description":"Ruby Sidekiq Middlewares For common uses","archived":false,"fork":false,"pushed_at":"2021-09-15T13:57:25.000Z","size":19,"stargazers_count":0,"open_issues_count":6,"forks_count":1,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-14T07:41:07.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emartech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-01T12:48:05.000Z","updated_at":"2024-04-14T07:41:07.677Z","dependencies_parsed_at":"2022-08-21T01:50:19.577Z","dependency_job_id":null,"html_url":"https://github.com/emartech/sidekiq_middlewares","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fsidekiq_middlewares","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fsidekiq_middlewares/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fsidekiq_middlewares/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fsidekiq_middlewares/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emartech","download_url":"https://codeload.github.com/emartech/sidekiq_middlewares/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247137675,"owners_count":20889909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T11:12:18.480Z","updated_at":"2025-04-04T07:27:38.488Z","avatar_url":"https://github.com/emartech.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sidekiq_middlewares\n[![Build Status](https://travis-ci.org/emartech/sidekiq_middlewares.svg?branch=master)](https://travis-ci.org/emartech/sidekiq_middlewares)\n\nRuby Sidekiq Middlewares For common uses\n\n### Benchmarker\n\n#### Optiosn\n* logger\n  * required\n  * this will be the object that must respond to :info method\n* formatter\n  * optional\n  * this proc will receive one argument, a message object which is a Hash type\n  * If the logger can handle Hash messages, such as TwP's [logging](https://github.com/TwP/logging) libary, than you don't need this\n\nfirst you need a logger that respond to :info method, and format the message object into an expected format.\n\nFor simplicity, in the example this will be json.\n```ruby\nrequire 'json'\nrequire 'logger'\njson_logger = Logger.new(STDOUT)\njson_logger.formatter = proc do |severity, datetime, progname, msg|\n  JSON.dump(msg) + \"\\n\"\nend\n```\n\nThan you can use it with the Benchmarker middleware like this:\n\n```ruby\nSidekiq.configure_server do |config|\n  config.redis = sidekiq_redis_config\n\n  config.server_middleware do |chain|\n    chain.add SidekiqMiddlewares::Benchmarker, logger: json_logger\n  end\nend\n```\n\nOr if you don't want to provide logger who also know about how to format, you can give an optional formatter to the middleware.\n\n```ruby\nSidekiq.configure_server do |config|\n  config.redis = sidekiq_redis_config\n\n  config.server_middleware do |chain|\n    chain.add SidekiqMiddlewares::Benchmarker, logger: Logger.new(STDOUT), formatter: proc { |m| JSON.dump(m) + \"\\n\" }\n  end\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Fsidekiq_middlewares","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femartech%2Fsidekiq_middlewares","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Fsidekiq_middlewares/lists"}