slack-ruby-bot-server 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +11 -9
  3. data/CHANGELOG.md +7 -1
  4. data/Gemfile +16 -0
  5. data/README.md +31 -4
  6. data/UPGRADING.md +25 -0
  7. data/lib/slack-ruby-bot-server.rb +6 -5
  8. data/lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb +1 -1
  9. data/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb +31 -18
  10. data/lib/slack-ruby-bot-server/api/helpers/error_helpers.rb +12 -10
  11. data/lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb +5 -1
  12. data/lib/slack-ruby-bot-server/api/middleware.rb +6 -1
  13. data/lib/slack-ruby-bot-server/api/presenters/status_presenter.rb +7 -3
  14. data/lib/slack-ruby-bot-server/app.rb +4 -23
  15. data/lib/slack-ruby-bot-server/config.rb +16 -0
  16. data/lib/slack-ruby-bot-server/config/database_adapters/activerecord.rb +27 -0
  17. data/lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb +24 -0
  18. data/lib/slack-ruby-bot-server/models/team/activerecord.rb +13 -0
  19. data/lib/slack-ruby-bot-server/models/team/methods.rb +55 -0
  20. data/lib/slack-ruby-bot-server/models/team/mongoid.rb +22 -0
  21. data/lib/slack-ruby-bot-server/version.rb +1 -1
  22. data/sample_apps/README.md +11 -0
  23. data/{sample_app → sample_apps/sample_app_activerecord}/.rspec +0 -0
  24. data/sample_apps/sample_app_activerecord/.standalone_migrations +3 -0
  25. data/sample_apps/sample_app_activerecord/Gemfile +23 -0
  26. data/{sample_app → sample_apps/sample_app_activerecord}/Procfile +0 -0
  27. data/sample_apps/sample_app_activerecord/README.md +11 -0
  28. data/sample_apps/sample_app_activerecord/Rakefile +13 -0
  29. data/{sample_app → sample_apps/sample_app_activerecord}/commands.rb +0 -0
  30. data/{sample_app → sample_apps/sample_app_activerecord}/commands/help.rb +0 -0
  31. data/{sample_app → sample_apps/sample_app_activerecord}/commands/whoami.rb +0 -0
  32. data/sample_apps/sample_app_activerecord/config.ru +21 -0
  33. data/{sample_app → sample_apps/sample_app_activerecord}/config/newrelic.yml +0 -0
  34. data/sample_apps/sample_app_activerecord/config/postgresql.yml +17 -0
  35. data/sample_apps/sample_app_activerecord/db/migrate/20170307164946_create_teams_table.rb +13 -0
  36. data/sample_apps/sample_app_activerecord/db/schema.rb +26 -0
  37. data/sample_apps/sample_app_activerecord/spec/api/root_spec.rb +16 -0
  38. data/{sample_app → sample_apps/sample_app_activerecord}/spec/commands/help_spec.rb +0 -0
  39. data/{sample_app → sample_apps/sample_app_activerecord}/spec/commands/whoami_spec.rb +0 -0
  40. data/sample_apps/sample_app_activerecord/spec/spec_helper.rb +19 -0
  41. data/sample_apps/sample_app_mongoid/.rspec +3 -0
  42. data/{sample_app → sample_apps/sample_app_mongoid}/Gemfile +6 -1
  43. data/sample_apps/sample_app_mongoid/Procfile +1 -0
  44. data/{sample_app → sample_apps/sample_app_mongoid}/README.md +13 -0
  45. data/{sample_app → sample_apps/sample_app_mongoid}/Rakefile +0 -0
  46. data/sample_apps/sample_app_mongoid/commands.rb +2 -0
  47. data/sample_apps/sample_app_mongoid/commands/help.rb +19 -0
  48. data/sample_apps/sample_app_mongoid/commands/whoami.rb +6 -0
  49. data/{sample_app → sample_apps/sample_app_mongoid}/config.ru +0 -0
  50. data/{sample_app → sample_apps/sample_app_mongoid}/config/mongoid.yml +0 -0
  51. data/sample_apps/sample_app_mongoid/config/newrelic.yml +217 -0
  52. data/sample_apps/sample_app_mongoid/spec/api/root_spec.rb +16 -0
  53. data/sample_apps/sample_app_mongoid/spec/commands/help_spec.rb +14 -0
  54. data/sample_apps/sample_app_mongoid/spec/commands/whoami_spec.rb +14 -0
  55. data/{sample_app → sample_apps/sample_app_mongoid}/spec/spec_helper.rb +2 -0
  56. data/slack-ruby-bot-server.gemspec +1 -5
  57. metadata +43 -76
  58. data/lib/slack-ruby-bot-server/models/team.rb +0 -68
