{"id":15152531,"url":"https://github.com/khusnetdinov/active_endpoint","last_synced_at":"2025-09-29T23:31:46.531Z","repository":{"id":56842111,"uuid":"92333459","full_name":"khusnetdinov/active_endpoint","owner":"khusnetdinov","description":"[ARCHIVE] :wrench: ActiveEndpoint is middleware for Rails application that collect and analize request and response per request for route endpoint. It works with minimum affecting to application response time.","archived":true,"fork":false,"pushed_at":"2018-05-02T13:20:46.000Z","size":96,"stargazers_count":13,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-15T23:59:19.039Z","etag":null,"topics":["analize-request","analyzer","middleware","rails","rails-application","request","response"],"latest_commit_sha":null,"homepage":"","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/khusnetdinov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-24T20:25:25.000Z","updated_at":"2023-01-28T19:48:37.000Z","dependencies_parsed_at":"2022-08-29T06:50:50.295Z","dependency_job_id":null,"html_url":"https://github.com/khusnetdinov/active_endpoint","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Factive_endpoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Factive_endpoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Factive_endpoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khusnetdinov%2Factive_endpoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khusnetdinov","download_url":"https://codeload.github.com/khusnetdinov/active_endpoint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234673546,"owners_count":18869688,"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":["analize-request","analyzer","middleware","rails","rails-application","request","response"],"created_at":"2024-09-26T16:03:23.659Z","updated_at":"2025-09-29T23:31:41.027Z","avatar_url":"https://github.com/khusnetdinov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveEndpoint [![Build Status](https://travis-ci.org/khusnetdinov/active_endpoint.svg?branch=master)](https://travis-ci.org/khusnetdinov/active_endpoint) [![Gem Version](https://badge.fury.io/rb/active_endpoint.svg)](https://badge.fury.io/rb/active_endpoint) [![Open Source Helpers](https://www.codetriage.com/khusnetdinov/active_endpoint/badges/users.svg)](https://www.codetriage.com/khusnetdinov/active_endpoint)\n\n## Your request tracking tool for rails applications\n\n## Attention! Gem in under active test and is preparing for first release !\n\n![img](http://res.cloudinary.com/dtoqqxqjv/image/upload/c_scale,w_346/v1501331806/github/active_probe.jpg)\n\n\n## Usage\n\nActiveEndpoint is middleware for Rails applications that collects and analyses requests and responses per request for endpoint. It works with minimal impact on application's response time.\n\nThis gem uses `ActiveSupport::Notifications` and `Cache Storage` to reduce possible impact on application request / response processing time.\n\n## Features\n\n - Metrics are stored in database for further tracking and analysis.\n - History rotation with configurable limits of records amount and age.\n - Routes filter (blacklist).\n - Probes tagging by processing time.\n\n## Metrics\n\nThese endpoint metrics are stored in DB:\n\n   - `:uuid` - uniq probe identifier\n   - `:endpoint` - requested endpoint\n   - `:path` - requested full path\n   - `:query_string` - request query string\n   - `:request_method` - http request method\n   - `:ip` - ip address asked request\n   - `:url` - request full url\n   - `:xhr` - is request ajax?\n   - `:started_at` - probe start time\n   - `:finished_at` - probe finish time\n   - `:duration` - probe request duration\n   - `:params` - parsed requested params\n   - `:response` - Base64 encoded html response\n   - `:body` - Base64 encoded request body\n\nAdditional information is taken from Rack log:\n\n`:base_url, :content_charset, :content_length, :content_type, :fullpath, :http_version, :http_connection, :http_accept_encoding, :http_accept_language, :media_type, :media_type_params, :method, :path_info, :pattern, :port, :protocol, :server_name, :ssl`.\n\nRequests which are not recognized by rails router are stored as `unregistred`.\n\n## Requirements\n\n - `redis` as cache storage\n\nBe sure that you have all requrements installed on you machine.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'active_endpoint'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install active_endpoint\n\nSetup project for using gem:\n\n    $ rails generate active_endpoint:install\n\nMigrate database for models:\n\n    $ rake db:migrate  # Rails \u003c=4\n    $ rails db:migrate # Rails \u003e=5\n\nNow project has all files and settings that allow you to use gem.\n\n## Configuration\n\n### Endpoints filter (blacklist)\n\nBy default ActiveEndpoint treats all routes as `whitelist` routes. To filter some endpoints you can use `blackilist` configuration, as shown below:\n\n```ruby\nActiveEndpoint.configure do |endpoint|\n  endpoint.blacklist.configure  do |blacklist|\n    # Ignore endpoint \"welcome#index\"\n    blacklist.add(endpoint: \"welcome#index\")\n\n    # Ignore \"web/users\" controller actions\n    blacklist.add(resources: [\"web/users\"])\n\n    # Ignore \"web/users#show\" action with scoped controller\n    blacklist.add(scope: \"web\", resources: \"users\", actions: [\"show\"])\n\n    # Ignore \"admin\" scope controllers\n    blacklist.add(scope: \"admin\")\n  end\nend\n```\n\n#### Ignore one endpoint\n\n`blacklist.add(endpoint: \"users#index\")` - Ignore one endpoint.\n\n#### Ignore controller actions\n\n`blacklist.add(resources: \"users\")` - Ignore all actions for `UsersController`.\n\n`blacklist.add(resources: [\"users\", \"managers\"])` - Ignore all actions in `UsersController` and `ManagersController`.\n\n`blacklist.add(resources: \"users\", actions: [\"show\"])` - Ignore only `show` action in `UsersController`.\n\n#### Ignore namespace or scope\n\n`blacklist.add(scope: \"admin\")` - Ignore all controllers and actions for `admin` namespace or scope.\n\n### Constraints\n\nYou can specify the amount and period of request records to keep in database. Records which exceed these limits are automatically removed from database.\nSee example below:\n\n ```ruby\nActiveEndpoint.configure do |endpoint|\n  # Defines default settings, 1 probe per 10 minutes for endpoint request\n  constraint_limit = 1\n  constraint_period = 10.minutes\n\n  endpoint.constraints.configure  do |constraints|\n    # Constraint endpoint \"welcome#index\" with 1 minute period and default limit\n    # and configure database constraints to keep 1000 probes per 1 week.\n    constraints.add(endpoint: \"welcome#index\",\n      rule: { 1.minute },\n      storage: { limit: 1000, period: 1.week })\n    # Constraints \"web/users\" controller actions with custom limit and period\n    # with defailt storage constraints\n    constraints.add(resources: [\"web/users\"], rule: { limit: 100, period: 5.minutes })\n  end\nend\n```\nNOTE: To define a constraint you should define at least one limit or period.\n\n### Storage settings\n\nActiveEndpoint creates two models in you rails application: `Probe` and it's child `UnregistredProbe`.\nTo prevent problems with database probes are removed when user defines custom period. Also you can limit storage probes in database.\nIt is recommended to define own storage default to prevent unwanted probes deletion. See example below:\n\n```ruby\nActiveEndpoint.configure do |endpoint|\n  # Define default limit for maximum probes amount\n  endpoint.storage_limit = 1000\n\n  # Define default period to keep probes in database.\n  endpoint.storage_period = 1.week\n\n  # Define amount of periods (constraint periods) that endpoints are kept in database.\n  endpoint.storage_keep_periods = 2\nend\n```\n\n### Tagging probes\nYou can group probes by tags automatically assigned according to request processing time (ms). See example below:\n\n```ruby\nActiveEndpoint.configure do |endpoint|\n  endpoint.tags.configure do |tags|\n    tags.add(:fast, { less_than: 250 })\n    tags.add(:normal, { greater_than_or_equal_to: 250, less_than: 500 })\n    tags.add(:slow, { greater_than_or_equal_to: 500, less_than: 750 })\n    tags.add(:acceptable, { greater_than_or_equal_to: 500, less_than: 1000 })\n    tags.add(:need_optimization, { greater_than_or_equal_to: 1000 })\n  end\nend\n```\n\n#### Mehods for conditions\n\n   - greater_than = '\u003e'\n   - greater_than_or_equal_to = '\u003e=',\n   - equal_to = '=',\n   - less_than = '\u003c',\n   - less_than_or_equal_to = '\u003c=',\n\n#### Tagged model scopes\n\nDefined tags are also usefull for scopes queries:\n\n```ruby\nActiveEndpoint::Probe.tagged_as(:need_optimization)\n#=\u003e Returns all probes having corresponding tag and thus matching the condition\n#   { greater_than_or_equal_to: 1000 }\n```\n\n#### Instance methods\n\nCheck tag on model:\n\n```ruby\nActiveEndpoint::Probe.last.tag\n#=\u003e Returns probe's tag\n```\n\n### Web UI\n\nActiveEndpoint offer rails engine for managing probes. Mount it:\n\n```ruby\n  mount ActiveEndpoint::Engine =\u003e '/active_endpoint'\n```\n\n![img](http://res.cloudinary.com/dtoqqxqjv/image/upload/v1502260319/github/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA_%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0_2017-08-09_%D0%B2_9.06.08_mmwh5d.png)\n\n## License\n\nThis gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhusnetdinov%2Factive_endpoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhusnetdinov%2Factive_endpoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhusnetdinov%2Factive_endpoint/lists"}