obfuscurity / descartes

Introspective dashboard for Graphite
MIT License
502 stars 65 forks source link

Undefined method 'update' for MetricCacheInfo:Class (NoMethodError) #146

Closed bdouglasGitHub closed 10 years ago

bdouglasGitHub commented 10 years ago

I received this error after trying to initiate the command: foreman start

foreman start 13:22:16 web.1 | started with pid 9221 13:22:18 web.1 | /services/descartes-master/lib/descartes/models/metrics.rb:30:in update': undefined methodupdate' for MetricCacheInfo:Class (NoMethodError)

I asked in the irc.frenode.net #ruby channel and they mentioned:

[13:59] There is an instance method ... not a class method [14:00] == Ox6abe [~ox6abe@129.7.134.36] has joined #ruby [14:00] http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/InstanceMethods.html#method-i-update [14:00] http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/ClassMethods.html [14:01] oh ... sorry ... that should have been to random0munky_ [14:01] == aryaching [~arya@180.190.148.67] has quit [Ping timeout: 265 seconds] [14:01] got lost in the chat history. [14:01] == beneggett [~beneggett@71-213-4-22.slkc.qwest.net] has quit [Quit: Textual IRC Client: www.textualapp.com] [14:01] == TT [~kw3st@50-1-65-223.dsl.dynamic.sonic.net] has quit [Remote host closed the connection] [14:02] <random0munky> Ah no worries I got it. To be honest, I don't know how to write a lick of ruby. Just have experience with python and bash [14:02] == tatsuya_o [~tatsuya_o@109.224.132.119] has joined #ruby [14:02] == kaldrenon [~kaldrenon@173-12-28-129-Philadelphia.hfc.comcastbusiness.net] has quit [Remote host closed the connection] [14:02] == IceyEC [~IceyEC@173-12-28-129-Philadelphia.hfc.comcastbusiness.net] has quit [Quit: IceyEC] [14:02] so ... normally, you will have your controller do a find on the instance you want to work with ... and then you will call update on that instance. [14:02] == kaldrenon [~kaldrenon@173-12-28-129-Philadelphia.hfc.comcastbusiness.net] has joined #ruby [14:02] == alexc2022 [~alexc20@EVIDON.edge3.NewYork1.Level3.net] has quit [Quit: alex_c2022] [14:03] A global function doesn't make sense in this context. [14:03] ... but no worries. [14:03] just letting you know why your code ( on line #30 ) is breaking. [14:04] <random0munky> Ah thanks. I'm posting an issue to the author on github about this issue [14:04] == lfox [~lfox@pool-96-250-144-124.nycmny.east.verizon.net] has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…] [14:04] == gyzmodo [~x@89.146.107.147] has quit [] [14:04] Would it be okay to copy some of the chat history here with your username? [14:04] Just asking for your consent [14:04] == forcedrequest [~quassel@cpe-67-253-48-150.maine.res.rr.com] has joined #ruby [14:05] So ... again... something like MetricCacheStatus.find( ... ).update( ... ) would work. [14:05] Fine with me. [14:05] <random0munky> Cool

Let me know if there's any additional information I can provide.

Thank you

obfuscurity commented 10 years ago

This is a boilerplate use of the Sequel built-ins. The only reason you might get that error is if you haven't run your migrations. Are you still having this problem / trying to use Descartes?

aphyr commented 10 years ago

I'm hitting this as well, after an upgrade, migrations ran fine but I get a similar trace:

kingsbury@riemann-2-42b:~/descartes master$ bundle exec rake db:migrate:up
<= sq:migrate:up executed
kingsbury@riemann-2-42b:~/descartes master$ foreman start
22:51:53 web.1  | started with pid 29671
22:51:55 web.1  | /home/kingsbury/descartes/lib/descartes/models/metrics.rb:30:in `update': undefined method `update' for MetricCacheStatus:Class (NoMethodError)
22:51:55 web.1  |       from /home/kingsbury/descartes/lib/descartes/models/metrics.rb:17:in `load'
22:51:55 web.1  |       from /home/kingsbury/descartes/config.ru:31:in `block in <main>'
22:51:55 web.1  |       from /var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
22:51:55 web.1  |       from /var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
22:51:55 web.1  |       from /home/kingsbury/descartes/config.ru:in `new'
22:51:55 web.1  |       from /home/kingsbury/descartes/config.ru:in `<main>'
obfuscurity commented 10 years ago

Sorry for the slow response.

@bdouglasGitHub your output shows that you're running an older version of that model. Had you tried updating your checkout? There were some fixes between your older checkout and master.

@aphyr Are you still using Descartes && is this still a problem for you && any idea how many metrics in your Graphite server?

obfuscurity commented 10 years ago

There were changes in Sequel 4.x, and I hadn't locked in the gem version to 3.x. so you were hitting that. This was fixed in https://github.com/obfuscurity/descartes/commit/6117f5348eda8e84b82886067d057eac44776df3.