Subscribed unsubscribe Subscribe Subscribe

@kyanny's blog

Write down what I learnt. Opinions are my own.

raven-ruby が送っているデータを見る

https://github.com/getsentry/raven-ruby/blob/0.12.3/lib/raven/client.rb#L57-L75

gzip + base64 してるので必要に応じてデコードしてやればよい、がそれすら不要で、

Advanced Configuration · getsentry/raven-ruby Wiki · GitHub

にあるとおり config.encoding = 'json' とすれば JSON をそのまま送りつけるので覗き見したりできる。

require 'raven'

Raven.configure do |config|
  config.dsn = 'http://foo:bar@localhost:9292/baz'
  config.encoding = 'json'
end

Raven.capture_message('test')
require 'rack'
require 'pp'
require 'json'

run ->(env) {
  pp JSON.parse(env['rack.input'].read)
  [200, {'Content-Type' => 'text/plain'}, ['ok']]
}
{"event_id"=>"4839997c345e60731f1caf72763fb838",
 "message"=>"test",
 "timestamp"=>"2015-03-18T08:24:57",
 "time_spent"=>nil,
 "level"=>40,
 "project"=>"baz",
 "logger"=>"root",
 "platform"=>"ruby",
 "server_name"=>"kensukes-macbook-pro.local",
 "modules"=>
  {"CFPropertyList"=>"2.3.0",
   "actionmailer"=>"4.1.7",
   "actionpack"=>"4.1.7",
   "actionview"=>"4.1.7",
   "activemodel"=>"4.1.5",
   "activerecord"=>"4.1.7",
   "activesupport"=>"4.1.5",
   "addressable"=>"2.3.6",
   "andand"=>"1.3.3",
   "ansi"=>"1.4.3",
   "arel"=>"5.0.1.20140414130214",
   "asset_sync"=>"1.0.0",
   "atomic"=>"1.1.16",
   "attr_required"=>"1.0.0",
   "autoprefixer-rails"=>"5.1.3.1",
   "awesome_print"=>"1.2.0",
   "aws-sdk"=>"1.34.0",
   "aws-sdk-v1"=>"1.53.0",
   "axiom-types"=>"0.1.1",
   "axlsx"=>"2.0.1",
   "backbone-rails"=>"1.1.2",
   "backports"=>"3.6.4",
   "bcrypt"=>"3.1.7",
   "bcrypt-ruby"=>"3.0.1",
   "benchmark-ips"=>"2.1.1",
   "bigdecimal"=>"1.2.6",
   "binding_of_caller"=>"0.7.2",
   "bootstrap-datepicker-rails"=>"1.3.0.2",
   "bootstrap-kaminari-views"=>"0.0.3",
   "bootstrap-sass"=>"2.3.2.2",
   "bson"=>"1.10.2",
   "bson_ext"=>"1.10.2",
   "builder"=>"3.2.2",
   "bundler"=>"1.8.3",
   "byebug"=>"2.7.0",
   "cancan"=>"1.6.10",
   "capybara"=>"2.4.4",
   "capybara-screenshot"=>"0.3.21",
   "capybara-webkit"=>"1.3.1",
   "cells"=>"3.11.3",
   "celluloid"=>"0.15.2",
   "celluloid-io"=>"0.15.0",
   "chai-jquery-rails"=>"1.2.1",
   "childprocess"=>"0.5.5",
   "chunky_png"=>"1.3.1",
   "cliver"=>"0.3.2",
   "codeclimate-test-reporter"=>"0.4.1",
   "coderay"=>"1.1.0",
   "coercible"=>"1.0.0",
   "coffee-rails"=>"4.0.1",
   "coffee-script"=>"2.3.0",
   "coffee-script-source"=>"1.8.0",
   "colored"=>"1.2",
   "colorize"=>"0.7.5",
   "columnize"=>"0.8.9",
   "compass"=>"0.12.3",
   "compass-rails"=>"1.1.7",
   "compass-susy-plugin"=>"0.9",
   "cool.io"=>"1.3.0",
   "crack"=>"0.4.2",
   "crass"=>"0.2.1",
   "css_parser"=>"1.3.5",
   "daemons"=>"1.1.9",
   "dalli"=>"2.7.0",
   "database_cleaner"=>"1.2.0",
   "debug_inspector"=>"0.0.2",
   "debugger-linecache"=>"1.2.0",
   "descendants_tracker"=>"0.0.4",
   "diff-lcs"=>"1.2.5",
   "docile"=>"1.1.5",
   "dogapi"=>"1.16.0",
   "dotenv"=>"0.11.1",
   "dotenv-deployment"=>"0.0.2",
   "dotenv-rails"=>"0.11.1",
   "dragonfly"=>"1.0.7",
   "dragonfly-s3_data_store"=>"1.0.4",
   "draper"=>"1.3.1",
   "eco"=>"1.0.0",
   "eco-source"=>"1.1.0.rc.1",
   "ejs"=>"1.1.1",
   "em-websocket"=>"0.5.1",
   "email_spec"=>"1.6.0",
   "equalizer"=>"0.0.9",
   "erubis"=>"2.7.0",
   "eventmachine"=>"1.0.4",
   "excon"=>"0.39.5",
   "execjs"=>"2.2.1",
   "facebooker2"=>"0.0.17",
   "factory_girl"=>"4.4.0",
   "factory_girl_rails"=>"4.5.0",
   "faker"=>"1.3.0",
   "faraday"=>"0.9.0",
   "fb_graph"=>"2.7.16",
   "fb_graph2"=>"0.5.0",
   "feature"=>"1.2.0",
   "ffaker"=>"1.23.0",
   "ffi"=>"1.9.3",
   "fission"=>"0.5.0",
   "fluentd"=>"0.12.6",
   "fog"=>"1.23.0",
   "fog-atmos"=>"0.1.0",
   "fog-aws"=>"0.0.6",
   "fog-brightbox"=>"0.5.0",
   "fog-core"=>"1.24.0",
   "fog-ecloud"=>"0.0.2",
   "fog-json"=>"1.0.0",
   "fog-profitbricks"=>"0.0.1",
   "fog-radosgw"=>"0.0.3",
   "fog-riakcs"=>"0.1.0",
   "fog-sakuracloud"=>"0.1.2",
   "fog-serverlove"=>"0.1.1",
   "fog-softlayer"=>"0.3.17",
   "fog-storm_on_demand"=>"0.1.0",
   "fog-terremark"=>"0.0.3",
   "fog-vmfusion"=>"0.0.1",
   "fog-voxel"=>"0.0.2",
   "fog-xml"=>"0.1.1",
   "foreman"=>"0.77.0",
   "formatador"=>"0.2.5",
   "fssm"=>"0.2.10",
   "gchartrb"=>"0.8",
   "geocoder"=>"1.2.7",
   "ghn"=>"2.2.0",
   "grape"=>"0.11.0",
   "grape-cache_control"=>"0.0.2",
   "grape-entity"=>"0.4.4",
   "growl"=>"1.0.3",
   "guard"=>"2.5.1",
   "guard-bundler"=>"2.0.0",
   "guard-compat"=>"1.2.0",
   "guard-konacha"=>"1.0.5",
   "guard-livereload"=>"1.4.0",
   "guard-puma"=>"0.3.1",
   "guard-rails"=>"0.5.3",
   "guard-rspec"=>"4.2.8",
   "haml"=>"4.0.5",
   "hamlbars"=>"2.1.1",
   "handlebars_assets"=>"0.16",
   "hashie"=>"2.1.2",
   "hashr"=>"0.0.22",
   "hike"=>"1.2.3",
   "hipchat"=>"1.3.0",
   "hirb"=>"0.7.1",
   "hirb-unicode"=>"0.0.5",
   "hitimes"=>"1.2.2",
   "hpricot"=>"0.8.6",
   "htmlentities"=>"4.3.1",
   "httmultiparty"=>"0.3.10",
   "http_accept_language"=>"2.0.2",
   "http_parser.rb"=>"0.6.0",
   "httparty"=>"0.11.0",
   "httpauth"=>"0.2.1",
   "httpclient"=>"2.4.0",
   "i18n"=>"0.6.11",
   "i18n-country-translations"=>"1.0.4",
   "i18n-js"=>"3.0.0.rc6",
   "i18n_country_select"=>"1.1.3",
   "ice_nine"=>"0.11.1",
   "inflecto"=>"0.0.2",
   "interactive_editor"=>"0.0.10",
   "interception"=>"0.5",
   "io-console"=>"0.4.3",
   "ipaddress"=>"0.8.0",
   "jbuilder"=>"2.0.2",
   "jist"=>"1.5.1",
   "jquery-colorbox-rails"=>"0.1.5",
   "jquery-rails"=>"2.1.4",
   "jquery-scrollto-rails"=>"1.4.3",
   "jquery-ui-rails"=>"4.1.1",
   "js-routes"=>"0.9.8",
   "json"=>"1.8.1",
   "json_spec"=>"1.1.4",
   "jwt"=>"0.1.13",
   "kaminari"=>"0.15.1",
   "kgio"=>"2.9.2",
   "konacha"=>"3.3.0",
   "launchy"=>"2.4.3",
   "letter_opener"=>"1.2.0",
   "listen"=>"2.7.0",
   "lumberjack"=>"1.0.4",
   "mail"=>"2.5.4",
   "mail-iso-2022-jp"=>"2.0.2",
   "marco-polo"=>"1.2.0",
   "marionette-rails"=>"2.0.0",
   "marked-rails"=>"0.3.2.0",
   "memcachier"=>"0.0.2",
   "memstat"=>"0.1.3",
   "method_source"=>"0.8.2",
   "mime-types"=>"1.25.1",
   "mimemagic"=>"0.2.1",
   "mini_magick"=>"3.7.0",
   "mini_portile"=>"0.6.2",
   "minitest"=>"5.4.1",
   "mix_tape"=>"0.0.6",
   "mixpanel-ruby"=>"1.5.0",
   "modernizr-rails"=>"2.7.1",
   "mogli"=>"0.0.46",
   "mongo"=>"1.10.2",
   "mongo_mapper"=>"0.13.0",
   "mono_logger"=>"1.1.0",
   "msgpack"=>"0.5.11",
   "multi_json"=>"1.7.9",
   "multi_xml"=>"0.5.5",
   "multipart-post"=>"2.0.0",
   "nenv"=>"0.2.0",
   "net-ping"=>"1.7.2",
   "net-scp"=>"1.2.1",
   "net-ssh"=>"2.9.1",
   "netrc"=>"0.7.7",
   "newrelic-grape"=>"1.4.1",
   "newrelic_rpm"=>"3.8.1.221",
   "nio4r"=>"1.1.0",
   "nokogiri"=>"1.5.11",
   "nokogumbo"=>"1.1.12",
   "notiffany"=>"0.0.6",
   "oauth"=>"0.4.7",
   "oauth2"=>"0.8.1",
   "octokit"=>"3.8.0",
   "oily_png"=>"1.1.1",
   "oj"=>"2.10.2",
   "oj_mimic_json"=>"1.0.1",
   "omniauth"=>"1.2.1",
   "omniauth-google-apps"=>"0.1.0",
   "omniauth-openid"=>"1.0.1",
   "paint"=>"0.8.7",
   "parallel"=>"1.3.3",
   "parallel_tests"=>"1.0.7",
   "peek"=>"0.1.9",
   "peek-dalli"=>"1.1.2",
   "peek-mongo"=>"1.1.0",
   "peek-redis"=>"1.1.0",
   "peek-resque"=>"2.0.1",
   "plucky"=>"0.6.6",
   "poltergeist"=>"1.5.1",
   "polyglot"=>"0.3.5",
   "power_assert"=>"0.2.2",
   "pry"=>"0.9.12.6",
   "pry-byebug"=>"1.3.3",
   "pry-doc"=>"0.6.0",
   "pry-rails"=>"0.3.2",
   "pry-remote"=>"0.1.8",
   "pry-rescue"=>"1.4.1",
   "pry-stack_explorer"=>"0.4.9.1",
   "psych"=>"2.0.8",
   "puma"=>"2.9.1",
   "pusher"=>"0.14.1",
   "quiet_assets"=>"1.1.0",
   "rack"=>"1.5.2",
   "rack-accept"=>"0.4.5",
   "rack-accept_language"=>"0.0.0",
   "rack-cache"=>"1.2",
   "rack-contrib"=>"1.1.0",
   "rack-cors"=>"0.2.9",
   "rack-livereload"=>"0.3.15",
   "rack-mount"=>"0.8.3",
   "rack-oauth2"=>"1.0.8",
   "rack-openid"=>"1.3.1",
   "rack-protection"=>"1.5.3",
   "rack-rewrite"=>"1.5.0",
   "rack-test"=>"0.6.2",
   "rack-timeout"=>"0.0.4",
   "rack_session_access"=>"0.1.1",
   "rails"=>"4.1.7",
   "rails-assets-backbone"=>"1.1.2",
   "rails-assets-backbone-validation"=>"0.9.1",
   "rails-assets-sinon"=>"1.13.0",
   "rails-assets-sinon-chai"=>"2.7.0",
   "rails-assets-underscore"=>"1.8.2",
   "rails_12factor"=>"0.0.2",
   "rails_autolink"=>"1.1.6",
   "rails_serve_static_assets"=>"0.0.2",
   "rails_stdout_logging"=>"0.0.3",
   "railties"=>"4.1.7",
   "raindrops"=>"0.13.0",
   "rake"=>"10.1.1",
   "rb-fchange"=>"0.0.6",
   "rb-fsevent"=>"0.9.4",
   "rb-inotify"=>"0.9.3",
   "rdoc"=>"4.2.0",
   "redcarpet"=>"3.1.2",
   "redis"=>"3.0.7",
   "redis-namespace"=>"1.5.1",
   "request_store"=>"1.0.8",
   "resque"=>"1.25.2",
   "resque-cleaner"=>"0.2.12",
   "resque-loner"=>"1.3.0",
   "resque-scheduler"=>"2.5.5",
   "resque-sentry"=>"1.1.1",
   "resque_spec"=>"0.16.0",
   "rest-client"=>"1.7.2",
   "reverse_markdown"=>"0.4.7",
   "rmagick"=>"2.13.4",
   "roadie"=>"2.4.3",
   "roo"=>"1.13.2",
   "route53"=>"0.3.0",
   "route_downcaser"=>"0.2.1",
   "rspec"=>"2.14.1",
   "rspec-activemodel-mocks"=>"1.0.1",
   "rspec-cells"=>"0.2.2",
   "rspec-core"=>"2.14.8",
   "rspec-expectations"=>"2.14.5",
   "rspec-its"=>"1.1.0",
   "rspec-mocks"=>"2.14.6",
   "rspec-rails"=>"3.0.2",
   "rspec-support"=>"3.0.4",
   "ruby-hmac"=>"0.4.0",
   "ruby-ole"=>"1.2.11.7",
   "ruby-openid"=>"2.3.0",
   "ruby-openid-apps-discovery"=>"1.2.0",
   "ruby-prof"=>"0.15.1",
   "ruby-progressbar"=>"1.4.2",
   "rubyXL"=>"3.1.0",
   "rubyzip"=>"1.0.0",
   "rufus-scheduler"=>"2.0.24",
   "safe_yaml"=>"1.0.4",
   "sanitize"=>"3.0.2",
   "sass"=>"3.2.14",
   "sass-rails"=>"4.0.2",
   "sawyer"=>"0.6.0",
   "select2-rails"=>"3.5.2",
   "selenium-webdriver"=>"2.44.0",
   "sentry-raven"=>"0.12.2",
   "shellany"=>"0.0.1",
   "shotgun"=>"0.9",
   "shoulda-matchers"=>"2.6.1",
   "show_me_the_cookies"=>"2.6.0",
   "sigdump"=>"0.2.2",
   "signature"=>"0.1.7",
   "simple_aws"=>"1.2.3",
   "simplecov"=>"0.7.1",
   "simplecov-html"=>"0.7.1",
   "simplecov-rcov"=>"0.2.3",
   "sinatra"=>"1.4.5",
   "sinatra-contrib"=>"1.4.2",
   "sinon-chai-rails"=>"1.1.0",
   "sinon-rails"=>"1.9.0",
   "slop"=>"3.4.7",
   "sorcery"=>"0.8.1",
   "spoon"=>"0.0.4",
   "spreadsheet"=>"0.9.7",
   "spring"=>"1.1.3",
   "spring-commands-rspec"=>"1.0.2",
   "sprockets"=>"2.11.0",
   "sprockets-rails"=>"2.0.1",
   "sproutvideo-rb"=>"1.5.0",
   "state_machine"=>"1.2.0",
   "string-scrub"=>"0.0.5",
   "stringex"=>"2.5.2",
   "subexec"=>"0.2.3",
   "teaspoon"=>"0.8.0",
   "terminal-notifier"=>"1.5.1",
   "terminal-notifier-guard"=>"1.5.3",
   "test-unit"=>"3.0.8",
   "thin"=>"1.6.3",
   "thor"=>"0.18.1",
   "thread_safe"=>"0.2.0",
   "tilt"=>"1.4.1",
   "timecop"=>"0.7.1",
   "timers"=>"1.1.0",
   "tire"=>"0.6.2",
   "treetop"=>"1.4.15",
   "trollop"=>"2.0",
   "turbolinks"=>"2.2.1",
   "twilio-ruby"=>"3.12.2",
   "tzinfo"=>"1.2.2",
   "tzinfo-data"=>"1.2015.1",
   "uber"=>"0.0.12",
   "uglifier"=>"2.2.1",
   "unf"=>"0.1.3",
   "unf_ext"=>"0.0.6",
   "unicode-display_width"=>"0.1.1",
   "unicode_utils"=>"1.4.0",
   "unicorn"=>"4.8.3",
   "unicorn-worker-killer"=>"0.4.2",
   "unidecoder"=>"1.1.2",
   "uniform_notifier"=>"1.8.0",
   "url_safe_base64"=>"0.2.2",
   "useragent"=>"0.10.0",
   "uuidtools"=>"2.1.5",
   "vegas"=>"0.1.11",
   "virtus"=>"1.0.4",
   "web_translate_it"=>"2.3.4",
   "webmock"=>"1.20.2",
   "websocket"=>"1.2.1",
   "websocket-driver"=>"0.3.5",
   "websocket-extensions"=>"0.1.1",
   "wirb"=>"1.0.3",
   "wirble"=>"0.1.3",
   "xpath"=>"2.0.0",
   "yajl-ruby"=>"1.2.1",
   "yard"=>"0.8.7.6",
   "zeroclipboard-rails"=>"0.1.0"},
 "extra"=>{},
 "tags"=>{},
 "user"=>{},
 "sentry.interfaces.Message"=>{"message"=>"test", "params"=>[]}}
127.0.0.1 - - [18/Mar/2015:17:24:58 +0900] "POST /api/baz/store/ HTTP/1.1" 200 - 0.0388