DM Cutie, et al. 0.4 release (minor updates)
I released dm-cutie, dm-cutie-ui, and dm-cutie-extras with some minor releases on gemcutter.org today.
The minor updates include a lot of help information and some tweaks to dm-cutie-ui to make it easier to use/understand (I hope).
+ add 'help' area describing all the default views
+ MysqlIndex/ Steps column info in help
+ Sort Tables Repo, Gen, Executed, Others by alpha (routes key should be view_name)
+ menu cleanup
+ @records count on page
+ Moved connected to
+ Changed word on relationship link
+ Format of page title
+ Removed duplicate column on mysql_index
+ Sort buttons moved
If you haven't installed DM Cutie, make sure your rubygems is up to date and do:
1 2 3 4 5 | gem install gemcutter --source http://gemcutter.org gem tumble gem install dm-cutie -v 0.4.0 gem install dm-cutie-ui -v 0.4.0 gem install dm-cutie-extras -v 0.4.0 |
Information on setting DM Cutie up is in this post.
If you want the source its available on my github page.
I'll be adding some more interesting tracking stuff for MySQL in the next few days. Now that Vokle has officially launched, I find myself with more time to work on my projects.
When I started this project I really wanted it to be a cool way to get information on all your DM storage needs. I am now realizing that DM Cutie should probably only support SQL and DO backed stores, and I'll be pairing down the internals over the next few days with that in mind.
Most of my database experience as far as optimizing goes is in MySQL, if anyone has some PostgreSQL or SQlite awesomeness they'd like to share, I'd really appreciate it.
DataMapper Cutie – The query tracker and profiler
So Ive been busting my butt on this query tracker for a while now. Its been finished twice and not released (once when I hated the API, and once right before 0.10 was release). But here she is, open for the hacking.
Its pretty easy to get set up, the gems are on http://gemcutter.org
To get started:
1 2 3 4 5 6 7 8 | $ gem sources -a http://gemcutter.org # Add gem cutter to your gem sources $ gem install dm-cutie # This is a plugin pack for dm-cutie $ gem install dm-cutie-extras # this is the front-end to dm-cutie $ gem install dm-cutie-ui |
If you plan to use MySQL to store dm-cuties information, set up a schema for that now by doing:
1 | mysql: CREATE SCHEMA `dm_cutie`; |
dm-cutie will allow you to store stuff across different adapters, so you can actually profile a Mysql DataMapper Repository into a dm-cutie sqlite3 repository. Its ok, she gets it
Now, in your application after your default DataMapper repository is set up do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | require 'dm-cutie' #currently only data_objects is supported DataMapper::Cutie.enable_adapter :data_objects require 'dm-cutie-extras' # Query Plans! DataMapper::Cutie::Extras.load :mysql_execution_step # Index optimization tips! DataMapper::Cutie::Extras.load :mysql_index # Mysql Errors and warnings! DataMapper::Cutie::Extras.load :mysql_warning DataMapper::Cutie.setup do |c| c[:repo_name] = :dm_cutie # name of your repo c[:exclude_models] = false #[:person, :car] #models to exclude c[:only_models] = false #[:article, :address] #model to include c[:slow_query_length] = 2 end #Forces Cutie to always migrate HER models DataMapper::Cutie.start(true) |
Let dm-cutie sit in your code for a while, she will start to generate lost of data on your repository. I would recommend not putting dm-cutie in a production environment due to the amount of queries that it generates. It is best used in a development or a staging environment and then applies the learned optimization strategies to your production environment.
After cutie has been running a while (or immediately if you are impatient) from the command line do:
1 | $ dm-cutie-ui -p 4567 --extras=mysql_warning,mysql_index,mysql_execution_step |
If you didn't use any of the extras in your application you SHOULDNT list them when you start the dm-cutie-ui.
That's that. You just need to sign in using the URI for your repository, it will be something like: mysql://root@localhost/dm_cutie.
An important note is that when you log into dm-cutie-ui you are logging into the dm-cutie repository, not your applications, so keep that in mind so you dont get errors saying the dm-cutie repo doesn't exist.
Well that's it for now, I'll post about this more after the holiday when I make a few more plugins. Enjoy!
There is a ton more documentation at: