Coder Social home page Coder Social logo

skylight-ruby's People

Stargazers

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

Watchers

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

skylight-ruby's Issues

segfault when recursing inside a sequence when the skylight gem is included

When recursing inside a sequence or n.times (example code included below), ruby will segfault after a few hundred iterations. This is well below the depth I'd expect before a stack overflow.

I've verified this happens in both ruby 2.1.5 and 2.2.0.

ruby_segfault.rb:

require "skylight"

module RubySegfault
  extend self

  def sequence_loop(counter)
    puts "#{counter}"
    (1 .. 1).each do
      sequence_loop(counter + 1)
    end
  end

  def times_loop(counter)
    puts "#{counter}"
    1.times do
      times_loop(counter + 1)
    end
  end

  def while_loop(counter)
    puts "#{counter}"
    while true do
      while_loop(counter + 1)
    end
  end
end

case ARGV[0]
  when "sequence" then RubySegfault.sequence_loop(0)
  when "times" then RubySegfault.times_loop(0)
  when "while" then RubySegfault.while_loop(0)
end

$ ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]

$ ruby ruby_segfault.rb sequence
0
1
2
...
403
404
Segmentation fault: 11

$ ruby ruby_segfault.rb times
0
1
2
...
419
420
Illegal instruction: 4

Note that this doesn't happen in a while loop and properly raises a SystemStackError:

$ ruby ruby_segfault.rb while
0
1
2
...
9355
9356
/Users/kevin/Desktop/ruby_segfault.rb:21: stack level too deep (SystemStackError)

Finally, if you remove 'require "skylight"' all three methods properly raise a SystemStackError.

Can't start my Rails application

I am having some trouble on my server. Bundler properly build and install the gem but then when I try to boot my rails app here is the error I get

/home/guillaume/bundle_pps/ruby/2.1.0/gems/skylight-0.4.0.beta1/lib/skylight/native.rb:25:in `load_libskylight': [SKYLIGHT] dlerror; msg=/home/guillaume/bundle_pps/ruby/2.1.0/gems/skylight-0.4.0.beta1/lib/skylight/native/x86_64-linux/libskylight.so: wrong ELF class: ELFCLASS64 (RuntimeError)

I don't know what you might need but here are some information about my system

$ cat /proc/version
Linux version 3.10.23-xxxx-std-ipv6-32 ([email protected]) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Tue Mar 18 14:53:43 CET 2014
$ uname -a
Linux ***.ovh.net 3.10.23-xxxx-std-ipv6-32 #1 SMP Tue Mar 18 14:53:43 CET 2014 i686 i686 i686 GNU/Linux

Sinatra and Slim: Option :sky_virtual_path is invalid

I’m using Slim as the template engine for my very simple Sinatra app, and when I run my app after installing and setting up Skylight, the following error appears in my logs on every request:

Slim::Engine: Option :sky_virtual_path is invalid

My very limited knowledge on this stuff tells me that the :sky_virtual_path option is passed to Slim, and Slim doesn’t know (or want to know) what to do with it.

The following line «fixes» the issue. By «fixes» I mean removes the error from my logs and makes Skylight receive data:

Slim::Engine.disable_option_validator!

Any idea what the problem is and how it may be fixed?

Gem object allocation

According to http://blog.skylight.io/announcing-memory-traces/:

Allocating many objects can cause expensive garbage collection sweeps to become more frequent, slowing down the performance of your entire app.

However I found that skylight gem itself allocates a lot of objects. 75 times more than newrelic_rpm.

$ derailed bundle:objects

allocated memory by gem
-----------------------------------
  55716710  activesupport-4.1.11
  36911424  skylight-0.6.0
   9965675  mime-types-2.6.1
  ...

Are you going to reduce the amount of allocated objects or it's considered not a problem?

skylightd causes process leak

When I include skylight in my Gemfile, every fork creates a zombie process until my VPS runs out of memory. When I omit it, everything is fine.

My app calls fork to render a PDF:

        pid = fork do
          kit = PDFKit.new(@url, args)
          kit.to_file("#{path}.pending")
          # it's OK if another request has already deleted the file
          File.rename("#{path}.pending", path) rescue Errno::ENOENT
        end
        Process.detach(pid)

This is called in a rake task, using an integration session to fake a request. Here's a backtrace from a stuck process:

    from /home/property-build/.gem/ruby/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
    from /home/property-build/.gem/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
    from /home/property-build/.gem/ruby/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
    from /home/property-build/.gem/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
    from /home/property-build/propertysearch/app/controllers/pdf_controller.rb:9:in `generate'
    from /home/property-build/propertysearch/app/generators/pdf_generator.rb:38:in `generate'
    from /home/property-build/propertysearch/app/generators/pdf_generator.rb:38:in `fork'
    from /home/property-build/.gem/ruby/2.0.0/gems/skylight-0.6.0/lib/skylight/instrumenter.rb:68:in `block in <class:Instrumenter>'
    from /home/property-build/.gem/ruby/2.0.0/gems/skylight-0.6.0/lib/skylight/instrumenter.rb:50:in `stop!'
    from /home/property-build/.gem/ruby/2.0.0/gems/skylight-0.6.0/lib/skylight/instrumenter.rb:50:in `synchronize'
    from /home/property-build/.gem/ruby/2.0.0/gems/skylight-0.6.0/lib/skylight/instrumenter.rb:55:in `block in stop!'
    from /home/property-build/.gem/ruby/2.0.0/gems/skylight-0.6.0/lib/skylight/instrumenter.rb:138:in `shutdown'
    from /home/property-build/.gem/ruby/2.0.0/gems/skylight-0.6.0/lib/skylight/instrumenter.rb:138:in `native_stop'

