{"id":31915484,"url":"https://github.com/stackify/stackify-api-ruby","last_synced_at":"2025-10-13T19:47:35.496Z","repository":{"id":47631630,"uuid":"21001769","full_name":"stackify/stackify-api-ruby","owner":"stackify","description":"Stackify API for Ruby","archived":false,"fork":false,"pushed_at":"2024-06-20T18:53:19.000Z","size":129,"stargazers_count":3,"open_issues_count":1,"forks_count":12,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-06-21T12:40:34.728Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2014-06-19T13:44:56.000Z","updated_at":"2024-06-20T18:53:22.000Z","dependencies_parsed_at":"2024-01-24T15:47:24.874Z","dependency_job_id":"47e65a10-08d1-448a-8a47-86a2cda7a7cc","html_url":"https://github.com/stackify/stackify-api-ruby","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/stackify/stackify-api-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackify","download_url":"https://codeload.github.com/stackify/stackify-api-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackify%2Fstackify-api-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016839,"owners_count":26085889,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-10-13T19:47:30.928Z","updated_at":"2025-10-13T19:47:35.491Z","avatar_url":"https://github.com/stackify.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stackify-api-ruby\n\n[![Gem Version](https://badge.fury.io/rb/stackify-api-ruby.svg)](http://badge.fury.io/rb/stackify-api-ruby)\n\nStackify Logs and Metrics API for Ruby.\n\nErrors and Logs Overview:\n\nhttp://support.stackify.com/errors-and-logs-overview/\n\nSign Up for a Trial:\n\nhttp://www.stackify.com/sign-up/\n\n## Installation and Configuration\n\nRequirements: Ruby 1.9/2.0/2.1, Rails 3.x/4.x (optional)\n\n### Rails\n\nAdd the stackify gem to your Gemfile. In Gemfile:\n\n    gem 'stackify-api-ruby'\n\nRun the bundle command to install it:\n\n    $ bundle\n\nor install it manually:\n\n    $ gem install stackify-api-ruby\n\nAfter you install stackify-api-ruby you need to run the generator:\n\n    $ rails g stackify --api_key=your_api_key\n\nThe generator creates a file 'config/initializers/stackify.rb' configuring stackify-api-ruby with your API key. You can change default settings there.\n\n### Non-Rails\n\nFor using stackify-api-ruby gem within any Ruby application add to top of your main file:\n\n    require 'stackify-api-ruby'\n\nAfter that you need to make base configuration:\n\n    Stackify.setup do |config|\n      config.api_key = \"your_api_key\"\n      config.env = :development\n      config.app_name = \"Your app name\"\n    end\n\n## Optional Configuration\n\nGem has 3 modes of work - \"both\", \"logging\", \"metrics\". Mode \"both\" turns on both parts of gem - logging and metrics.\nIf you need ONLY logging or metrics use \"logging\" or \"metrics\" mode accordingly.\n\n    config.mode = :metrics\n\nIf you want to use proxy for sending request, you can do it in such way:\n\n    config.proxy = { uri: '127.0.0.1:8118', user: 'user_name', password: 'some_password' }\n\n## Log API Usage\n\n### Rails\n\nstackify-api-ruby starts with start of Rails. Every error, which occurs within your application, will be caught and sent to Stackify automatically. The same situation with logs - you just use the Rails logger as usual:\n\n    Rails.logger.info \"Some log message\"\n\nIf you want to redefine \u003cb\u003elogger\u003c/b\u003e, you should add\n\n    config.logger = ::Stackify::LoggerProxy.new(ActiveSupport::Logger.new(Rails.root.join('log', \"#{Rails.env}.log\")))\n\nto your config/environments/%environment%. \u003cb\u003eNote:\u003c/b\u003e in this case Stackify#config.log_level will affect entire system.\n\n### Non-Rails\n\nAfter logs configuring you should wrap up your logger:\n\n    logger = Logger.new('mylog.log')\n    logger = Stackify::LoggerProxy.new(logger)\n\nAnd last thing you need to do - call method \"run\":\n\n    Stackify.run #remember that this call is running in the background of your main script\n\n## Metrics API Usage\n\nThere are four different types of metrics:\n\n- **Gauge**: Keeps track of the last value that was set in the current minute\n\n        Stackify::Metrics.set_gauge \"MyCategory\", \"MyGauge\", 100\n\n- **Counter**: Calculates the rate per minute\n\n        Stackify::Metrics.count \"MyCategory\", \"MyCounter\"\n\n- **Average**: Calculates the average of all values in the current minute\n\n        Stackify::Metrics.average \"MyCategory\", \"AverageSpeed\", 200\n\n- **Timer**: Calculates the average elapsed time for an operation in the current minute\n\n        t = Time.now\n        Stackify::Metrics.time \"MyCategory\", \"ElapsedTime\", t\n        # or\n        Stackify::Metrics.time_duration \"MyCategory\", \"ElapsedTime\", 5.seconds\n\n- **Counter and Timer**: Composite of the Counter and Timer metrics for convenience\n\n        t = Time.now\n        Stackify::Metrics.count_and_time \"Metric\", \"CounterWithTime\", t\n\nWe can configure every metric with settings:\n\n        settings = Stackify::Metrics::MetricSettings.new\n        settings.autoreport_zero_if_nothing_reported = true\n        # or\n        settings.autoreport_last_value_if_nothing_reported = true\n        Stackify::Metrics.set_gauge \"MyCategory\", \"MyGauge\", 100 , settings\n\nNote, \"autoreport_last_value_if_nothing_reported\" property has influence only on \"average\" metric.\n\n### **Real User Monitoring (RUM)**\n\nReal user monitoring injects a script tag containing the [RUM JS](https://stackify.com/retrace-real-user-monitoring/) that is responsible for capturing information about the http requests on the browser. This approach is manual and needs to be configured.\n\n#### RUM - Setup\n\n```ruby\n# Configuration - Standard API\nStackify.setup do |config|\n  ...\n  config.rum_key = \"YourRumKey\"\nend\n\n# Use this to apply on views\nStackify.rum.insert_rum_script\n```\n\n## Troubleshooting\n\nIf there are problems, you can enable internal logging of the stackify-api-ruby project. Uncomment out the config.logger and config.logger.level lines in the 'config/initializers/stackify.rb' file:\n\n```\nconfig.logger = Logger.new(Rails.root.join(\"log\", \"stackify.log\"))\nconfig.logger.level = Logger::DEBUG\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackify%2Fstackify-api-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackify%2Fstackify-api-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackify%2Fstackify-api-ruby/lists"}