@@ -0,0 +1,13 @@
1
+ require_relative 'methods'
2
+
3
+ class Team < ActiveRecord::Base
4
+ include Methods
5
+
6
+ def self.purge!
7
+ # destroy teams inactive for two weeks
8
+ Team.where(active: false).where('updated_at <= ?', 2.weeks.ago).each do |team|
9
+ puts "Destroying #{team}, inactive since #{team.updated_at}, over two weeks ago."
10
+ team.destroy
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,55 @@
1
+ module Methods
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ attr_accessor :server # server at runtime
6
+
7
+ SORT_ORDERS = ['created_at', '-created_at', 'updated_at', '-updated_at'].freeze
8
+
9
+ scope :active, -> { where(active: true) }
10
+
11
+ validates_uniqueness_of :token, message: 'has already been used'
12
+ validates_presence_of :token
13
+ validates_presence_of :team_id
14
+
15
+ def deactivate!
16
+ update_attributes!(active: false)
17
+ end
18
+
19
+ def activate!(token)
20
+ update_attributes!(active: true, token: token)
21
+ end
22
+
23
+ def to_s
24
+ {
25
+ name: name,
26
+ domain: domain,
27
+ id: team_id
28
+ }.map do |k, v|
29
+ "#{k}=#{v}" if v
30
+ end.compact.join(', ')
31
+ end
32
+
33
+ def ping!
34
+ client = Slack::Web::Client.new(token: token)
35
+ auth = client.auth_test
36
+ {
37
+ auth: auth,
38
+ presence: client.users_getPresence(user: auth['user_id'])
39
+ }
40
+ end
41
+
42
+ def self.find_or_create_from_env!
43
+ token = ENV['SLACK_API_TOKEN']
44
+ return unless token
45
+ team = Team.where(token: token).first
46
+ team ||= Team.new(token: token)
47
+ info = Slack::Web::Client.new(token: token).team_info
48
+ team.team_id = info['team']['id']
49
+ team.name = info['team']['name']
50
+ team.domain = info['team']['domain']
51
+ team.save!
52
+ team
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'methods'
2
+
3
+ class Team
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+
7
+ field :team_id, type: String
8
+ field :name, type: String
9
+ field :domain, type: String
10
+ field :token, type: String
11
+ field :active, type: Boolean, default: true
12
+
13
+ include Methods
14
+
15
+ def self.purge!
16
+ # destroy teams inactive for two weeks
17
+ Team.where(active: false, :updated_at.lte => 2.weeks.ago).each do |team|
18
+ Mongoid.logger.info "Destroying #{team}, inactive since #{team.updated_at}, over two weeks ago."
19
+ team.destroy
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBotServer
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
@@ -0,0 +1,11 @@
1
+ To run samples, [register a new Slack app](https://api.slack.com/apps), configure a bot user, and OAuth redirect URL to http://localhost:9292 (for development). Configure your development environment by editing `.env` and setting the client ID and secret you were given during registration.
2
+
3
+ ```
4
+ SLACK_CLIENT_ID=1111111111.2222222
5
+ SLACK_CLIENT_SECRET=abcdef012345679
6
+ PORT=9292
7
+ ```
8
+
9
+ Run tests with `bundle exec rake`.
10
+
11
+
@@ -0,0 +1,3 @@
1
+ config:
2
+ database: config/postgresql.yml
3
+
@@ -0,0 +1,23 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'pg'
4
+ gem 'activerecord', require: 'active_record'
5
+ gem 'slack-ruby-bot-server', path: '../../'
6
+ gem 'newrelic-slack-ruby-bot'
7
+ gem 'rack-server-pages'
8
+ gem 'rack-test'
9
+ gem 'otr-activerecord'
10
+
11
+ group :development, :test do
12
+ gem 'standalone_migrations'
13
+ end
14
+
15
+ group :test do
16
+ gem 'rake'
17
+ gem 'rspec'
18
+ gem 'fabrication'
19
+ gem 'faker'
20
+ gem 'vcr'
21
+ gem 'webmock'
22
+ gem 'database_cleaner'
23
+ end
@@ -0,0 +1,11 @@
1
+ ### What's this?
2
+
3
+ This is a sample slack-ruby-bot-server with ActiveRecord.
4
+
5
+ ### Run
6
+
7
+ ```
8
+ bundle install
9
+ rake db:create db:migrate
10
+ rackup
11
+ ```
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ require 'rspec/core'
4
+ require 'rspec/core/rake_task'
5
+
6
+ require 'standalone_migrations'
7
+ StandaloneMigrations::Tasks.load_tasks
8
+
9
+ RSpec::Core::RakeTask.new(:spec) do |spec|
10
+ spec.pattern = FileList['spec/**/*_spec.rb']
11
+ end
12
+
13
+ task default: [:spec]
@@ -0,0 +1,21 @@
1
+ ENV['RACK_ENV'] ||= 'development'
2
+
3
+ Bundler.require :default
4
+
5
+ require_relative 'commands'
6
+ require 'yaml'
7
+
8
+ ActiveRecord::Base.establish_connection(YAML.load_file('config/postgresql.yml')[ENV['RACK_ENV']])
9
+
10
+ if ENV['RACK_ENV'] == 'development'
11
+ puts 'Loading NewRelic in developer mode ...'
12
+ require 'new_relic/rack/developer_mode'
13
+ use NewRelic::Rack::DeveloperMode
14
+ end
15
+
16
+ NewRelic::Agent.manual_start
17
+
18
+ SlackRubyBotServer::App.instance.prepare!
19
+ SlackRubyBotServer::Service.start!
20
+
21
+ run SlackRubyBotServer::Api::Middleware.instance
@@ -0,0 +1,17 @@
1
+ default: &default
2
+ adapter: postgresql
3
+ pool: 10
4
+ timeout: 5000
5
+ encoding: unicode
6
+
7
+ development:
8
+ <<: *default
9
+ database: slack_ruby_bot_server_development
10
+
11
+ test:
12
+ <<: *default
13
+ database: slack_ruby_bot_server_test
14
+
15
+ production:
16
+ <<: *default
17
+ database: slack_ruby_bot_server_production
@@ -0,0 +1,13 @@
1
+ class CreateTeamsTable < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :teams, force: true do |t|
4
+ t.string :team_id
5
+ t.string :name
6
+ t.boolean :active, default: true
7
+ t.string :domain
8
+ t.string :token
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,26 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20_170_307_164_946) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension 'plpgsql'
16
+
17
+ create_table 'teams', force: :cascade do |t|
18
+ t.string 'team_id'
19
+ t.string 'name'
20
+ t.boolean 'active', default: true
21
+ t.string 'domain'
22
+ t.string 'token'
23
+ t.datetime 'created_at', null: false
24
+ t.datetime 'updated_at', null: false
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ def app
4
+ SlackRubyBotServer::Api::Middleware.instance
5
+ end
6
+
7
+ describe 'API' do
8
+ include Rack::Test::Methods
9
+
10
+ it 'root' do
11
+ get '/api'
12
+ expect(last_response.status).to eq 200
13
+ links = JSON.parse(last_response.body)['_links']
14
+ expect(links.keys.sort).to eq(%w(self status team teams).sort)
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ $LOAD_PATH.unshift File.expand_path('..', __dir__)
2
+
3
+ ENV['RACK_ENV'] = 'test'
4
+
5
+ require 'active_record'
6
+ require 'database_cleaner'
7
+ require 'slack-ruby-bot-server/rspec'
8
+
9
+ db_config = YAML.load(File.read(File.expand_path('../config/postgresql.yml', __dir__)))[ENV['RACK_ENV']]
10
+ ActiveRecord::Tasks::DatabaseTasks.create(db_config)
11
+ ActiveRecord::Base.establish_connection(db_config)
12
+
13
+ RSpec.configure do |config|
14
+ config.around :each do |example|
15
+ DatabaseCleaner.cleaning do
16
+ example.run
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=documentation
3
+
@@ -1,8 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'slack-ruby-bot-server', path: '../'
3
+ gem 'mongoid'
4
+ gem 'slack-ruby-bot-server', path: '../../'
4
5
  gem 'newrelic-slack-ruby-bot'