This is with version 0.6.0.

uninitialized constant Skylight::Railtie::Instrumenter (NameError)

I may be doing something wrong here. When trying to load a rails console with RAILS_ENV=staging bundle exec rails c I am getting the following trace:

[SKYLIGHT] [0.3.3] The Skylight native extension wasn't found. Skylight is not running.
/Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/zipruby-0.3.6/lib/zipruby.bundle: warning: already initialized constant Zip::VERSION
/Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rubyzip-0.9.9/lib/zip/constants.rb:2: warning: previous definition of VERSION was here
/Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/skylight-0.3.3/lib/skylight/railtie.rb:22:in `block in <class:Railtie>': uninitialized constant Skylight::Railtie::Instrumenter (NameError)
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `run'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in `each'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:215:in `initialize!'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/adam/dev/dotswipely/swipely/config/environment.rb:8:in `<top (required)>'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/backports-3.3.4/lib/backports/tools.rb:328:in `require'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/backports-3.3.4/lib/backports/tools.rb:328:in `require_with_backports'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:189:in `require_environment!'
    from /Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:61:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Ruby 2.2.0 - Skylight probes cause test failure

Running test suite after switching to Ruyb 2.2.0:

/Users/work/.rvm/gems/ruby-2.2.0/gems/skylight-0.6.0/lib/skylight/probes.rb:81:in `require': cannot load such file -- test/unit/assertions (LoadError)
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/skylight-0.6.0/lib/skylight/probes.rb:81:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/rspec-rails-2.14.2/lib/rspec/rails/adapters.rb:17:in `rescue in <module:Rails>'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/rspec-rails-2.14.2/lib/rspec/rails/adapters.rb:12:in `<module:Rails>'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/rspec-rails-2.14.2/lib/rspec/rails/adapters.rb:6:in `<module:RSpec>'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/rspec-rails-2.14.2/lib/rspec/rails/adapters.rb:5:in `<top (required)>'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/skylight-0.6.0/lib/skylight/probes.rb:81:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/skylight-0.6.0/lib/skylight/probes.rb:81:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/rspec-rails-2.14.2/lib/rspec/rails.rb:11:in `<top (required)>'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/skylight-0.6.0/lib/skylight/probes.rb:81:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/skylight-0.6.0/lib/skylight/probes.rb:81:in `require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/work/.rvm/gems/ruby-2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'

error: unknown type name 'fd_set' for ruby-2.0.0

Try to install skylight 0.8.0 on my server. Ubuntu 12.04.5 LTS with ruby-2.0.0

ERROR:  Error installing skylight:
ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
I, [2015-09-29T13:20:11.296301 #3549]  INFO -- : SKYLIGHT_HDR_PATH=/usr/local/lib/ruby/gems/2.0.0/gems/skylight-0.8.0/ext; SKYLIGHT_LIB_PATH=/usr/local/lib/ruby/gems/2.0.0/gems/skylight-0.8.0/lib/skylight/native/x86_64-linux
I, [2015-09-29T13:20:11.297073 #3549]  INFO -- : [SKYLIGHT] fetching native ext; curr-platform=x86_64-linux; requested-arch=x86_64-linux; version=0.7.0-1c24017
I, [2015-09-29T13:20:11.297283 #3549]  INFO -- : [SKYLIGHT] attempting to fetch from remote; uri=https://s3.amazonaws.com/skylight-agent-packages/skylight-native/0.7.0-1c24017/skylight_x86_64-linux.tar.gz
I, [2015-09-29T13:20:13.756962 #3549]  INFO -- : [SKYLIGHT] successfully downloaded native ext; out=/usr/local/lib/ruby/gems/2.0.0/gems/skylight-0.8.0/ext/skylight_x86_64-linux.tar.gz
skylightd
libskylight.so
skylight.h
skylight_dlopen.h
skylight_dlopen.c
checking for skylight_dlopen.h in /usr/local/lib/ruby/gems/2.0.0/gems/skylight-0.8.0/ext... yes
checking for dlfcn.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for fast thread local storage... yes
creating Makefile

make
compiling skylight_dlopen.c
compiling skylight_native.c
In file included from /usr/local/include/ruby-2.0.0/ruby/ruby.h:1567:0,
                 from /usr/local/include/ruby-2.0.0/ruby.h:33,
                 from skylight_native.c:2:
/usr/local/include/ruby-2.0.0/ruby/intern.h:323:1: error: unknown type name 'fd_set'
/usr/local/include/ruby-2.0.0/ruby/intern.h:412:1: error: unknown type name 'fd_set'
/usr/local/include/ruby-2.0.0/ruby/intern.h:412:1: error: unknown type name 'fd_set'
/usr/local/include/ruby-2.0.0/ruby/intern.h:412:1: error: unknown type name 'fd_set'
/usr/local/include/ruby-2.0.0/ruby/intern.h:413:79: error: 'struct timeval' declared inside parameter list [-Werror]
/usr/local/include/ruby-2.0.0/ruby/intern.h:413:79: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
/usr/local/include/ruby-2.0.0/ruby/intern.h:414:32: error: 'struct timeval' declared inside parameter list [-Werror]
cc1: all warnings being treated as errors
make: *** [skylight_native.o] Error 1


Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/skylight-0.8.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/skylight-0.8.0/ext/gem_make.out

version 0.10.1 causes "GIT_DISCOVERY_ACROSS_FILESYSTEM" warnings on Heroku

Hi,

I've seen a couple of cases now where using the latest 0.10.1 version of this gem causes the following warnings to be displayed when deploying to Heroku (as part of the build output):

remote: fatal: Not a git repository (or any parent up to mount point /tmp)
remote: Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I don't have much more information on where this is coming from at the moment. In the past on Heroku this error has been seen where a dependency starts shelling out to git somewhere. I just thought I'd make a note here for now. If I have anything more concrete I'll post back here.

systemd can't restart skylight+unicorn

Unfortunately it doesn't look like #34 is fixed after all. It's intermittent so it just fooled me into thinking it was working.

restarting property-build
dJob for property-build.service failed. See 'systemctl status property-build.service' and 'journalctl -xn' for details.
I, [2015-07-31T10:44:46.673031 #30825]  INFO -- : Completed task 'restart'

[property-build@li989-127 propertysearch]$ systemctl status property-build.service
property-build.service - PropertySearch Build Rails Application
   Loaded: loaded (/etc/systemd/system/property-build.service; enabled)
   Active: failed (Result: exit-code) since Fri 2015-07-31 10:44:46 UTC; 33s ago
  Process: 31587 ExecStart=/bin/bash -l -c cd ~/propertysearch && bundle exec unicorn -D -c ~/propertysearch/config/unicorn/build.rb -E build (code=exited, status=1/FAILURE)
 Main PID: 17617 (code=exited, status=0/SUCCESS)

Again, removing the skylight gem fixes the problem.

At least the process leak is fixed.

skylight process lock on mysql row

I had a strange issue for few weeks now and finally I located the source of the problem.

Occasionally I start receiving lock timeout errors on my Mysql:

Mysql2::Error: Lock wait timeout exceeded; try restarting transaction: UPDATE `billing_points` SET `last_work_session_id` = 126545, `updated_at` = '2015-10-13 22:13:50' WHERE `billing_points`.`id` = 12016

A simple redeploy of the application would fix the problem but it would reappear in a day or two.

The I started debugging:

with show processlist; command I found that the process locking my table (https://scr.infinum.co/jan_varljen/2015-10-14_00-28-29.png) was actually:

tcp        0      0 172.31.17.221:44681     172.31.19.34:3306       ESTABLISHED 5743/skylightd

a skylight process running on the server.

I'm using:
rails 4.1.13
skylight 0.8.1
mysql 5.6.23

Do you have any idea why this skylight process is holding the lock?

libskylight on Alpine based containers

I don't know why libskylight does not work under Alpine Linux Distribution. I thought it was statically compiled binary but seems to be dependent with some system library.

Here's my Dockerfile:

FROM alpine:edge

RUN echo 'gem: --no-rdoc --no-ri' > /etc/gemrc

ENV GEM_HOME /usr/local/bundle
ENV PATH $GEM_HOME/bin:$PATH
ENV BUNDLE_APP_CONFIG $GEM_HOME

RUN apk --update add \
      git \
      tzdata \
      build-base \
      nodejs \
      imagemagick \
      postgresql-dev \
      ruby-dev \
      ruby-bundler \
      ruby-nokogiri \
      ruby-mysql2 \
      ruby-raindrops && rm -rf /var/cache/apk/* && rm -rf /usr/share/ri/*

CMD ["/bin/sh"]

Error message:

/app # rails server
Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Ignoring bcrypt-3.1.9 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.9
/usr/local/bundle/gems/skylight-0.6.0/lib/skylight/native.rb:27:in `load_libskylight': [SKYLIGHT] dlerror; msg=Error relocating /usr/local/bundle/gems/skylight-0.6.0/lib/skylight/native/x86_64-linux/libskylight.so: __register_atfork: symbol not found (RuntimeError)
    from /usr/local/bundle/gems/skylight-0.6.0/lib/skylight/native.rb:27:in `<module:Skylight>'
    from /usr/local/bundle/gems/skylight-0.6.0/lib/skylight/native.rb:3:in `<top (required)>'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /usr/local/bundle/gems/skylight-0.6.0/lib/skylight/core.rb:8:in `<module:Skylight>'
    from /usr/local/bundle/gems/skylight-0.6.0/lib/skylight/core.rb:3:in `<top (required)>'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /usr/local/bundle/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
    from /usr/local/bundle/gems/skylight-0.6.0/lib/skylight.rb:1:in `<top (required)>'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:76:in `require'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:72:in `each'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:72:in `block in require'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:61:in `each'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler/runtime.rb:61:in `require'
    from /usr/local/bundle/gems/bundler-1.9.9/lib/bundler.rb:134:in `require'
    from /app/config/application.rb:8:in `<top (required)>'
    from /usr/local/bundle/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:79:in `require'
    from /usr/local/bundle/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from /usr/local/bundle/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /usr/local/bundle/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /usr/local/bundle/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /usr/local/bundle/gems/railties-4.1.7/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

