stackify / stackify-api-ruby Goto Github PK
View Code? Open in Web Editor NEWStackify API for Ruby
Stackify API for Ruby
Rails version: 4.2
Ruby version: 2.3.8
Stackify version: 1.0.14
I'm getting connection issues when using Stackify on our RSpec test suites.
This is the error when trying to run RSpec. I'm pretty sure it's from Stackify.
I tried debugging a bit and it seems to stem from https://github.com/stackify/stackify-api-ruby/blob/master/lib/stackify-api-ruby.rb#L109 when Stackify spawns a new thread while still holding a DB connection.
I've also tried starting Stackify with async false, Stackify.run(false)
but that triggers whole other issue which I'll file it as another report.
ActiveRecord::StatementInvalid: Mysql2::Error: This connection is in use by: #<Thread:0x00005570ab166b30@/usr/local/bundle/gems/stackify-api-ruby-1.0.14/lib/stackify-api-ruby.rb:109 sleep>: SHOW TABLES
Trying to use the logger results in the following error for me (Ruby 2.1.5, Rails 3.2.21):
undefined method `index' for true:TrueClass
in lib/stackify/loger_client.rb
.
This looks like an order of operations issues to me.
if acceptable? level, ex.message && Stackify.working?
evaluates to
if acceptable?(level, ex.message && Stackify.working?)
where I'm pretty sure you want
if acceptable?(level, ex.message) && Stackify.working?
I think generally accepted Ruby style is to err on the side of using parentheses unless it's a method invocation involving an internal DSL or a method with keyword status. See https://github.com/bbatsov/ruby-style-guide.
I'm also surprised at the lack of tests for this library and curious if anyone is successfully using this in their Ruby/Rails projects. Stackify looks like a great solution on the surface, but I will admit after seeing the quality of this code my opinion has changed somewhat.
We Integrated stackify-api-ruby in our project and added the following initializer configuration for production:
Stackify.setup do |config|
config.api_key = 'KEY'
config.mode = :both
config.app_name = "appname"
config.env = :production
end
When we log in to stackify we have log data for all our environments (test, development & production).
We only want to log production. Are we missing some configurations?
stackify-api-ruby/lib/core_ext/fixnum.rb
Line 10 in c1fd6a2
So if you require this gem after active support, it breaks active support. For example, the following would no longer work:
5.minutes.from_now
I suggest having this module detect what methods are already defined on Fixnum to avoid re-defining them. Or make the return value of this method compatible with active support.
Normally I wouldn't say you need to defer to another gem, but ActiveSupport was here first and it's ActiveSupport... so it's practically core lib.
The logger_proxy appears to assume that msg
is going to be an object that responds to empty?
:
Presumably you could update to:
-> (msg, caller) { Stackify.logger_client.log(level.downcase, msg, caller) unless msg.respond_to(:empty?) && msg.empty? }
https://apidock.com/ruby/Object/respond_to%3F
or maybe force it to a string:
-> (msg, caller) { Stackify.logger_client.log(level.downcase, msg, caller) unless msg.to_s.empty? }
Here is an error we encountered when a http client was logging its response code:
undefined method `empty?' for 200:Integer
/home/app/webapp/vendor/bundle/ruby/2.6.0/gems/stackify-api-ruby-1.0.13/lib/stackify/logger_proxy.rb:9:in `block (2 levels) in initialize'
/home/app/webapp/vendor/bundle/ruby/2.6.0/gems/stackify-api-ruby-1.0.13/lib/stackify/logger_proxy.rb:16:in `block (3 levels) in initialize'
/home/app/webapp/vendor/bundle/ruby/2.6.0/gems/google-api-client-0.29.1/lib/google/apis/core/http_command.rb:308:in `execute_once'
/home/app/webapp/vendor/bundle/ruby/2.6.0/gems/google-api-client-0.29.1/lib/google/apis/core/http_command.rb:113:in `block (2 levels) in execute'
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.