5
6
 
7
+ gem 'kaminari-mongoid'
8
+ gem 'mongoid-scroll'
9
+
6
10
  group :test do
7
11
  gem 'rake'
8
12
  gem 'rspec'
@@ -11,4 +15,5 @@ group :test do
11
15
  gem 'vcr'
12
16
  gem 'webmock'
13
17
  gem 'database_cleaner'
18
+ gem 'rack-test'
14
19
  end
@@ -0,0 +1 @@
1
+ web: bundle exec unicorn -p $PORT
@@ -1 +1,14 @@
1
+ ### What's this?
2
+
3
+ This is a sample slack-ruby-bot-server with ActiveRecord.
4
+
5
+ ### Run
6
+
7
+ ```
8
+ bundle install
9
+ rackup
10
+ ```
11
+
12
+ ### Demo
13
+
1
14
  This app is deployed from [github.com/slack-ruby/slack-ruby-bot-server-sample](https://github.com/slack-ruby/slack-ruby-bot-server-sample).
@@ -0,0 +1,2 @@
1
+ require_relative 'commands/help'
2
+ require_relative 'commands/whoami'
@@ -0,0 +1,19 @@
1
+ class Help < SlackRubyBot::Commands::Base
2
+ HELP = <<-EOS.freeze
3
+ ```
4
+ I am your friendly slack-ruby-bot-server, here to help.
5
+
6
+ General
7
+ -------
8
+
9
+ help - get this helpful message
10
+ whoami - print your username
11
+
12
+ ```
13
+ EOS
14
+ def self.call(client, data, _match)
15
+ client.say(channel: data.channel, text: [HELP, SlackRubyBotServer::INFO].join("\n"))
16
+ client.say(channel: data.channel, gif: 'help')
17
+ logger.info "HELP: #{client.owner}, user=#{data.user}"
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ class Whoami < SlackRubyBot::Commands::Base
2
+ def self.call(client, data, _match)
3
+ client.say(channel: data.channel, text: "<@#{data.user}>")
4
+ logger.info "UNAME: #{client.owner}, user=#{data.user}"
5
+ end
6
+ end
@@ -0,0 +1,217 @@
1
+ # Here are the settings that are common to all environments
2
+ common: &default_settings
3
+ # ============================== LICENSE KEY ===============================
4
+
5
+ # You must specify the license key associated with your New Relic
6
+ # account. This key binds your Agent's data to your account in the
7
+ # New Relic service.
8
+ license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>'
9
+
10
+ # Application Name Set this to be the name of your application as
11
+ # you'd like it show up in New Relic. The service will then auto-map
12
+ # instances of your application into an "application" on your
13
+ # dashboard page. If you want to map this instance into multiple
14
+ # apps, like "AJAX Requests" and "All UI" then specify a semicolon
15
+ # separated list of up to three distinct names, or a yaml list.
16
+ app_name: <%= ENV["NEW_RELIC_APP_NAME"] || 'SlackRubyBotServer' %>
17
+
18
+ # When "true", the agent collects performance data about your
19
+ # application and reports this data to the New Relic service at
20
+ # newrelic.com. This global switch is normally overridden for each
21
+ # environment below. (formerly called 'enabled')
22
+ monitor_mode: true
23
+
24
+ # Developer mode should be off in every environment but
25
+ # development as it has very high overhead in memory.
26
+ developer_mode: false
27
+
28
+ # The newrelic agent generates its own log file to keep its logging
29
+ # information separate from that of your application. Specify its
30
+ # log level here.
31
+ log_level: info
32
+
33
+ # Optionally set the path to the log file This is expanded from the
34
+ # root directory (may be relative or absolute, e.g. 'log/' or
35
+ # '/var/log/') The agent will attempt to create this directory if it
36
+ # does not exist.
37
+ # log_file_path: 'log'
38
+
39
+ # Optionally set the name of the log file, defaults to 'newrelic_agent.log'
40
+ # log_file_name: 'newrelic_agent.log'
41
+
42
+ # The newrelic agent communicates with the service via http by
43
+ # default. If you want to communicate via https to increase
44
+ # security, then turn on SSL by setting this value to true. Note,
45
+ # this will result in increased CPU overhead to perform the
46
+ # encryption involved in SSL communication, but this work is done
47
+ # asynchronously to the threads that process your application code,
48
+ # so it should not impact response times.
49
+ ssl: false
50
+
51
+ # EXPERIMENTAL: enable verification of the SSL certificate sent by
52
+ # the server. This setting has no effect unless SSL is enabled
53
+ # above. This may block your application. Only enable it if the data
54
+ # you send us needs end-to-end verified certificates.
55
+ #
56
+ # This means we cannot cache the DNS lookup, so each request to the
57
+ # service will perform a lookup. It also means that we cannot
58
+ # use a non-blocking lookup, so in a worst case, if you have DNS
59
+ # problems, your app may block indefinitely.
60
+ # verify_certificate: true
61
+
62
+ # Set your application's Apdex threshold value with the 'apdex_t'
63
+ # setting, in seconds. The apdex_t value determines the buckets used
64
+ # to compute your overall Apdex score.
65
+ # Requests that take less than apdex_t seconds to process will be
66
+ # classified as Satisfying transactions; more than apdex_t seconds
67
+ # as Tolerating transactions; and more than four times the apdex_t
68
+ # value as Frustrating transactions.
69
+ # For more about the Apdex standard, see
70
+ # http://newrelic.com/docs/general/apdex
71
+
72
+ apdex_t: 0.5
73
+
74
+ #============================== Browser Monitoring ===============================
75
+ # New Relic Real User Monitoring gives you insight into the performance real users are
76
+ # experiencing with your website. This is accomplished by measuring the time it takes for
77
+ # your users' browsers to download and render your web pages by injecting a small amount
78
+ # of JavaScript code into the header and footer of each page.
79
+ browser_monitoring:
80
+ # By default the agent automatically injects the monitoring JavaScript
81
+ # into web pages. Set this attribute to false to turn off this behavior.
82
+ auto_instrument: true
83
+
84
+ # Proxy settings for connecting to the service.
85
+ #
86
+ # If a proxy is used, the host setting is required. Other settings
87
+ # are optional. Default port is 8080.
88
+ #
89
+ # proxy_host: hostname
90
+ # proxy_port: 8080
91
+ # proxy_user:
92
+ # proxy_pass:
93
+
94
+
95
+ # Tells transaction tracer and error collector (when enabled)
96
+ # whether or not to capture HTTP params. When true, frameworks can
97
+ # exclude HTTP parameters from being captured.
98
+ # Rails: the RoR filter_parameter_logging excludes parameters
99
+ # Java: create a config setting called "ignored_params" and set it to
100
+ # a comma separated list of HTTP parameter names.
101
+ # ex: ignored_params: credit_card, ssn, password
102
+ capture_params: true
103
+
104
+
105
+ # Transaction tracer captures deep information about slow
106
+ # transactions and sends this to the service once a
107
+ # minute. Included in the transaction is the exact call sequence of
108
+ # the transactions including any SQL statements issued.
109
+ transaction_tracer:
110
+
111
+ # Transaction tracer is enabled by default. Set this to false to
112
+ # turn it off. This feature is only available at the Professional
113
+ # and above product levels.
114
+ enabled: true
115
+
116
+ # Threshold in seconds for when to collect a transaction
117
+ # trace. When the response time of a controller action exceeds
118
+ # this threshold, a transaction trace will be recorded and sent to
119
+ # the service. Valid values are any float value, or (default)
120
+ # "apdex_f", which will use the threshold for an dissatisfying
121
+ # Apdex controller action - four times the Apdex T value.
122
+ transaction_threshold: apdex_f
123
+
124
+ # When transaction tracer is on, SQL statements can optionally be
125
+ # recorded. The recorder has three modes, "off" which sends no
126
+ # SQL, "raw" which sends the SQL statement in its original form,
127
+ # and "obfuscated", which strips out numeric and string literals
128
+ record_sql: obfuscated
129
+
130
+ # Threshold in seconds for when to collect stack trace for a SQL
131
+ # call. In other words, when SQL statements exceed this threshold,
132
+ # then capture and send the current stack trace. This is
133
+ # helpful for pinpointing where long SQL calls originate from
134
+ stack_trace_threshold: 0.500
135
+
136
+ # Determines whether the agent will capture query plans for slow
137
+ # SQL queries. Only supported in mysql and postgres. Should be
138
+ # set to false when using other adapters.
139
+ # explain_enabled: true
140
+
141
+ # Threshold for query execution time below which query plans will not
142
+ # not be captured. Relevant only when `explain_enabled` is true.
143
+ # explain_threshold: 0.5
144
+
145
+ # Error collector captures information about uncaught exceptions and
146
+ # sends them to the service for viewing
147
+ error_collector:
148
+
149
+ # Error collector is enabled by default. Set this to false to turn
150
+ # it off. This feature is only available at the Professional and above
151
+ # product levels
152
+ enabled: true
153
+
154
+ # Rails Only - tells error collector whether or not to capture a
155
+ # source snippet around the place of the error when errors are View
156
+ # related.
157
+ capture_source: true
158
+
159
+ # To stop specific errors from reporting to New Relic, set this property
160
+ # to comma separated values. Default is to ignore routing errors
161
+ # which are how 404's get triggered.
162
+ #
163
+ ignore_errors: ActionController::RoutingError
164
+
165
+ # (Advanced) Uncomment this to ensure the cpu and memory samplers
166
+ # won't run. Useful when you are using the agent to monitor an
167
+ # external resource
168
+ # disable_samplers: true
169
+
170
+ # If you aren't interested in visibility in these areas, you can
171
+ # disable the instrumentation to reduce overhead.
172
+ #
173
+ # disable_view_instrumentation: true
174
+ # disable_activerecord_instrumentation: true
175
+ # disable_memcache_instrumentation: true
176
+ # disable_dj: true
177
+
178
+ # If you're interested in capturing memcache keys as though they
179
+ # were SQL uncomment this flag. Note that this does increase
180
+ # overhead slightly on every memcached call, and can have security
181
+ # implications if your memcached keys are sensitive
182
+ # capture_memcache_keys: true
183
+
184
+ # Certain types of instrumentation such as GC stats will not work if
185
+ # you are running multi-threaded. Please let us know.
186
+ # multi_threaded = false
187
+
188
+ # Application Environments
189
+ # ------------------------------------------
190
+
191
+ development:
192
+ <<: *default_settings
193
+ # Turn off communication to New Relic service in development mode (also
194
+ # 'enabled').
195
+ # NOTE: for initial evaluation purposes, you may want to temporarily
196
+ # turn the agent on in development mode.
197
+ monitor_mode: false
198
+
199
+ # Rails Only - when running in Developer Mode, the New Relic Agent will
200
+ # present performance information on the last 100 transactions you have
201
+ # executed since starting the mongrel.
202
+ # NOTE: There is substantial overhead when running in developer mode.
203
+ # Do not use for production or load testing.
204
+ developer_mode: true
205
+
206
+ # Enable textmate links
207
+ # textmate: true
208
+
209
+ test:
210
+ <<: *default_settings
211
+ # It almost never makes sense to turn on the agent when running
212
+ # unit, functional or integration tests or the like.
213
+ monitor_mode: false
214
+
215
+ production:
216
+ <<: *default_settings
217
+ monitor_mode: true