ERB variables are not interpolated in config/skylight.yml

Still investigating, but here are my findings so far. Please let me know if I'm missing something:

The reason we have gone this route is that we currently have two Skylight-enabled apps on the same box in the same env, hence we need to have separate auth tokens and can't just set SKYLIGHT_AUTHENTICATION

$ cat config/skylight.yml

---
# The authentication token for the application.
authentication: <%= ENV['SOME_OTHER_ENV_VARIABLE_WITH_TOKEN'] %>
# lib/skylight/railtie.rb

require 'skylight'
require 'rails'

module Skylight
  class Railtie < Rails::Railtie
    # ...

    config = load_skylight_config(app)
    Rails.logger.info config.inspect #=> #<Skylight::Config:0x007f98c0f88a30 @values={:authentication=>"<%= ENV['SOME_OTHER_ENV_VARIABLE_WITH_TOKEN'] %>", ...>

    # ...
  end
end

failed to lex SQL query

ERROR:skylight::c_api: failed to lex SQL query; err=LexError { kind: UnknownLexError, desc: "unknown sql lex error", pos: 15 }; sql=SELECT "bills".id, "bills".title, "bills".slug, "bills".summary, "bills".image_file_name, "bills".politicians_count, "bills".status, "bills".cached_category_list, "bills".updated_at, "bills".last_mentioned_urls, "bills".publisher_ids, "bills".namespace_id FROM "bills" WHERE ("bills"."namespace_id" IS NOT NULL) AND (cached_tag_list && ARRAY['cigarro','espaco publico','fumar']) AND ("bills"."id" != $1) LIMIT 3

