{"id":15468306,"url":"https://github.com/winebarrel/spring_onion","last_synced_at":"2025-04-22T11:28:51.218Z","repository":{"id":52180390,"uuid":"280480749","full_name":"winebarrel/spring_onion","owner":"winebarrel","description":"Log MySQL queries with EXPLAIN that may be slow.'","archived":false,"fork":false,"pushed_at":"2023-08-24T02:43:45.000Z","size":62,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T00:14:47.528Z","etag":null,"topics":["activerecord","mysql","rails","ruby"],"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/winebarrel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"publiccode":null,"codemeta":null}},"created_at":"2020-07-17T17:03:23.000Z","updated_at":"2023-08-29T00:51:09.000Z","dependencies_parsed_at":"2024-10-02T01:40:48.432Z","dependency_job_id":"d734f9a9-aaa8-4432-aa32-6bc59da40fa5","html_url":"https://github.com/winebarrel/spring_onion","commit_stats":{"total_commits":57,"total_committers":2,"mean_commits":28.5,"dds":"0.10526315789473684","last_synced_commit":"6868920c3f4c7535ee4dfdbfdb4d35bae3f9d2c2"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fspring_onion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fspring_onion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fspring_onion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fspring_onion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winebarrel","download_url":"https://codeload.github.com/winebarrel/spring_onion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250231351,"owners_count":21396453,"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":["activerecord","mysql","rails","ruby"],"created_at":"2024-10-02T01:40:39.723Z","updated_at":"2025-04-22T11:28:51.180Z","avatar_url":"https://github.com/winebarrel.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringOnion\n\nLog MySQL queries with EXPLAIN that may be slow.\n\nInspired by [MySQLCasualLog.pm](https://gist.github.com/kamipo/839e8a5b6d12bddba539).\n\n[![Build Status](https://travis-ci.org/winebarrel/spring_onion.svg?branch=master)](https://travis-ci.org/winebarrel/spring_onion)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'spring_onion'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install spring_onion\n\n## Usage\n\n```ruby\n#!/usr/bin/env ruby\nrequire 'active_record'\nrequire 'spring_onion'\n\nActiveRecord::Base.establish_connection(\n  adapter:  'mysql2',\n  username: 'root',\n  database: 'employees'\n)\n\nSpringOnion.enabled = true # or `SPRING_ONION_ENABLED=1`\n# `SPRING_ONION_DATABASE_URL=mysql2://...`\n# default: SpringOnion.connection = ActiveRecord::Base.connection.raw_connection\nSpringOnion.source_filter_re = //\n\nclass Employee \u003c ActiveRecord::Base; end\n\np Employee.all.to_a.count\n#=\u003e SpringOnion\tINFO\t2020-07-18 01:53:27 +0900\t{\"sql\":\"SELECT `employees`.* FROM `employees`\",\"explain\":[{\"line\":1,\"select_type\":\"SIMPLE\",\"table\":\"employees\",\"partitions\":null,\"type\":\"ALL\",\"possible_keys\":null,\"key\":null,\"key_len\":null,\"ref\":null,\"rows\":298936,\"filtered\":100.0,\"Extra\":null}],\"warnings\":{\"line 1\":[\"slow_type\"]},\"backtrace\":[\"/foo/bar/zoo/baz.rb:18:in `\\u003ctop (required)\\u003e'\"]}\n#=\u003e 300024\n```\n\n## Log Output\n\n```json\n{\n    \"sql\": \"SELECT `employees`.* FROM `employees`\",\n    \"explain\": [\n        {\n            \"line\": 1,\n            \"select_type\": \"SIMPLE\",\n            \"table\": \"employees\",\n            \"partitions\": null,\n            \"type\": \"ALL\",\n            \"possible_keys\": null,\n            \"key\": null,\n            \"key_len\": null,\n            \"ref\": null,\n            \"rows\":298936,\n            \"filtered\": 100.0,\n            \"Extra\": null\n        }\n    ],\n    \"warnings\": {\n        \"line 1\": [\n            \"slow_type\"\n        ]\n    },\n    \"backtrace\": [\n        \"/foo/bar/zoo/baz.rb:18:in `\\u003ctop (required)\\u003e'\"\n    ]\n}\n```\n\n## Test\n\n```sh\ndocker-compose build\ndocker-compose run client bundle exec appraisal ar60 rake\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinebarrel%2Fspring_onion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinebarrel%2Fspring_onion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinebarrel%2Fspring_onion/lists"}