Giter Club home page Giter Club logo

stackify-api-ruby's People

Contributors

armanstackify avatar darinhoward avatar eric-martin avatar frost avatar griwmf avatar homiedopie avatar jaygel179 avatar jedi-ballono avatar jmichaelis avatar pnevins avatar slashd0t avatar t-lair avatar v-dolgishev avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stackify-api-ruby's Issues

Stackify MySQL2 connection issue with RSpec

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

undefined method `index' for true:TrueClass

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.

logging configuration issues

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?

Fixnum#minutes conflicts with ActiveSupport's Fixnum#minutes

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.

Undefined method `empty?' for 200:Integer

The logger_proxy appears to assume that msg is going to be an object that responds to empty?:

-> (msg, caller) { Stackify.logger_client.log(level.downcase, msg, caller) unless msg.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'
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.