"enabled" config option

While skylight support is debugging my application, I'd like to "turn off" the agent. A simple "enabled" config option would be the easiest way to do this (as opposed to gem 'skylight', require: false, for example).

ERROR:skylight::cli: skylightd exiting abnormally

I'm trying out Skylight and running it on a Thin cluster with 3 thin processes. The agent is enabled but is not sending out any data.

I'm getting these errors in my log/thin.x.log files:

ERROR:skylight::cli: skylightd exiting abnormally; err=unable to bind UDS server; err=invalid argument (path must be smaller than SUN_LEN)
ERROR:skylight::ipc::client: could not send message to daemon; err=unable to spawn daemon -- timed out; timeout=5s
ERROR:skylight::c_api: Skylight instrumenter failed to submit trace; err=InternalClientError

The log/production.log shows skylight as enabled:

I, [2014-12-19T11:59:04.109040 #27279]  INFO -- : [SKYLIGHT] [0.5.2] Skylight agent enabled

The log/skylight.log file repeats this line a bunch of times:

W, [2014-12-19T12:01:31.073807 #27219]  WARN -- : [SKYLIGHT] [0.5.2] failed to submit trace to worker; err=native Instrumenter#submit_trace failed

crash on instrument_method created by attr_writer

class A
 attr_accessor :tmp
end

A.include(Skylight::Helpers)
A.instrument_method :tmp=

produces

/home/vagrant/.rvm/gems/ruby-2.1.6@rails_4.2/gems/skylight-0.6.1/lib/skylight/helpers.rb:101:in `class_eval': /home/vagrant/.rvm/gems/ruby-2.1.6@rails_4.2/gems/skylight-0.6.1/lib/skylight/helpers.rb:111: syntax error, unexpected &
              before_instrument_strict_validation=(*args, &blk)
                                                           ^ (SyntaxError)
    from /home/vagrant/.rvm/gems/ruby-2.1.6@rails_4.2/gems/skylight-0.6.1/lib/skylight/helpers.rb:101:in `__sk_instrument_method_on'
    from /home/vagrant/.rvm/gems/ruby-2.1.6@rails_4.2/gems/skylight-0.6.1/lib/skylight/helpers.rb:88:in `instrument_method'

undefined symbol: skylight_error_free

from rails console on production server:

[2] pry(main)> require 'skylight_native'
LoadError: <some_path>/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/skylight-0.3.13/skylight_native.so: undefined symbol: skylight_error_free - <some_path>/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/skylight-0.3.13/skylight_native.so
from <some_path>/shared/bundle/ruby/2.1.0/gems/skylight-0.3.13/lib/skylight/probes.rb:81:in `require'

unicorn crashes :(

Hi,
I just installed the skylight gem. In my machine it worked perfectly.
After deploying, my unicorn would crash at the beginning of any request.

I'm using:

  • Ubuntu 14.04.1 LTS
  • ruby 2.1.2

Here's my deploy log:

-----> Using Ruby version: ruby-2.1.2
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from https://rubygems.org/.........
       [...]
       Using unicorn 4.8.3
       Using rails 4.1.4
       Installing skylight 0.3.19
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (18.90s)
       Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       [SKYLIGHT] [0.3.19] Skylight agent enabled
       Asset precompilation completed (4.66s)
       Cleaning assets
       Running: rake assets:clean
       [SKYLIGHT] [0.3.19] Skylight agent enabled

-----> Discovering process types
       Procfile declares types -> web, worker
       Default process types for Ruby -> rake, console, web, worker

Here's my unicorn log:

11:27:26 web.1    | I, [2014-08-12T11:27:26.480675 #9]  INFO -- : listening on addr=0.0.0.0:5000 fd=9
11:27:26 web.1    | I, [2014-08-12T11:27:26.481312 #9]  INFO -- : worker=0 spawning...
11:27:26 web.1    | I, [2014-08-12T11:27:26.482744 #9]  INFO -- : worker=1 spawning...
11:27:26 web.1    | I, [2014-08-12T11:27:26.483964 #9]  INFO -- : master process ready
11:27:26 web.1    | I, [2014-08-12T11:27:26.485575 #18]  INFO -- : worker=0 spawned pid=18
11:27:26 web.1    | I, [2014-08-12T11:27:26.486301 #18]  INFO -- : Refreshing Gem list
11:27:26 web.1    | I, [2014-08-12T11:27:26.488746 #20]  INFO -- : worker=1 spawned pid=20
11:27:26 web.1    | I, [2014-08-12T11:27:26.492662 #20]  INFO -- : Refreshing Gem list
11:27:31          | exited with code 1
11:27:31 system   | sending SIGTERM to all processes
11:27:31          | exited with code 1
11:27:31 web.1    | I, [2014-08-12T11:27:31.978710 #9]  INFO -- : reaped #<Process::Status: pid 18 exit 0> worker=0
11:27:31 web.1    | I, [2014-08-12T11:27:31.978972 #9]  INFO -- : reaped #<Process::Status: pid 20 exit 0> worker=1
11:27:31 web.1    | I, [2014-08-12T11:27:31.979207 #9]  INFO -- : master complete
11:27:32 web.1    | exited with code 0

Cannot load rails console.

Just installed skylight and it is running fine on our staging servers. I added the line

config.skylight.environments << 'staging'

inside "class Application < Rails::Application" in config/application.rb

Here is the output from bundle exec rails c

[SKYLIGHT] [0.3.1] The Skylight native extension wasn't found. Skylight is not running.
/Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/zipruby-0.3.6/lib/zipruby.bundle: warning: already initialized constant Zip::VERSION
/Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rubyzip-0.9.9/lib/zip/constants.rb:2: warning: previous definition of VERSION was here
/Users/adam/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `skylight' for #<Rails::Application::Configuration:0x007ff5c6c9a590> (NoMethodError)

YAML.load_file causes error

https://github.com/skylightio/skylight-ruby/blob/master/lib/skylight/user_config.rb#L25 throws an error when it encounters an empty yaml file at ~/.skylight

/usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:26:in `reload': undefined method `[]' for false:FalseClass (NoMethodError)
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:13:in `initialize'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:9:in `new'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/user_config.rb:9:in `instance'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/skylight-0.10.0/lib/skylight/railtie.rb:36:in `block in <class:Railtie>'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
    from /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'

This sometimes happens if a user uninstalls the skylight gem and reinstalls it.

How to disable only the console nag? Or, set alert_log_file to what?

Hi, every time I launch a Rails console, I see:

W, [2014-10-08T13:22:00.945517 #61832]  WARN -- : [SKYLIGHT] [0.3.21] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message, set `alert_log_file` in your config.)

Set it to what? Setting config/application.rb doesn't seem to work:

    config.skylight.alert_log_file = false
    config.skylight.alert_log_file = Rails.root.join('tmp', 'garbage')

Setting config/skylight.yml kind of works HOWEVER it disables all warnings, not just the rails console nag.

alert_log_file: "tmp/garbage"

I definitely would like to continue to receive these warnings:

       W, [2014-10-08T20:15:25.032247 #1022]  WARN -- : [SKYLIGHT] [0.3.21] You are running in the build environment but haven't added it to config.skylight.environments, so no data will be sent to skylight.io.

I just don't want to be nagged every time I launch a console.

I don't think any of this is mentioned in the docs, and I'm still not quite sure everything that's possible after reading the code. Would appreciate some more information. Thanks!

gem install skylight on mac fails with reference to /users/mpapis

Attempting to install the skylight gem 0.6.0 on mac references a hard coded directory

linking shared-object skylight_native.bundle
ld: warning: directory not found for option '-L/Users/mpapis/.sm/pkg/active/lib'
ld: targeted OS version does not support use of thread local variables in _sky_increment_allocation for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [skylight_native.bundle] Error 1

undefined method `register' for Skylight::Probes:Module

I'm trying out the gem, skylight (0.8.0.beta.1), under Grape and I keep getting this error, no matter what probe I require:

require 'grape'
require 'skylight/probes/grape'
/Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/skylight-0.8.0.beta.1/lib/skylight/probes/redis.rb:28:in `<module:Probes>': undefined method `register' for Skylight::Probes:Module (NoMethodError)
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/skylight-0.8.0.beta.1/lib/skylight/probes/redis.rb:2:in `<module:Skylight>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/skylight-0.8.0.beta.1/lib/skylight/probes/redis.rb:1:in `<top (required)>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
    from /Users/u0157355/projects/codelogic/api-engine/api/engine/collection.rb:2:in `<top (required)>'
    from /Users/u0157355/projects/codelogic/api-engine/api/server.rb:7:in `require_relative'
    from /Users/u0157355/projects/codelogic/api-engine/api/server.rb:7:in `<top (required)>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
    from /Users/u0157355/projects/codelogic/api-engine/config.ru:3:in `block in <main>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /Users/u0157355/projects/codelogic/api-engine/config.ru:in `new'
    from /Users/u0157355/projects/codelogic/api-engine/config.ru:in `<main>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/lib/rack/server.rb:147:in `start'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/bin/rackup:23:in `load'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/bin/rackup:23:in `<main>'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/bin/ruby_executable_hooks:15:in `eval'
    from /Users/u0157355/.rvm/gems/ruby-2.2.2@api-engine/bin/ruby_executable_hooks:15:in `<main>'

Can't seem to override pidfile_path

Is see the following error in my log:

 [SKYLIGHT] [0.6.0-beta.1] File `/home/app/releases/20150106201439/tmp/skylight.pid` not writable.  Please set daemon.pidfile_path or daemon.sockdir_path in your config to a writable path; disabling Skylight agent

I've tried the following but the pidfile_path won't be overriden:

 daemon.pidfile_path: /home/app/shared/tmp/pids/skylight.pid

Or:

daemon:
   pidfile_path: /home/app/shared/tmp/pids/skylight.pid

Skylight unable to start

Getting this error:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.', ../src/libcore/result.rs:732
[SKYLIGHT] internal error: called `Result::unwrap()` on an `Err` value: A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.
[SKYLIGHT] [0.8.0] Unable to start

stack level too deep

add file skylight.rb to config/initializers/
containing

Dir['app/models/**/*.rb'].each do |filename|
  klass = filename.sub('app/models/', '').sub('.rb', '').classify
  klass = klass.constantize
  next unless klass.is_a?(Class)
  klass.include Skylight::Helpers
  klass.instance_methods(false).each do |method_name|
    klass.instrument_method method_name
  end
end

and it will produce

A SystemStackError occurred in any_controller_name#index:
 stack level too deep

Issue with check_permissions preventing rails c form running

ed13708 creates issues for us when trying to access the rails console on our web server.
The local user we use does not have access to the tmp directory causing rails c to crash.

Would it be possible to have check_permissions just throw a warning instead of raising an error?

Security and DEP

We just ran an Application Security Best Practices inspection using AWS Inspector (currently in preview), on our application, and it came up with the following "High" level notice:

The following executable files installed on Instance i-xxxxxxx do not support DEP: /home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/skylight-0.8.0/lib/skylight/native/x86_64-linux/libskylight.so from Application Security Best Practices

Apparently, DEP stands for "Data Execution Prevention" and libskylight.so doesn't support it. I'm not sure if this is a Rust issue, or a skylight issue.

I'm not too concerned about the security warning, since I'm pretty confident that a Rust library is going to be much more secure than a C library, but it would be nice to figure it out and get the security alert to go away.

Update docs to use += instead of << in config/application.rb

Hi, it might be good to avoid using << in config/application.rb because this silently fails:

config.skylight.environments << %w[ build staging ]

This is more explicit:

config.skylight.environments += ['build']
config.skylight.environments += %w[ build staging ]

(a quick github search shows a lot of += in Rails config files, not many <<)

Just something that tripped me up for a few minutes, feel free to close.

High CPU usage for skylightd 0.7.0.beta.2

Hello friends,

I upgraded to try out the 0.7.0.beta.2 and ended up rolling back because skylightd would run at 100% CPU, though it still seemed to be recording data. Thought I would drop a note here to tell you some specs so you might be able to debug:

  • ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-gnu]
  • in a docker container

screen shot 2015-07-27 at 9 42 36 pm

Running strace against skylightd just showed a deluge of this:

epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 195803598}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 195909570}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 195996671}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 196104675}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 296288855}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 296339991}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 296376051}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 296413528}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 396693892}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 396813606}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 396902756}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 396975309}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 497161485}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 497194028}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
stat("/home/app/src/tmp/skylight.pid", {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 497402379}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 497441887}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 597712944}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 597846767}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 597939427}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 598014700}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 698317108}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 698430898}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 698531066}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 698597138}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 799079490}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 799195151}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 799278846}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 799344487}) = 0
epoll_wait(5, {}, 1024, 100)            = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 899601619}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 899695690}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 899787062}) = 0
clock_gettime(CLOCK_MONOTONIC, {16593, 899849655}) = 0

