6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/generators/corn/config/config_generator.rb', line 6
def do_config
create_file "config/initializers/corn_config.rb", "Corn.config({\n # setup Corn logger, default is output to STDOUT.\n :logger => Rails.logger,\n\n # Every Corn project has its own client id, you can find it in your\n # Corn project page. This is a unique identifier for reporting your\n # data, please keep it secret.\n # :client_id => ENV[\"CORN_CLIENT_ID\"],\n\n # Corn only reprots requests that are exceeded this threshold;\n # default threshold is 5 seconds. Please use your 97 percentile response\n # time as slow_request_threshold value, so that you can focus on\n # improving slow requests. Doing nothing with generated reports\n # is a waste.\n # You can change this value to 0 for testing Corn configurations,\n # and learn how Corn works.\n # Set this threshold to smaller value may cause performance overhead.\n # :slow_request_threshold => 5,\n\n # Sampling interval controls how frequent profiler should take\n # sample of processing request threads' stacktrace. The default value\n # is 0.1 seconds. Change the value to larger number will reduce the\n # performance impact to your application. Change the value to smaller\n # number will increase performance impact.\n # The more samples we have for processing a request, the more accurate\n # of the profiling call-graph report we will have.\n # Hence it needs a balance.\n # For example, when a request processing time is 5 seconds, sampling_interval\n # value is 0.1 second, then we will get approximately 50 samples, which\n # is good enough for you to understand what's your code doing in most\n # of cases.\n # :sampling_interval => 0.1,\n\n # Corn launchs a standalone thread to post profiling data back to Corn server.\n # post_interval controls how frequent we will post one report back to\n # Corn server. Default value is 2 seconds. It means the posting thread will\n # sleep 2 seconds after Corn posted one processed slow request profiling\n # data to Corn server. If you had too many reports need to be posted to Corn\n # server, we recommend you increase slow_request_threshold instead of reduce\n # post_interval value.\n # :post_interval => 2,\n\n # Why we need this configuration? The anwser is runtime toggle.\n # You may like to turn off the Corn profiler in most of time,\n # and only turn on profiling when you need it in production.\n # The value can be \"true\", \"false\" or a lambda (or Proc).\n # For example: Corn.config(:profiling => lambda {|env| YourAppConfig.corn_profiling? })\n # The \"env\" argument is the Rack env argument when a Rack middleware is\n # called. So you can also use it to turn on profiling by a request parameter.\n # For example: Corn.config(:profiling => lambda {|env| env[\"QUERY_STRING\"] =~ /corn_profiling=true/ })\n # This configuration will be checked for every request, so don't do anything\n # expensive here.\n # :profiling => true,\n })\n# Install corn rack middleware for profiling slow requests\nRails.configuration.middleware.use(Corn.rack_middleware)\n"
end
|