tingyun_rpm 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +14 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +3 -0
- data/Guardfile +25 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/cert/cacert.pem +0 -0
- data/lib/ting_yun/agent/agent.rb +128 -0
- data/lib/ting_yun/agent/class_methods.rb +21 -0
- data/lib/ting_yun/agent/collector/base_sampler.rb +2 -0
- data/lib/ting_yun/agent/collector/error_collector/error_trace_array.rb +88 -0
- data/lib/ting_yun/agent/collector/error_collector/noticed_error.rb +129 -0
- data/lib/ting_yun/agent/collector/error_collector.rb +165 -0
- data/lib/ting_yun/agent/collector/middle_ware_collector/cpu_sampler.rb +68 -0
- data/lib/ting_yun/agent/collector/middle_ware_collector/memory_sampler.rb +139 -0
- data/lib/ting_yun/agent/collector/middle_ware_collector/middle_ware.rb +13 -0
- data/lib/ting_yun/agent/collector/middle_ware_collector/sampler.rb +59 -0
- data/lib/ting_yun/agent/collector/middle_ware_collector.rb +80 -0
- data/lib/ting_yun/agent/collector/sql_sampler.rb +299 -0
- data/lib/ting_yun/agent/collector/stats_engine/metric_stats.rb +170 -0
- data/lib/ting_yun/agent/collector/stats_engine/stats_hash.rb +172 -0
- data/lib/ting_yun/agent/collector/stats_engine.rb +28 -0
- data/lib/ting_yun/agent/collector/transaction_sampler/slowest_sample_buffer.rb +25 -0
- data/lib/ting_yun/agent/collector/transaction_sampler/transaction_sample_buffer_base.rb +96 -0
- data/lib/ting_yun/agent/collector/transaction_sampler.rb +226 -0
- data/lib/ting_yun/agent/container_data_manager.rb +94 -0
- data/lib/ting_yun/agent/cross_app/cross_app_monitor.rb +131 -0
- data/lib/ting_yun/agent/cross_app/cross_app_tracing.rb +202 -0
- data/lib/ting_yun/agent/cross_app/inbound_request_monitor.rb +22 -0
- data/lib/ting_yun/agent/database.rb +410 -0
- data/lib/ting_yun/agent/datastore/metric_helper.rb +82 -0
- data/lib/ting_yun/agent/datastore/mongo.rb +44 -0
- data/lib/ting_yun/agent/datastore.rb +33 -0
- data/lib/ting_yun/agent/dispatcher.rb +39 -0
- data/lib/ting_yun/agent/event/event_listener.rb +47 -0
- data/lib/ting_yun/agent/event/event_loop.rb +194 -0
- data/lib/ting_yun/agent/instance_methods/connect.rb +164 -0
- data/lib/ting_yun/agent/instance_methods/container_data_manager.rb +137 -0
- data/lib/ting_yun/agent/instance_methods/handle_errors.rb +71 -0
- data/lib/ting_yun/agent/instance_methods/start.rb +219 -0
- data/lib/ting_yun/agent/instance_methods/start_worker_thread.rb +51 -0
- data/lib/ting_yun/agent/instance_methods.rb +39 -0
- data/lib/ting_yun/agent/method_tracer.rb +256 -0
- data/lib/ting_yun/agent/method_tracer_helpers.rb +85 -0
- data/lib/ting_yun/agent/threading/agent_thread.rb +49 -0
- data/lib/ting_yun/agent/transaction/attributes.rb +22 -0
- data/lib/ting_yun/agent/transaction/request_attributes.rb +126 -0
- data/lib/ting_yun/agent/transaction/trace.rb +125 -0
- data/lib/ting_yun/agent/transaction/trace_node.rb +110 -0
- data/lib/ting_yun/agent/transaction/traced_method_stack.rb +80 -0
- data/lib/ting_yun/agent/transaction/transaction_metrics.rb +51 -0
- data/lib/ting_yun/agent/transaction/transaction_sample_builder.rb +63 -0
- data/lib/ting_yun/agent/transaction/transaction_state.rb +112 -0
- data/lib/ting_yun/agent/transaction.rb +522 -0
- data/lib/ting_yun/agent.rb +207 -0
- data/lib/ting_yun/configuration/default_source.rb +638 -0
- data/lib/ting_yun/configuration/dotted_hash.rb +46 -0
- data/lib/ting_yun/configuration/environment_source.rb +116 -0
- data/lib/ting_yun/configuration/manager.rb +232 -0
- data/lib/ting_yun/configuration/manual_source.rb +14 -0
- data/lib/ting_yun/configuration/server_source.rb +88 -0
- data/lib/ting_yun/configuration/yaml_source.rb +136 -0
- data/lib/ting_yun/configuration.rb +9 -0
- data/lib/ting_yun/environment_report.rb +123 -0
- data/lib/ting_yun/frameworks/class_methods.rb +47 -0
- data/lib/ting_yun/frameworks/external.rb +15 -0
- data/lib/ting_yun/frameworks/instance_methods.rb +120 -0
- data/lib/ting_yun/frameworks/instrumentation.rb +67 -0
- data/lib/ting_yun/frameworks/rails.rb +63 -0
- data/lib/ting_yun/frameworks/rails3.rb +26 -0
- data/lib/ting_yun/frameworks/rails4.rb +14 -0
- data/lib/ting_yun/frameworks/ruby.rb +17 -0
- data/lib/ting_yun/frameworks/sinatra.rb +10 -0
- data/lib/ting_yun/frameworks.rb +34 -0
- data/lib/ting_yun/http/generic_request.rb +8 -0
- data/lib/ting_yun/http/net_http_request.rb +46 -0
- data/lib/ting_yun/instrumentation/active_record.rb +103 -0
- data/lib/ting_yun/instrumentation/middleware_proxy.rb +77 -0
- data/lib/ting_yun/instrumentation/middleware_tracing.rb +84 -0
- data/lib/ting_yun/instrumentation/mongo.rb +103 -0
- data/lib/ting_yun/instrumentation/mongo2.rb +37 -0
- data/lib/ting_yun/instrumentation/mongo_command_log_subscriber.rb +97 -0
- data/lib/ting_yun/instrumentation/moped.rb +95 -0
- data/lib/ting_yun/instrumentation/net.rb +59 -0
- data/lib/ting_yun/instrumentation/rack.rb +109 -0
- data/lib/ting_yun/instrumentation/rails3/action_controller.rb +63 -0
- data/lib/ting_yun/instrumentation/rails3/action_view.rb +115 -0
- data/lib/ting_yun/instrumentation/rails4/action_controller_subscriber.rb +124 -0
- data/lib/ting_yun/instrumentation/rails4/action_view_subscriber.rb +118 -0
- data/lib/ting_yun/instrumentation/rails4/active_record_subscriber.rb +124 -0
- data/lib/ting_yun/instrumentation/rails_middleware.rb +38 -0
- data/lib/ting_yun/instrumentation/redis.rb +70 -0
- data/lib/ting_yun/instrumentation/support/active_record_helper.rb +178 -0
- data/lib/ting_yun/instrumentation/support/controller_instrumentation.rb +54 -0
- data/lib/ting_yun/instrumentation/support/database.rb +38 -0
- data/lib/ting_yun/instrumentation/support/event_formatter.rb +19 -0
- data/lib/ting_yun/instrumentation/support/evented_subscriber.rb +97 -0
- data/lib/ting_yun/instrumentation/support/external_error.rb +52 -0
- data/lib/ting_yun/instrumentation/support/metric_translator.rb +84 -0
- data/lib/ting_yun/instrumentation/support/mongo_formatter.rb +49 -0
- data/lib/ting_yun/instrumentation/support/parameter_filtering.rb +21 -0
- data/lib/ting_yun/instrumentation/support/queue_time.rb +76 -0
- data/lib/ting_yun/instrumentation/support/transaction_namer.rb +68 -0
- data/lib/ting_yun/instrumentation/thrift.rb +329 -0
- data/lib/ting_yun/logger/agent_logger.rb +196 -0
- data/lib/ting_yun/logger/log_once.rb +38 -0
- data/lib/ting_yun/logger/memory_logger.rb +56 -0
- data/lib/ting_yun/logger/null_logger.rb +31 -0
- data/lib/ting_yun/logger/startup_logger.rb +13 -0
- data/lib/ting_yun/logger.rb +8 -0
- data/lib/ting_yun/metrics/metric_data.rb +86 -0
- data/lib/ting_yun/metrics/metric_spec.rb +89 -0
- data/lib/ting_yun/metrics/stats.rb +158 -0
- data/lib/ting_yun/metrics.rb +12 -0
- data/lib/ting_yun/support/coerce.rb +86 -0
- data/lib/ting_yun/support/collector.rb +29 -0
- data/lib/ting_yun/support/exception.rb +79 -0
- data/lib/ting_yun/support/hash_extensions.rb +25 -0
- data/lib/ting_yun/support/helper.rb +54 -0
- data/lib/ting_yun/support/hostname.rb +13 -0
- data/lib/ting_yun/support/http_clients/uri_util.rb +49 -0
- data/lib/ting_yun/support/language_support.rb +155 -0
- data/lib/ting_yun/support/library_detection.rb +129 -0
- data/lib/ting_yun/support/local_environment.rb +185 -0
- data/lib/ting_yun/support/path.rb +13 -0
- data/lib/ting_yun/support/serialize/encodes.rb +61 -0
- data/lib/ting_yun/support/serialize/encoding_normalizer.rb +84 -0
- data/lib/ting_yun/support/serialize/json_marshaller.rb +73 -0
- data/lib/ting_yun/support/serialize/json_wrapper.rb +78 -0
- data/lib/ting_yun/support/serialize/marshaller.rb +69 -0
- data/lib/ting_yun/support/serialize/ok_json.rb +651 -0
- data/lib/ting_yun/support/system_info.rb +206 -0
- data/lib/ting_yun/support/timer_lib.rb +29 -0
- data/lib/ting_yun/support/version_number.rb +70 -0
- data/lib/ting_yun/ting_yun_service/connection.rb +118 -0
- data/lib/ting_yun/ting_yun_service/http.rb +41 -0
- data/lib/ting_yun/ting_yun_service/request.rb +90 -0
- data/lib/ting_yun/ting_yun_service/ssl.rb +45 -0
- data/lib/ting_yun/ting_yun_service/upload_service.rb +149 -0
- data/lib/ting_yun/ting_yun_service.rb +124 -0
- data/lib/ting_yun/version.rb +17 -0
- data/lib/tingyun_rpm.rb +47 -0
- data/tingyun_rpm.gemspec +60 -0
- metadata +415 -0
@@ -0,0 +1,638 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under Ting Yun's license terms.
|
3
|
+
|
4
|
+
|
5
|
+
require 'forwardable'
|
6
|
+
require 'ting_yun/agent'
|
7
|
+
require 'ting_yun/frameworks'
|
8
|
+
|
9
|
+
module TingYun
|
10
|
+
module Configuration
|
11
|
+
|
12
|
+
# Helper since default Procs are evaluated in the context of this module
|
13
|
+
def self.value_of(key)
|
14
|
+
Proc.new do
|
15
|
+
TingYun::Agent.config[key]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Boolean;
|
20
|
+
end
|
21
|
+
|
22
|
+
class DefaultSource
|
23
|
+
attr_reader :defaults
|
24
|
+
|
25
|
+
extend Forwardable
|
26
|
+
def_delegators :@defaults, :has_key?, :each, :merge, :delete, :keys, :[], :to_hash
|
27
|
+
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@defaults = default_values
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.framework
|
34
|
+
Proc.new {
|
35
|
+
case
|
36
|
+
when defined?(::TingYun::TEST) then
|
37
|
+
:test
|
38
|
+
when defined?(::Merb) && defined?(::Merb::Plugins) then
|
39
|
+
:merb
|
40
|
+
when defined?(::Rails::VERSION)
|
41
|
+
case Rails::VERSION::MAJOR
|
42
|
+
when 0..2
|
43
|
+
:rails
|
44
|
+
when 3
|
45
|
+
:rails3
|
46
|
+
when 4
|
47
|
+
:rails4
|
48
|
+
else
|
49
|
+
::TingYun::Agent.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}"
|
50
|
+
end
|
51
|
+
when defined?(::Sinatra) && defined?(::Sinatra::Base) then
|
52
|
+
:sinatra
|
53
|
+
when defined?(::TingYun::IA) then
|
54
|
+
:external
|
55
|
+
else
|
56
|
+
:ruby
|
57
|
+
end
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.config_path
|
62
|
+
Proc.new {
|
63
|
+
found_path = TingYun::Agent.config[:config_search_paths].detect do |file|
|
64
|
+
File.expand_path(file) if File.exist? file
|
65
|
+
end
|
66
|
+
found_path || ''
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
def default_values
|
72
|
+
result = {}
|
73
|
+
::TingYun::Configuration::DEFAULTS.each do |key, value|
|
74
|
+
result[key] = value[:default]
|
75
|
+
end
|
76
|
+
result
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.dispatcher
|
80
|
+
Proc.new { ::TingYun::Frameworks.framework.local_env.discovered_dispatcher }
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def self.audit_log_path
|
85
|
+
Proc.new {
|
86
|
+
File.join(TingYun::Agent.config[:log_file_path], 'newrelic_audit.log')
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
# On Rubies with string encodings support (1.9.x+), default to always
|
91
|
+
# normalize encodings since it's safest and fast. Without that support
|
92
|
+
# the conversions are too expensive, so only enable if overridden to.
|
93
|
+
def self.normalize_json_string_encodings
|
94
|
+
Proc.new { TingYun::Support::LanguageSupport.supports_string_encodings? }
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
def self.app_name
|
99
|
+
Proc.new { ::TingYun::Frameworks.framework.env }
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.port
|
103
|
+
Proc.new { TingYun::Agent.config[:ssl] ? 443 : 80 }
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.agent_enabled
|
107
|
+
Proc.new {
|
108
|
+
TingYun::Agent.config[:enabled]
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.action_tracer_action_threshold
|
113
|
+
Proc.new { TingYun::Agent.config[:apdex_t] * 4 }
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.config_search_paths
|
117
|
+
Proc.new {
|
118
|
+
paths = [
|
119
|
+
File.join("config", "tingyun.yml"),
|
120
|
+
File.join("tingyun.yml")
|
121
|
+
]
|
122
|
+
|
123
|
+
if ::TingYun::Frameworks.framework.root
|
124
|
+
paths << File.join(::TingYun::Frameworks.framework.root, "config", "tingyun.yml")
|
125
|
+
paths << File.join(::TingYun::Frameworks.framework.root, "tingyun.yml")
|
126
|
+
end
|
127
|
+
|
128
|
+
if ENV["HOME"]
|
129
|
+
paths << File.join(ENV["HOME"], ".tingyun", "tingyun.yml")
|
130
|
+
paths << File.join(ENV["HOME"], "tingyun.yml")
|
131
|
+
end
|
132
|
+
|
133
|
+
# If we're packaged for warbler, we can tell from GEM_HOME
|
134
|
+
if ENV["GEM_HOME"] && ENV["GEM_HOME"].end_with?(".jar!")
|
135
|
+
app_name = File.basename(ENV["GEM_HOME"], ".jar!")
|
136
|
+
paths << File.join(ENV["GEM_HOME"], app_name, "config", "tingyun.yml")
|
137
|
+
end
|
138
|
+
|
139
|
+
paths
|
140
|
+
}
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
DEFAULTS = {
|
145
|
+
:license_key => {
|
146
|
+
:default => '',
|
147
|
+
:public => true,
|
148
|
+
:type => String,
|
149
|
+
:allowed_from_server => false,
|
150
|
+
:description => 'Your Ting Yun <a href="">license key</a>.'
|
151
|
+
},
|
152
|
+
:enabled => {
|
153
|
+
:default => true,
|
154
|
+
:public => true,
|
155
|
+
:type => Boolean,
|
156
|
+
:allowed_from_server => true,
|
157
|
+
:description => 'Enable or disable the agent.'
|
158
|
+
},
|
159
|
+
:'nbs.agent_enabled' => {
|
160
|
+
:default => DefaultSource.agent_enabled,
|
161
|
+
:public => true,
|
162
|
+
:type => Boolean,
|
163
|
+
:allowed_from_server => true,
|
164
|
+
:description => 'Enable or disable the agent.'
|
165
|
+
},
|
166
|
+
:app_name => {
|
167
|
+
:default => DefaultSource.app_name,
|
168
|
+
:public => true,
|
169
|
+
:type => String,
|
170
|
+
:allowed_from_server => false,
|
171
|
+
:description => 'Semicolon-delimited list of Naming your application.'
|
172
|
+
},
|
173
|
+
:'nbs.auto_app_naming' => {
|
174
|
+
:default => false,
|
175
|
+
:public => true,
|
176
|
+
:type => Boolean,
|
177
|
+
:allowed_from_server => true,
|
178
|
+
:description => 'Enable or disable to identify the application name'
|
179
|
+
},
|
180
|
+
:'nbs.urls_captured' => {
|
181
|
+
:default => '',
|
182
|
+
:public => true,
|
183
|
+
:type => String,
|
184
|
+
:allowed_from_server => true,
|
185
|
+
:description => '换行符分隔的URL正则表达式列表,缺省为采集全部URL。若指定此参数,则仅采集列表中的URL,忽略其它用户不关心URL '
|
186
|
+
},
|
187
|
+
:'nbs.ignored_params' => {
|
188
|
+
:default => '',
|
189
|
+
:public => true,
|
190
|
+
:type => String,
|
191
|
+
:allowed_from_server => true,
|
192
|
+
:description => 'Enable or disable Specifies HTTP request parameters '
|
193
|
+
},
|
194
|
+
:"nbs.error_collector.enabled" => {
|
195
|
+
:default => true,
|
196
|
+
:public => true,
|
197
|
+
:type => Boolean,
|
198
|
+
:allowed_from_server => true,
|
199
|
+
:description => 'Enable or disable recording of traced errors and error count metrics.'
|
200
|
+
},
|
201
|
+
:"nbs.error_collector.ignored_status_codes" => {
|
202
|
+
:default => '',
|
203
|
+
:public => true,
|
204
|
+
:type => String,
|
205
|
+
:allowed_from_server => true,
|
206
|
+
:description => 'Enable or disable Specifies HTTP response code '
|
207
|
+
},
|
208
|
+
:"nbs.error_collector.ignored_errors" => {
|
209
|
+
:default => '',
|
210
|
+
:public => true,
|
211
|
+
:type => String,
|
212
|
+
:allowed_from_server => true,
|
213
|
+
:description => ''
|
214
|
+
},
|
215
|
+
:"nbs.error_collector.record_db_errors" => {
|
216
|
+
:default => true,
|
217
|
+
:public => true,
|
218
|
+
:type => Boolean,
|
219
|
+
:allowed_from_server => true,
|
220
|
+
:description => ' '
|
221
|
+
},
|
222
|
+
:'nbs.action_tracer.enabled' => {
|
223
|
+
:default => true,
|
224
|
+
:public => true,
|
225
|
+
:type => Boolean,
|
226
|
+
:allowed_from_server => true,
|
227
|
+
:description => '是否启用Web事务跟踪'
|
228
|
+
},
|
229
|
+
:'nbs.action_tracer.action_threshold' => {
|
230
|
+
:default => DefaultSource.action_tracer_action_threshold,
|
231
|
+
:allow_nil => true,
|
232
|
+
:public => true,
|
233
|
+
:type => Fixnum,
|
234
|
+
:allowed_from_server => true,
|
235
|
+
:description => 'The agent will collect traces for action that exceed this time threshold (in millisecond). Specify a int value or <code><a href="">apdex_f</a></code>.'
|
236
|
+
},
|
237
|
+
:'nbs.action_tracer.record_sql' => {
|
238
|
+
:default => 'obfuscated',
|
239
|
+
:public => true,
|
240
|
+
:type => String,
|
241
|
+
:allowed_from_server => true,
|
242
|
+
:description => 'Obfuscation level for SQL queries reported in action trace nodes. Valid options are <code>obfuscated</code>, <code>raw</code>, <code>off</code>.'
|
243
|
+
},
|
244
|
+
:'nbs.action_tracer.slow_sql' => {
|
245
|
+
:default => true,
|
246
|
+
:public => true,
|
247
|
+
:type => Boolean,
|
248
|
+
:allowed_from_server => true,
|
249
|
+
:description => 'Enable or disable collection of slow SQL queries.'
|
250
|
+
},
|
251
|
+
:'nbs.action_tracer.slow_sql_threshold' => {
|
252
|
+
:default => 500,
|
253
|
+
:public => true,
|
254
|
+
:type => Fixnum,
|
255
|
+
:allowed_from_server => true,
|
256
|
+
:description => 'The agent will collect traces for slow_sql that exceed this time threshold (in millisecond). Specify a int value or <code><a href="">apdex_f</a></code>.'
|
257
|
+
},
|
258
|
+
:'nbs.action_tracer.explain_enabled' => {
|
259
|
+
:default => true,
|
260
|
+
:public => true,
|
261
|
+
:type => Boolean,
|
262
|
+
:allowed_from_server => true,
|
263
|
+
:description => 'Enable or disable the collection of explain plans in action traces. This setting will also apply to explain plans in Slow SQL traces if slow_sql.explain_enabled is not set separately.'
|
264
|
+
},
|
265
|
+
:'nbs.action_tracer.explain_threshold' => {
|
266
|
+
:default => 500,
|
267
|
+
:public => true,
|
268
|
+
:type => Fixnum,
|
269
|
+
:allowed_from_server => true,
|
270
|
+
:description => 'Threshold (in millisecond) above which the agent will collect explain plans. Relevant only when <code><a href="">explain_enabled</a></code> is true.'
|
271
|
+
},
|
272
|
+
:'nbs.transaction_tracer.enabled' => {
|
273
|
+
:default => true,
|
274
|
+
:public => true,
|
275
|
+
:type => Boolean,
|
276
|
+
:allowed_from_server => true,
|
277
|
+
:description => '启用跨应用追踪'
|
278
|
+
},
|
279
|
+
:'nbs.action_tracer.nbsua' => {
|
280
|
+
:default => false,
|
281
|
+
:public => true,
|
282
|
+
:type => Boolean,
|
283
|
+
:allowed_from_server => true,
|
284
|
+
:description => 'Enable or disable to trace nbs web request'
|
285
|
+
},
|
286
|
+
:'nbs.rum.enabled' => {
|
287
|
+
:default => false,
|
288
|
+
:public => false,
|
289
|
+
:type => Boolean,
|
290
|
+
:allowed_from_server => true,
|
291
|
+
:description => 'Enable or disable page load timing (sometimes referred to as real user monitoring or RUM).'
|
292
|
+
},
|
293
|
+
:'nbs.rum.script' => {
|
294
|
+
:default => nil,
|
295
|
+
:allow_nil => true,
|
296
|
+
:public => false,
|
297
|
+
:type => String,
|
298
|
+
:allowed_from_server => true,
|
299
|
+
:description => 'RUM Script URI'
|
300
|
+
},
|
301
|
+
:'nbs.rum.sample_ratio' => {
|
302
|
+
:default => 1,
|
303
|
+
:public => true,
|
304
|
+
:type => Fixnum,
|
305
|
+
:allowed_from_server => true,
|
306
|
+
:description => 'RUM per'
|
307
|
+
},
|
308
|
+
:'nbs.action_tracer.obfuscated_sql_fields' => {
|
309
|
+
:default => '',
|
310
|
+
:allow_nil => true,
|
311
|
+
:public => false,
|
312
|
+
:type => String,
|
313
|
+
:allowed_from_server => true,
|
314
|
+
:description => ''
|
315
|
+
},
|
316
|
+
:'nbs.action_tracer.action_name_functions' => {
|
317
|
+
:default => '',
|
318
|
+
:allow_nil => true,
|
319
|
+
:public => false,
|
320
|
+
:type => String,
|
321
|
+
:allowed_from_server => true,
|
322
|
+
:description => ''
|
323
|
+
},
|
324
|
+
:'nbs.action_tracer.remove_trailing_path' => {
|
325
|
+
:default => false,
|
326
|
+
:public => false,
|
327
|
+
:type => Boolean,
|
328
|
+
:allowed_from_server => true,
|
329
|
+
:description => ''
|
330
|
+
},
|
331
|
+
:'nbs.action_tracer.stack_trace_threshold' => {
|
332
|
+
:default => 500,
|
333
|
+
:public => true,
|
334
|
+
:type => Fixnum,
|
335
|
+
:allowed_from_server => true,
|
336
|
+
:description => 'Threshold (in millisecond) above which the agent will collect stack_trace.'
|
337
|
+
},
|
338
|
+
:'nbs.external_url_params_captured' => {
|
339
|
+
:default => '',
|
340
|
+
:public => true,
|
341
|
+
:type => String,
|
342
|
+
:allowed_from_server => true,
|
343
|
+
:description => 'Enable or disable Specifies External request parameters '
|
344
|
+
},
|
345
|
+
:'nbs.web_action_uri_params_captured' => {
|
346
|
+
:default => '',
|
347
|
+
:public => true,
|
348
|
+
:type => String,
|
349
|
+
:allowed_from_server => true,
|
350
|
+
:description => 'Enable or disable Specifies WebAction request parameters '
|
351
|
+
},
|
352
|
+
:agent_log_file_path => {
|
353
|
+
:default => 'log/',
|
354
|
+
:public => true,
|
355
|
+
:type => String,
|
356
|
+
:allowed_from_server => false,
|
357
|
+
:description => 'Specifies a path to the audit log file '
|
358
|
+
},
|
359
|
+
:agent_log_file_name => {
|
360
|
+
:default => 'tingyun_agent.log',
|
361
|
+
:public => true,
|
362
|
+
:type => String,
|
363
|
+
:allowed_from_server => false,
|
364
|
+
:description => 'log filename.'
|
365
|
+
},
|
366
|
+
:config_search_paths => {
|
367
|
+
:default => DefaultSource.config_search_paths,
|
368
|
+
:public => false,
|
369
|
+
:type => Array,
|
370
|
+
:allowed_from_server => false,
|
371
|
+
:description => "An array of candidate locations for the agent's configuration file."
|
372
|
+
},
|
373
|
+
:dispatcher => {
|
374
|
+
:default => DefaultSource.dispatcher,
|
375
|
+
:public => false,
|
376
|
+
:type => Symbol,
|
377
|
+
:allowed_from_server => false,
|
378
|
+
:description => 'Autodetected application component that reports metrics to Ting YUN.'
|
379
|
+
},
|
380
|
+
:framework => {
|
381
|
+
:default => DefaultSource.framework,
|
382
|
+
:public => false,
|
383
|
+
:type => Symbol,
|
384
|
+
:allowed_from_server => false,
|
385
|
+
:description => 'Autodetected application framework used to enable framework-specific functionality.'
|
386
|
+
},
|
387
|
+
:monitor_mode => {
|
388
|
+
:default => true,
|
389
|
+
:public => true,
|
390
|
+
:type => Boolean,
|
391
|
+
:allowed_from_server => false,
|
392
|
+
:description => 'Enable or disable the transmission of data to the collector.'
|
393
|
+
},
|
394
|
+
:'nbs.audit_mode' => {
|
395
|
+
:default => false,
|
396
|
+
:public => true,
|
397
|
+
:type => Boolean,
|
398
|
+
:allowed_from_server => false,
|
399
|
+
:description => 'Enable or disable to log the transmission-date for developer'
|
400
|
+
},
|
401
|
+
:agent_log_level => {
|
402
|
+
:default => 'info',
|
403
|
+
:public => true,
|
404
|
+
:type => String,
|
405
|
+
:allowed_from_server => false,
|
406
|
+
:description => 'Log level for agent logging: fatal, error, warn, info, debug.'
|
407
|
+
},
|
408
|
+
:proxy_host => {
|
409
|
+
:default => nil,
|
410
|
+
:allow_nil => true,
|
411
|
+
:public => true,
|
412
|
+
:type => String,
|
413
|
+
:allowed_from_server => false,
|
414
|
+
:description => 'Defines a host for communicating with Ting Yun via a proxy server.'
|
415
|
+
},
|
416
|
+
:proxy_port => {
|
417
|
+
:default => 8080,
|
418
|
+
:allow_nil => true,
|
419
|
+
:public => true,
|
420
|
+
:type => Fixnum,
|
421
|
+
:allowed_from_server => false,
|
422
|
+
:description => 'Defines a port for communicating with Ting Yun via a proxy server.'
|
423
|
+
},
|
424
|
+
:proxy_user => {
|
425
|
+
:default => nil,
|
426
|
+
:allow_nil => true,
|
427
|
+
:public => true,
|
428
|
+
:type => String,
|
429
|
+
:allowed_from_server => false,
|
430
|
+
:description => 'Defines a user for communicating with Ting Yun via a proxy server.'
|
431
|
+
},
|
432
|
+
:proxy_password => {
|
433
|
+
:default => nil,
|
434
|
+
:allow_nil => true,
|
435
|
+
:public => true,
|
436
|
+
:type => String,
|
437
|
+
:allowed_from_server => false,
|
438
|
+
:exclude_from_reported_settings => true,
|
439
|
+
:description => 'Defines a password for communicating with Ting Yun via a proxy server.'
|
440
|
+
},
|
441
|
+
:host => {
|
442
|
+
:default => 'redirect.networkbench.com',
|
443
|
+
:public => false,
|
444
|
+
:type => String,
|
445
|
+
:allowed_from_server => false,
|
446
|
+
:description => "URI for the Ting Yun data collection service."
|
447
|
+
},
|
448
|
+
:port => {
|
449
|
+
:default => DefaultSource.port,
|
450
|
+
:allow_nil => true,
|
451
|
+
:public => false,
|
452
|
+
:type => Fixnum,
|
453
|
+
:allowed_from_server => false,
|
454
|
+
:description => 'Port for the Ting Yun data collection service.'
|
455
|
+
},
|
456
|
+
:api_host => {
|
457
|
+
:default => 'redirect.networkbench.com',
|
458
|
+
:public => false,
|
459
|
+
:type => String,
|
460
|
+
:allowed_from_server => false,
|
461
|
+
:description => 'API host for Ting Yun.'
|
462
|
+
},
|
463
|
+
:api_port => {
|
464
|
+
:default => value_of(:port),
|
465
|
+
:public => false,
|
466
|
+
:type => Fixnum,
|
467
|
+
:allowed_from_server => false,
|
468
|
+
:description => 'Port for the New Relic API host.'
|
469
|
+
},
|
470
|
+
:disable_middleware_instrumentation => {
|
471
|
+
:default => false,
|
472
|
+
:public => true,
|
473
|
+
:type => Boolean,
|
474
|
+
:allowed_from_server => false,
|
475
|
+
:description => 'Defines whether the agent will wrap third-party middlewares in instrumentation (regardless of whether they are installed via Rack::Builder or Rails).'
|
476
|
+
},
|
477
|
+
:disable_rack => {
|
478
|
+
:default => false,
|
479
|
+
:public => true,
|
480
|
+
:type => Boolean,
|
481
|
+
:dynamic_name => true,
|
482
|
+
:allowed_from_server => false,
|
483
|
+
:description => 'Defines whether the agent will hook into Rack::Builder\'s <code>to_app</code> method to find gems to instrument during application startup.'
|
484
|
+
},
|
485
|
+
:disable_view_instrumentation => {
|
486
|
+
:default => false,
|
487
|
+
:public => true,
|
488
|
+
:type => Boolean,
|
489
|
+
:allowed_from_server => false,
|
490
|
+
:description => 'Enable or disable view instrumentation.'
|
491
|
+
},
|
492
|
+
:keep_retrying => {
|
493
|
+
:default => true,
|
494
|
+
:public => false,
|
495
|
+
:type => Boolean,
|
496
|
+
:deprecated => true,
|
497
|
+
:allowed_from_server => false,
|
498
|
+
:description => 'Enable or disable retrying failed connections to the ting yun data collection service.'
|
499
|
+
},
|
500
|
+
:force_reconnect => {
|
501
|
+
:default => true,
|
502
|
+
:public => false,
|
503
|
+
:type => Boolean,
|
504
|
+
:allowed_from_server => false,
|
505
|
+
:description => 'Force a new connection to the server before running the worker loop. Creates a separate agent run and is recorded as a separate instance by the ting yun data collection service.'
|
506
|
+
},
|
507
|
+
:aggressive_keepalive => {
|
508
|
+
:default => true,
|
509
|
+
:public => false,
|
510
|
+
:type => Boolean,
|
511
|
+
:allowed_from_server => false,
|
512
|
+
:description => 'If true, attempt to keep the TCP connection to the collector alive between harvests.'
|
513
|
+
},
|
514
|
+
:keep_alive_timeout => {
|
515
|
+
:default => 60,
|
516
|
+
:public => false,
|
517
|
+
:type => Fixnum,
|
518
|
+
:allowed_from_server => false,
|
519
|
+
:description => 'Timeout for keep alive on TCP connection to collector if supported by Ruby version. Only used in conjunction when aggressive_keepalive is enabled.'
|
520
|
+
},
|
521
|
+
:ca_bundle_path => {
|
522
|
+
:default => nil,
|
523
|
+
:allow_nil => true,
|
524
|
+
:public => true,
|
525
|
+
:type => String,
|
526
|
+
:allowed_from_server => false,
|
527
|
+
:description => "Manual override for the path to your local CA bundle. This CA bundle will be used to validate the SSL certificate presented by Ting Yun's data collection service."
|
528
|
+
},
|
529
|
+
:ssl => {
|
530
|
+
:default => true,
|
531
|
+
:allow_nil => true,
|
532
|
+
:public => true,
|
533
|
+
:type => Boolean,
|
534
|
+
:allowed_from_server => false,
|
535
|
+
:description => 'Enable or disable SSL for transmissions to the Ting Yun'
|
536
|
+
},
|
537
|
+
:timeout => {
|
538
|
+
:default => 2 * 60, # 2 minutes
|
539
|
+
:public => true,
|
540
|
+
:type => Fixnum,
|
541
|
+
:allowed_from_server => false,
|
542
|
+
:description => 'Maximum number of seconds to attempt to contact the collector.'
|
543
|
+
},
|
544
|
+
:post_size_limit => {
|
545
|
+
:default => 2 * 1024 * 1024, # 2MB
|
546
|
+
:public => false,
|
547
|
+
:type => Fixnum,
|
548
|
+
:allowed_from_server => false,
|
549
|
+
:description => 'Maximum number of bytes to send to the data collection service.'
|
550
|
+
},
|
551
|
+
:data_report_period => {
|
552
|
+
:default => 60,
|
553
|
+
:public => false,
|
554
|
+
:type => Fixnum,
|
555
|
+
:allowed_from_server => false,
|
556
|
+
:description => 'Number of seconds betwixt connections to the Ting Yun data collection service.'
|
557
|
+
},
|
558
|
+
:'action_tracer.log_sql' => {
|
559
|
+
:default => false,
|
560
|
+
:public => true,
|
561
|
+
:type => Boolean,
|
562
|
+
:allowed_from_server => false,
|
563
|
+
:description => 'Enable or disable(write into log file) collection of SQL queries.'
|
564
|
+
},
|
565
|
+
:daemon_debug => {
|
566
|
+
:default => false,
|
567
|
+
:public => true,
|
568
|
+
:type => Boolean,
|
569
|
+
:allowed_from_server => true,
|
570
|
+
:description => 'Enable or disable(result-json contains key-id) debug mode'
|
571
|
+
},
|
572
|
+
:urls_captured => {
|
573
|
+
:default => '',
|
574
|
+
:public => true,
|
575
|
+
:type => String,
|
576
|
+
:allowed_from_server => false,
|
577
|
+
:description => 'Enable or disable Specifies url'
|
578
|
+
},
|
579
|
+
:'nbs.auto_action_naming' => {
|
580
|
+
:default => true,
|
581
|
+
:public => true,
|
582
|
+
:type => Boolean,
|
583
|
+
:allowed_from_server => true,
|
584
|
+
:description => 'Enable or disable to use default name '
|
585
|
+
},
|
586
|
+
:capture_params => {
|
587
|
+
:default => false,
|
588
|
+
:public => true,
|
589
|
+
:type => Boolean,
|
590
|
+
:allowed_from_server => false,
|
591
|
+
:description => 'Enable or disable the capture of HTTP request parameters to be attached to transaction traces and traced errors.'
|
592
|
+
},
|
593
|
+
:config_path => {
|
594
|
+
:default => DefaultSource.config_path,
|
595
|
+
:public => true,
|
596
|
+
:type => String,
|
597
|
+
:allowed_from_server => false,
|
598
|
+
:description => 'Path to <b>tingyun.yml</b>. When omitted the agent will check (in order) <b>config/tingyun.yml</b>, <b>tingyun.yml</b>, <b>$HOME/.tingyun/tingyun.yml</b> and <b>$HOME/tingyun.yml</b>.'
|
599
|
+
},
|
600
|
+
:apdex_t => {
|
601
|
+
:default => 500,
|
602
|
+
:public => true,
|
603
|
+
:type => Fixnum,
|
604
|
+
:allowed_from_server => true,
|
605
|
+
:deprecated => true,
|
606
|
+
:description => 'millisecond'
|
607
|
+
},
|
608
|
+
:'transaction_tracer.limit_segments' => {
|
609
|
+
:default => 2000,
|
610
|
+
:public => true,
|
611
|
+
:type => Fixnum,
|
612
|
+
:allowed_from_server => true,
|
613
|
+
:description => 'Maximum number of transaction trace nodes to record in a single transaction trace.'
|
614
|
+
},
|
615
|
+
:send_environment_info => {
|
616
|
+
:default => true,
|
617
|
+
:public => false,
|
618
|
+
:type => Boolean,
|
619
|
+
:allowed_from_server => false,
|
620
|
+
:description => 'Enable or disable transmission of application environment information to the Ting Yun data collection service.'
|
621
|
+
},
|
622
|
+
:normalize_json_string_encodings => {
|
623
|
+
:default => DefaultSource.normalize_json_string_encodings,
|
624
|
+
:public => false,
|
625
|
+
:type => Boolean,
|
626
|
+
:allowed_from_server => false,
|
627
|
+
:description => 'Controls whether to normalize string encodings prior to serializing data for the collector to JSON.'
|
628
|
+
},
|
629
|
+
:tingyunIdSecret => {
|
630
|
+
:default => '',
|
631
|
+
:public => true,
|
632
|
+
:type => String,
|
633
|
+
:allowed_from_server => true,
|
634
|
+
:description => '跨应用追踪加密ID'
|
635
|
+
}
|
636
|
+
}.freeze
|
637
|
+
end
|
638
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under Ting Yun's license terms.
|
3
|
+
|
4
|
+
module TingYun
|
5
|
+
module Configuration
|
6
|
+
class DottedHash < ::Hash
|
7
|
+
|
8
|
+
def self.symbolize(hash)
|
9
|
+
hash.keys.each do |key|
|
10
|
+
hash[key.to_sym] = hash.delete(key)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(hash, keep_nesting = false)
|
15
|
+
self.merge!(hash) if keep_nesting
|
16
|
+
self.merge!(dot_flattened(hash))
|
17
|
+
|
18
|
+
DottedHash.symbolize(self)
|
19
|
+
end
|
20
|
+
|
21
|
+
def inspect
|
22
|
+
"#<#{self.class.name}:#{object_id} #{super}>"
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_hash
|
26
|
+
{}.replace(self)
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
# turns {'a' => {'b' => 'c'}} into {'a.b' => 'c'}
|
32
|
+
def dot_flattened(nested_hash, names=[], result={})
|
33
|
+
nested_hash.each do |key, val|
|
34
|
+
next if val == nil
|
35
|
+
if val.respond_to?(:has_key?)
|
36
|
+
dot_flattened(val, names + [key], result)
|
37
|
+
else
|
38
|
+
result[(names + [key]).join('.')] = val
|
39
|
+
end
|
40
|
+
end
|
41
|
+
result
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|