support erb interpolation in skylight.yml

I wanted to read tokens from my secrets.yml file, this way:

// skylight.yml

# The Skylight ID for the application.
application: <%= Rails.application.secrets.skylight['application'] %>

# The authentication token for the application.
authentication: <%= Rails.application.secrets.skylight['authentication'] %>

but it's not possible because you don't process ERB on YAML load.

If you think this could be added, let me know and I'll PR

Feature Request: specify SKYLIGHT_IGNORED_ENDPOINT by URL

I was super excited to see support for SKYLIGHT_IGNORED_ENDPOINT - thank you.

However, I've implemented my health-check as Rails middleware just because I was sick of seeing my logs filled with the health checks, ala;

config.middleware.insert_before Rails::Rack::Logger, "HealthCheckMiddleware"

Anyways, due to this invocation style I don't have a controller#action pair to specify to the env var.

My request: allow one to specify a URL ala /health-check and not just a controller#action pair.

Unintialized Constant Grape::VERSION

I added only grape-entity to the Gemfile (and not grape), and Skylight is causing trouble by trying to check for Grape::VERSION, which is only provided by Grape::API and not Grape::Entity.

The following is the error message relevant to Skylight:

/Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes/grape.rb:6:in `install': uninitialized constant Grape::VERSION (NameError)
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes.rb:14:in `install'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes.rb:35:in `register'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes/grape.rb:84:in `<module:Probes>'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes/grape.rb:2:in `<module:Skylight>'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes/grape.rb:1:in `<top (required)>'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes.rb:81:in `require'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/probes.rb:81:in `require'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/railtie.rb:118:in `block in load_probes'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/railtie.rb:117:in `each'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/railtie.rb:117:in `load_probes'
    from /Users/alan/.gem/ruby/2.2.3/gems/skylight-0.8.1/lib/skylight/railtie.rb:22:in `block in <class:Railtie>'
    other unrelated errors...

My investigation shows that these lines https://github.com/skylightio/skylight-ruby/blob/master/lib/skylight/probes.rb#L26-L39 might be problematic because they check for the existence of the Grape constant, which is true for both grape and grape-entity, and therefore result in probing for Grape::VERSION.

I could add grape as a solution, but I'm only using Grape::Entity for the JSON representation. I am okay with a decision to close this issue as a wontfix, but felt that bringing this up with you was important.

0.6.1 gem install failure on OS X (looks like usage of deprecated rb_thread_blocking_region, removed in ruby 2.2.2)

Ruby 2.2.2
OS X 10.10.4

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/andriytyurnikov/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150705-78819-w8vquf.rb extconf.rb
I, [2015-07-05T06:32:56.224607 #78886]  INFO -- : SKYLIGHT_HDR_PATH=/Users/andriytyurnikov/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/skylight-0.6.1/ext; SKYLIGHT_LIB_PATH=/Users/andriytyurnikov/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/skylight-0.6.1/lib/skylight/native/x86_64-darwin
I, [2015-07-05T06:32:56.224988 #78886]  INFO -- : [SKYLIGHT] fetching native ext; curr-platform=x86_64-darwin; requested-arch=x86_64-darwin; version=0.5.0-fbaa3ed
I, [2015-07-05T06:32:56.225102 #78886]  INFO -- : [SKYLIGHT] attempting to fetch from remote; uri=https://s3.amazonaws.com/skylight-agent-packages/skylight-native/0.5.0-fbaa3ed/skylight_x86_64-darwin.tar.gz
I, [2015-07-05T06:32:59.693839 #78886]  INFO -- : [SKYLIGHT] successfully downloaded native ext; out=/Users/andriytyurnikov/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/skylight-0.6.1/ext/skylight_x86_64-darwin.tar.gz
x skylightd
x libskylight.dylib
x skylight.h
x skylight_dlopen.h
x skylight_dlopen.c
checking for skylight_dlopen.h in /Users/andriytyurnikov/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/skylight-0.6.1/ext... yes
checking for dlfcn.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... no
checking for rb_thread_blocking_region()... no
Ruby is unexpectedly missing rb_thread_blocking_region. This should not happen.

Error parsing SQL query on Skylight 0.9.0

With the new Rust SQL parser, Skylight has started throwing errors like the following:

ERROR:skylight::c_api: failed to lex SQL query; err=LexError { kind: UnknownLexError, desc: "unknown sql lex error", pos: 154 }; sql=SELECT COUNT(*) FROM `private_messages` WHERE (((sender_id = 13 AND sender_type = 'Player') OR (receiver_id = 13 AND receiver_type = 'Player'))) AND (NOT EXISTS (SELECT `private_message_reads`.`read_at` FROM `private_message_reads` WHERE `private_message_reads`.`player_id` = 13 AND (private_message_id = private_messages.id)))

Here the error points to the EXISTS keyword.

ERROR:skylight::c_api: failed to lex SQL query; err=LexError { kind: UnknownLexError, desc: "unknown sql lex error", pos: 310 }; sql=SELECT  `venture_advertisements`.* FROM `venture_advertisements` WHERE (credits > 0) AND (`venture_advertisements`.`visual_uid` IS NOT NULL) AND (campaign_started_at < NOW()) AND `venture_advertisements`.`campaign_stopped_at` IS NULL AND (campaign_low_level_budget - campaign_low_level_spent >= 1) AND (id NOT IN (0))  ORDER BY RAND() LIMIT 1

Here it points to the IN keyword.

Setup never completes because of spring

I've let skylight setup run for over 20 minutes and it didn't complete, interrupting it yields this:

michal@10:06:11:~/dev/mozek (feature/add-skylight)$ skylight setup XXXXXXXX
/Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/run.rb:99:in `gets': Interrupt
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/run.rb:99:in `verify_server_version'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/run.rb:56:in `run'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/run.rb:37:in `warm_run'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/run.rb:26:in `call'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/command.rb:7:in `call'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/rails.rb:24:in `call'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client/command.rb:7:in `call'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/client.rb:26:in `run'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/bin/spring:48:in `<top (required)>'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/binstub.rb:11:in `load'
    from /Users/michal/.rvm/gems/ruby-2.2.1/gems/spring-1.3.4/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/michal/dev/mozek/bin/spring:16:in `require'
    from /Users/michal/dev/mozek/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

