tingyun_rpm 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ting_yun/agent/transaction/trace_node.rb +4 -0
- data/lib/ting_yun/agent/transaction/transaction_state.rb +3 -1
- data/lib/ting_yun/agent/transaction/transaction_timings.rb +1 -1
- data/lib/ting_yun/configuration/default_source.rb +1 -1
- data/lib/ting_yun/instrumentation/bunny.rb +44 -16
- data/lib/ting_yun/instrumentation/kafka.rb +3 -3
- data/lib/ting_yun/instrumentation/support/external_helper.rb +2 -1
- data/lib/ting_yun/ting_yun_service/upload_service.rb +1 -1
- data/lib/ting_yun/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50bb695bb83ad9675c4a47086f7f2a5e326207a9
|
4
|
+
data.tar.gz: 112c143fc64d673606db5703acf36f3c622beaf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffd6c131b719fd67ce6738b7c100966bff3fc11b71af209288497461d913601e8f0f7c21f12361564263226eec68c1b72f29dfed0be94bbe0ad054eaf1389ed9
|
7
|
+
data.tar.gz: bcc3e5c521ce1207d6c9b6d37ba4fd3f7d11dd0f3d7efefea03553724db8d075aad32dc4f307a2343e8a44acbc995630cdb9a456c2144414131ac481ad5e2ac7
|
@@ -64,7 +64,6 @@ module TingYun
|
|
64
64
|
@sql_sampler_transaction_data = nil
|
65
65
|
@thrift_return_data = nil
|
66
66
|
@timings = nil
|
67
|
-
@client_req_id = nil
|
68
67
|
end
|
69
68
|
|
70
69
|
# TT's and SQL
|
@@ -169,6 +168,9 @@ module TingYun
|
|
169
168
|
current_transaction.attributes.merge_request_parameters(hash)
|
170
169
|
end
|
171
170
|
|
171
|
+
def add_current_node_params(hash)
|
172
|
+
transaction_sample_builder.current_node.merge hash if transaction_sample_builder
|
173
|
+
end
|
172
174
|
end
|
173
175
|
end
|
174
176
|
end
|
@@ -54,7 +54,7 @@ module TingYun
|
|
54
54
|
# Helpers
|
55
55
|
|
56
56
|
def slow_action_tracer?
|
57
|
-
return
|
57
|
+
return app_time_in_millis > TingYun::Agent.config[:'nbs.action_tracer.action_threshold']
|
58
58
|
end
|
59
59
|
|
60
60
|
def convert_to_milliseconds(value_in_seconds)
|
@@ -2,10 +2,14 @@ TingYun::Support::LibraryDetection.defer do
|
|
2
2
|
named :bunny
|
3
3
|
|
4
4
|
depends_on do
|
5
|
-
defined?(::Bunny::VERSION)
|
5
|
+
defined?(::Bunny::VERSION)
|
6
|
+
end
|
7
|
+
depends_on do
|
8
|
+
!::TingYun::Agent.config[:disable_rabbitmq]
|
6
9
|
end
|
7
10
|
|
8
11
|
|
12
|
+
|
9
13
|
executes do
|
10
14
|
TingYun::Agent.logger.info 'Installing bunny(for rabbitmq) Instrumentation'
|
11
15
|
require 'ting_yun/support/helper'
|
@@ -22,17 +26,23 @@ TingYun::Support::LibraryDetection.defer do
|
|
22
26
|
state = TingYun::Agent::TransactionState.tl_get
|
23
27
|
return publish_without_tingyun(payload, opts) unless state.execution_traced?
|
24
28
|
queue_name = opts[:routing_key]
|
25
|
-
|
26
|
-
opts[:headers][:TingyunID] = create_tingyun_id("mq")
|
29
|
+
|
27
30
|
metric_name = "Message RabbitMQ/#{@channel.connection.host}:#{@channel.connection.port}%2F"
|
28
31
|
if name.empty?
|
29
|
-
|
32
|
+
if queue_name.start_with?("amq.")
|
33
|
+
metric_name << "Queue%2FTemp/Produce"
|
34
|
+
elsif queue_name.include?(".")
|
35
|
+
metric_name << "Topic%2F#{queue_name}/Produce"
|
36
|
+
else
|
37
|
+
metric_name << "Queue%2F#{queue_name}/Produce"
|
38
|
+
end
|
30
39
|
else
|
31
40
|
metric_name << "Exchange%2F#{name}/Produce"
|
32
41
|
end
|
33
|
-
|
34
42
|
summary_metrics = TingYun::Agent::Datastore::MetricHelper.metrics_for_message('RabbitMQ', "#{@channel.connection.host}:#{@channel.connection.port}", 'Produce')
|
35
43
|
TingYun::Agent::Transaction.wrap(state, metric_name , :RabbitMq, {}, summary_metrics) do
|
44
|
+
opts[:headers] = {} unless opts[:headers]
|
45
|
+
opts[:headers]["TingyunID"] = create_tingyun_id("mq") if TingYun::Agent.config[:'nbs.transaction_tracer.enabled']
|
36
46
|
TingYun::Agent.record_metric("#{metric_name}%2FByte",payload.bytesize) if payload
|
37
47
|
publish_without_tingyun(payload, opts)
|
38
48
|
end
|
@@ -53,30 +63,47 @@ TingYun::Support::LibraryDetection.defer do
|
|
53
63
|
|
54
64
|
::Bunny::Consumer.class_eval do
|
55
65
|
|
56
|
-
if public_method_defined?(:call)
|
66
|
+
if public_method_defined?(:call)
|
57
67
|
|
58
68
|
def call_with_tingyun(*args)
|
69
|
+
return call_without_tingyun(*args) unless TingYun::Agent.config[:'nbs.mq.enabled']
|
59
70
|
begin
|
60
|
-
|
71
|
+
|
72
|
+
headers = args[1][:headers].clone rescue {}
|
73
|
+
|
74
|
+
|
61
75
|
tingyun_id_secret = headers["TingyunID"]
|
76
|
+
|
62
77
|
state = TingYun::Agent::TransactionState.tl_get
|
63
|
-
|
64
|
-
|
65
|
-
|
78
|
+
|
79
|
+
if queue_name.start_with?("amq.")
|
80
|
+
metric_name = "#{@channel.connection.host}:#{@channel.connection.port}%2FQueue%2FTemp/Consume"
|
81
|
+
transaction_name = "WebAction/RabbitMQ/Queue%2FTemp"
|
82
|
+
elsif queue_name.include?(".")
|
83
|
+
metric_name = "#{@channel.connection.host}:#{@channel.connection.port}%2FTopic%2F#{queue_name}/Consume"
|
84
|
+
transaction_name = "WebAction/RabbitMQ/Topic%2F#{queue_name}"
|
85
|
+
else
|
86
|
+
metric_name = "#{@channel.connection.host}:#{@channel.connection.port}%2FQueue%2F#{queue_name}/Consume"
|
87
|
+
transaction_name = "WebAction/RabbitMQ/Queue%2F#{queue_name}"
|
88
|
+
end
|
89
|
+
|
66
90
|
state.save_referring_transaction_info(tingyun_id_secret.split(';')) if cross_app_enabled?(tingyun_id_secret)
|
91
|
+
TingYun::Agent::Transaction.start(state,:message, { :transaction_name => transaction_name})
|
92
|
+
summary_metrics = TingYun::Agent::Datastore::MetricHelper.metrics_for_message('RabbitMQ', "#{@channel.connection.host}:#{@channel.connection.port}", 'Consume')
|
67
93
|
TingYun::Agent::Transaction.wrap(state, "Message RabbitMQ/#{metric_name}" , :RabbitMq, {}, summary_metrics) do
|
68
|
-
TingYun::Agent.record_metric("
|
69
|
-
TingYun::Agent.record_metric("Message RabbitMQ/#{metric_name}%2FWait", TingYun::Helper.time_to_millis(Time.now)-state.externel_time.to_i) rescue
|
94
|
+
TingYun::Agent.record_metric("MessageRabbitMQ/#{metric_name}%2FByte",args[2].bytesize) if args[2]
|
95
|
+
TingYun::Agent.record_metric("Message RabbitMQ/#{metric_name}%2FWait", TingYun::Helper.time_to_millis(Time.now)-state.externel_time.to_i) rescue 0
|
70
96
|
if state.current_transaction
|
71
97
|
state.add_custom_params("message.byte",args[2].bytesize)
|
72
98
|
state.add_custom_params("message.wait",TingYun::Helper.time_to_millis(Time.now)-state.externel_time.to_i)
|
73
99
|
state.add_custom_params("message.routingkey",queue_name)
|
100
|
+
state.current_transaction.attributes.add_agent_attribute(:tx_id, state.client_transaction_id)
|
74
101
|
headers.delete("TingyunID")
|
75
102
|
state.merge_request_parameters(headers)
|
76
103
|
end
|
77
104
|
call_without_tingyun(*args)
|
78
|
-
state.current_transaction.attributes.add_agent_attribute(:entryTrace, build_payload(state)) if state.same_account?
|
79
105
|
end
|
106
|
+
state.current_transaction.attributes.add_agent_attribute(:entryTrace, build_payload(state)) if state.same_account? && TingYun::Agent.config[:'nbs.transaction_tracer.enabled']
|
80
107
|
rescue => e
|
81
108
|
TingYun::Agent.logger.error("Failed to Bunny call_with_tingyun : ", e)
|
82
109
|
call_without_tingyun(*args)
|
@@ -91,13 +118,13 @@ TingYun::Support::LibraryDetection.defer do
|
|
91
118
|
end
|
92
119
|
|
93
120
|
def cross_app_enabled?(tingyun_id_secret)
|
94
|
-
tingyun_id_secret && ::TingYun::Agent.config[:tingyunIdSecret]
|
121
|
+
tingyun_id_secret && ::TingYun::Agent.config[:tingyunIdSecret] && TingYun::Agent.config[:'nbs.transaction_tracer.enabled']
|
95
122
|
end
|
96
123
|
|
97
124
|
def build_payload(state)
|
98
125
|
timings = state.timings
|
99
126
|
payload = {
|
100
|
-
:applicationId =>
|
127
|
+
:applicationId => state.client_tingyun_id_secret.split('|')[1],
|
101
128
|
:transactionId => state.client_transaction_id,
|
102
129
|
:externalId => state.extenel_req_id,
|
103
130
|
:time => {
|
@@ -116,8 +143,9 @@ TingYun::Support::LibraryDetection.defer do
|
|
116
143
|
end
|
117
144
|
|
118
145
|
::Bunny::Channel.class_eval do
|
119
|
-
if public_method_defined?(:basic_get)
|
146
|
+
if public_method_defined?(:basic_get)
|
120
147
|
def basic_get_with_tingyun(*args)
|
148
|
+
return basic_get_without_tingyun(*args) unless TingYun::Agent.config[:'nbs.mq.enabled']
|
121
149
|
begin
|
122
150
|
state = TingYun::Agent::TransactionState.tl_get
|
123
151
|
metric_name = "#{@connection.host}:#{@connection.port}%2FQueue%2F#{args[0]}/Consume"
|
@@ -78,7 +78,7 @@ TingYun::Support::LibraryDetection.defer do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
if public_method_defined?(:each_message)
|
81
|
+
if public_method_defined?(:each_message)
|
82
82
|
alias_method :each_message_without_tingyun, :each_message
|
83
83
|
|
84
84
|
def each_message(*args, **options, &block)
|
@@ -108,7 +108,7 @@ TingYun::Support::LibraryDetection.defer do
|
|
108
108
|
|
109
109
|
if defined?(::Kafka::Consumer)
|
110
110
|
Kafka::Consumer.class_eval do
|
111
|
-
if public_method_defined?(:each_message)
|
111
|
+
if public_method_defined?(:each_message)
|
112
112
|
alias_method :each_message_without_tingyun, :each_message
|
113
113
|
def each_message(*args, **options, &block)
|
114
114
|
wrap_block = Proc.new do |message|
|
@@ -138,7 +138,7 @@ TingYun::Support::LibraryDetection.defer do
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
if public_method_defined?(:each_batch)
|
141
|
+
if public_method_defined?(:each_batch)
|
142
142
|
alias_method :each_batch_without_tingyun, :each_batch
|
143
143
|
def each_batch(*args, **options, &block)
|
144
144
|
wrap_block = Proc.new do |batch|
|
@@ -8,9 +8,10 @@ module TingYun
|
|
8
8
|
def create_tingyun_id(protocol)
|
9
9
|
state = TingYun::Agent::TransactionState.tl_get
|
10
10
|
externel_guid = tingyun_externel_guid
|
11
|
-
state.
|
11
|
+
state.extenel_req_id = externel_guid
|
12
12
|
cross_app_id = TingYun::Agent.config[:tingyunIdSecret] or
|
13
13
|
raise TingYun::Agent::CrossAppTracing::Error, "no tingyunIdSecret configured"
|
14
|
+
state.add_current_node_params(:txId=>state.request_guid, :externalId=>state.extenel_req_id)
|
14
15
|
"#{cross_app_id};c=1;x=#{state.request_guid};e=#{externel_guid};s=#{TingYun::Helper.time_to_millis(Time.now)};p=#{protocol}"
|
15
16
|
end
|
16
17
|
|
@@ -29,7 +29,7 @@ module TingYun
|
|
29
29
|
:type => 'perfMetrics',
|
30
30
|
:timeFrom => stats_hash.started_at.to_i,
|
31
31
|
:timeTo => stats_hash.harvested_at.to_i || Time.now.to_i,
|
32
|
-
:interval =>
|
32
|
+
:interval => TingYun::Agent.config[:data_report_period],
|
33
33
|
:actions => action_array,
|
34
34
|
:apdex => adpex_array,
|
35
35
|
:components => components_array,
|
data/lib/ting_yun/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tingyun_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tingyun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|