Removing spring from gemfile and stopping spring helped.

failed to instrument span; msg=native Trace#start_span failed

I'm using skylight-ruby v0.6.1 and Rails 3.2. My skylight.log is full of:

[SKYLIGHT] [0.6.1] native Trace#start_span failed
[SKYLIGHT] [0.6.1] native Trace#start_span failed
[SKYLIGHT] [0.6.1] native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed
[SKYLIGHT] [0.6.1] failed to instrument span; msg=native Trace#start_span failed

My application code looks like:

class Foo
  def trace(name, &block)
    Skylight.instrument(title: name) do
      yield
    end
  end

  def bar
    trace('do something') { do_something }
  end
end

What am I doing wrong?

Instrumenting ActionController::Metal

Not sure where the best place to put this, but in order to get nice Skylight results when using a metal controller you'll need to add:

class SomeController < ActionController::Metal
  include ActionController::RackDelegation
  include ActionController::Instrumentation
  ...
end

The first includes is only necessary if you're running Rails 3.2 and haven't already included Redirecting, Cookies, ConditionalGet, or Caching.

Without the above, Skylight will still track the requests but will lump them all together as "Rack". Which is not terribly helpful.

I had thought about adding this to the wiki, but it's currently empty so I'm not sure if you'd prefer to add this to the troubleshooting documentation.

Jruby bundle error

Bundle with Jruby produced this error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/michaelchrisco/.rvm/rubies/jruby-1.7.16.1/bin/jruby extconf.rb 
/Users/michaelchrisco/.rvm/rubies/jruby-1.7.16.1/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /Users/michaelchrisco/.rvm/rubies/jruby-1.7.16.1/lib/native/include/ruby/ruby.h


Gem files will remain installed in /Users/michaelchrisco/.rvm/gems/jruby-1.7.16.1/gems/skylight-0.6.0 for inspection.
Results logged to /Users/michaelchrisco/.rvm/gems/jruby-1.7.16.1/gems/skylight-0.6.0/ext/gem_make.out

.rvm/rubies/jruby-1.7.16.1/lib/ruby/shared/mkmf.rb:14
The line that fails is:

# rvm/rubies/jruby-1.7.16.1/lib/ruby/shared/mkmf.rb:14
# ---------------------- Changed for JRuby ------------------------------------
# off by default
if ENV_JAVA['jruby.cext.enabled'] == 'true'
  msg = "JRuby does not support native extensions or the `mkmf' library very well.\n" +
        "Check https://wiki.jruby.org/C-Extension-Alternatives for alternatives.\n"
else
  msg = "C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS.\n"
  raise NotImplementedError, msg
end

require 'rbconfig'

# We're missing this in our rbconfig
module Config
  def RbConfig::expand(val, config = CONFIG)
    val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
      if !(v = $1 || $2)
        '$'
      elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
        pat, sub = $1, $2
        config[v] = false
        RbConfig::expand(key, config)
        config[v] = key
        key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
        key
      else
        " "
      end
    end
    val
  end
end

[SKYLIGHT] [0.3.4] The Skylight native extension wasn't found. Skylight is not running.

✗ gem install skylight
Fetching: skylight-0.3.4.gem (100%)
Building native extensions.  This could take a while...
Successfully installed skylight-0.3.4
1 gem installed
✗ skylight
[SKYLIGHT] [0.3.4] The Skylight native extension wasn't found. Skylight is not running.
Commands:
  skylight help [COMMAND]  # Describe available commands or one specific command
  skylight setup           # Sets up a new app

Does config.skylight.logger get ignored?

Hi!

I followed the instructions on how to change the logger
But it seems that config.skylight.logger is ignored.

# config/application.rb
skylightLogger = LogStashLogger.new(type: :file, path: File.join(Rails.root, 'log', 'skylight.log'), sync: true)
skylightLogger.warn 'I am a test'
config.skylight.logger = skylightLogger

# log/skylight.log
{"message":"I am a test","@timestamp":"2015-05-05T12:05:52.874+02:00","@version":"1","severity":"WARN","host":"vagrant-debian-wheezy"}
W, [2015-05-05T12:05:53.464793 #9370]  WARN -- : [SKYLIGHT] [0.6.0] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message, set `alert_log_file` in your config.)

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license, GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's 1) because I was enjoying looking at the code base and 2) because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata, too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

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.