instana 1.202.0 → 1.203.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug.yml +39 -0
- data/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/Appraisals +1 -0
- data/README.md +1 -1
- data/gemfiles/aws_30.gemfile +1 -0
- data/lib/instana/activators/action_mailer.rb +22 -0
- data/lib/instana/activators/aws_sdk_lambda.rb +20 -0
- data/lib/instana/instrumentation/action_mailer.rb +22 -0
- data/lib/instana/instrumentation/aws_sdk_lambda.rb +37 -0
- data/lib/instana/instrumentation/resque.rb +11 -1
- data/lib/instana/serverless.rb +24 -3
- data/lib/instana/tracing/span.rb +6 -3
- data/lib/instana/version.rb +1 -1
- data/test/instrumentation/aws_test.rb +35 -0
- data/test/instrumentation/rails_action_mailer_test.rb +37 -0
- data/test/instrumentation/rails_active_record_database_missing_test.rb +43 -0
- data/test/instrumentation/resque_test.rb +22 -6
- data/test/serverless_test.rb +46 -0
- metadata +70 -60
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4a3e85003438c1690ddc13b6e475bcb1765155bf71b90c2799b8037033a9ce3
|
|
4
|
+
data.tar.gz: d6fcc234fa717a23048e674ba76a4b7ad78cf81bf1c105ff5dce226d95cc7b82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2d908c112040f6e833c23e6462e0b7c0696d72520767693b911aa6ddb0f8547a5c51518dd46826efddbb0747820014085ca9c3103dae61315821c99f5b49b34
|
|
7
|
+
data.tar.gz: 47871736c4c8b3f2427e9647e2769209b952bec8534a78c0c9875d642549b44545d93d4ae213bde3c00566f7428a33955481473b489c7894fd7a47a87d6d9e42
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: File a bug report
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: [bug]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thank you for taking the time to fill out this report. Remember that these issues are public and if you need to discuss implementation specific issues securely, please [use our support portal](https://support.instana.com/hc/en-us).
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: problem-description
|
|
12
|
+
attributes:
|
|
13
|
+
label: Problem Description
|
|
14
|
+
description: What was the issue that caused you to file this bug?
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: mcve
|
|
19
|
+
attributes:
|
|
20
|
+
label: Minimal, Complete, Verifiable, Example
|
|
21
|
+
description: Can you provide steps needed to reproduce this issue outside of your application?
|
|
22
|
+
validations:
|
|
23
|
+
required: false
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: gemfile-lock
|
|
26
|
+
attributes:
|
|
27
|
+
label: Gemfile.lock
|
|
28
|
+
description: Please paste the contents of the Gemfile.lock for the application that was affected by this bug.
|
|
29
|
+
render: shell
|
|
30
|
+
validations:
|
|
31
|
+
required: true
|
|
32
|
+
- type: textarea
|
|
33
|
+
id: ruby-version
|
|
34
|
+
attributes:
|
|
35
|
+
label: Ruby Version
|
|
36
|
+
description: What version of Ruby was the application running under when it encountered this bug?
|
|
37
|
+
render: shell
|
|
38
|
+
validations:
|
|
39
|
+
required: true
|
data/Appraisals
CHANGED
data/README.md
CHANGED
|
@@ -77,5 +77,5 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/instan
|
|
|
77
77
|
|
|
78
78
|
## More
|
|
79
79
|
|
|
80
|
-
Want to instrument other languages? See our [Node.js](https://github.com/instana/nodejs
|
|
80
|
+
Want to instrument other languages? See our [Node.js](https://github.com/instana/nodejs), [Go](https://github.com/instana/golang-sensor), [Python](https://github.com/instana/python-sensor) repositories or [many other supported technologies](https://www.instana.com/supported-technologies/).
|
|
81
81
|
|
data/gemfiles/aws_30.gemfile
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
module Instana
|
|
5
|
+
module Activators
|
|
6
|
+
class ActionMailer < Activator
|
|
7
|
+
def can_instrument?
|
|
8
|
+
defined?(::ActionMailer::Base)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def instrument
|
|
12
|
+
require 'instana/instrumentation/action_mailer'
|
|
13
|
+
|
|
14
|
+
::ActionMailer::Base
|
|
15
|
+
.singleton_class
|
|
16
|
+
.prepend(Instana::Instrumentation::ActionMailer)
|
|
17
|
+
|
|
18
|
+
true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
module Instana
|
|
5
|
+
module Activators
|
|
6
|
+
class AwsSdkLambda < Activator
|
|
7
|
+
def can_instrument?
|
|
8
|
+
defined?(::Aws::Lambda::Client) && ::Aws::Lambda::Client.respond_to?(:add_plugin)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def instrument
|
|
12
|
+
require 'instana/instrumentation/aws_sdk_lambda'
|
|
13
|
+
|
|
14
|
+
::Aws::Lambda::Client.add_plugin(Instana::Instrumentation::Lambda)
|
|
15
|
+
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
module Instana
|
|
5
|
+
module Instrumentation
|
|
6
|
+
module ActionMailer
|
|
7
|
+
def method_missing(method_name, *args) # rubocop:disable Style/MissingRespondToMissing
|
|
8
|
+
if action_methods.include?(method_name.to_s)
|
|
9
|
+
tags = {
|
|
10
|
+
actionmailer: {
|
|
11
|
+
class: to_s,
|
|
12
|
+
method: method_name.to_s
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
Instana::Tracer.trace(:'mail.actionmailer', tags) { super }
|
|
16
|
+
else
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
require 'base64'
|
|
4
|
+
|
|
5
|
+
module Instana
|
|
6
|
+
module Instrumentation
|
|
7
|
+
class Lambda < Seahorse::Client::Plugin
|
|
8
|
+
class Handler < Seahorse::Client::Handler
|
|
9
|
+
def call(context)
|
|
10
|
+
return @handler.call(context) unless [:invoke_async, :invoke].include?(context.operation_name)
|
|
11
|
+
|
|
12
|
+
if context.params[:client_context].nil? && ::Instana.tracer.tracing? && context.operation_name == :invoke
|
|
13
|
+
span_context = ::Instana.tracer.context
|
|
14
|
+
payload = {
|
|
15
|
+
'X-INSTANA-T' => span_context.trace_id,
|
|
16
|
+
'X-INSTANA-S' => span_context.span_id,
|
|
17
|
+
'X-INSTANA-L' => span_context.level.to_s
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
context.params[:client_context] = JSON.dump(payload)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
tags = {
|
|
24
|
+
function: context.params[:function_name],
|
|
25
|
+
type: context.params[:invocation_type]
|
|
26
|
+
}.reject { |_, v| v.nil? }
|
|
27
|
+
|
|
28
|
+
::Instana.tracer.trace(:"aws.lambda.invoke", {aws: {lambda: {invoke: tags}}}) { @handler.call(context) }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def add_handlers(handlers, _config)
|
|
33
|
+
handlers.add(Handler, step: :initialize)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -28,6 +28,7 @@ module Instana
|
|
|
28
28
|
kvs = collect_kvs(:enqueue, klass, args)
|
|
29
29
|
|
|
30
30
|
Instana.tracer.trace(:'resque-client', kvs) do
|
|
31
|
+
args.push(::Instana.tracer.context.to_hash)
|
|
31
32
|
super(klass, *args)
|
|
32
33
|
end
|
|
33
34
|
else
|
|
@@ -41,6 +42,7 @@ module Instana
|
|
|
41
42
|
kvs[:Queue] = queue.to_s if queue
|
|
42
43
|
|
|
43
44
|
Instana.tracer.trace(:'resque-client', kvs) do
|
|
45
|
+
args.push(::Instana.tracer.context.to_hash)
|
|
44
46
|
super(queue, klass, *args)
|
|
45
47
|
end
|
|
46
48
|
else
|
|
@@ -76,7 +78,15 @@ module Instana
|
|
|
76
78
|
::Instana.logger.debug { "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" } if Instana::Config[:verbose]
|
|
77
79
|
end
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
trace_context = if job.payload['args'][-1].is_a?(Hash) && job.payload['args'][-1].keys.include?('trace_id')
|
|
82
|
+
context_from_wire = job.payload['args'].pop
|
|
83
|
+
::Instana::SpanContext.new(
|
|
84
|
+
context_from_wire['trace_id'],
|
|
85
|
+
context_from_wire['span_id']
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
Instana.tracer.start_or_continue_trace(:'resque-worker', kvs, trace_context) do
|
|
80
90
|
super(job)
|
|
81
91
|
end
|
|
82
92
|
end
|
data/lib/instana/serverless.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Instana
|
|
|
23
23
|
|
|
24
24
|
def wrap_aws(event, context, &block)
|
|
25
25
|
Thread.current[:instana_function_arn] = [context.invoked_function_arn, context.function_version].join(':')
|
|
26
|
-
trigger, event_tags, span_context = trigger_from_event(event)
|
|
26
|
+
trigger, event_tags, span_context = trigger_from_event(event, context)
|
|
27
27
|
|
|
28
28
|
tags = {
|
|
29
29
|
lambda: {
|
|
@@ -53,7 +53,7 @@ module Instana
|
|
|
53
53
|
|
|
54
54
|
private
|
|
55
55
|
|
|
56
|
-
def trigger_from_event(event) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
56
|
+
def trigger_from_event(event, context) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
57
57
|
case event
|
|
58
58
|
when ->(e) { defined?(::Instana::InstrumentedRequest) && e.is_a?(Hash) && e.key?('requestContext') && e['requestContext'].key?('elb') }
|
|
59
59
|
request = InstrumentedRequest.new(event_to_rack(event))
|
|
@@ -74,7 +74,28 @@ module Instana
|
|
|
74
74
|
tags = decode_sqs(event)
|
|
75
75
|
['aws:sqs', {sqs: tags}, {}]
|
|
76
76
|
else
|
|
77
|
-
|
|
77
|
+
ctx = context_from_lambda_context(context)
|
|
78
|
+
if ctx.empty?
|
|
79
|
+
['aws:api.gateway.noproxy', {}, {}]
|
|
80
|
+
else
|
|
81
|
+
['aws.lambda.invoke', {}, ctx]
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def context_from_lambda_context(context)
|
|
87
|
+
return {} unless context.client_context
|
|
88
|
+
|
|
89
|
+
begin
|
|
90
|
+
context = JSON.parse(Base64.decode64(context.client_context))
|
|
91
|
+
|
|
92
|
+
{
|
|
93
|
+
trace_id: context['X-INSTANA-T'],
|
|
94
|
+
span_id: context['X-INSTANA-S'],
|
|
95
|
+
level: Integer(context['X-INSTANA-L'])
|
|
96
|
+
}
|
|
97
|
+
rescue TypeError, JSON::ParserError, NoMethodError => _e
|
|
98
|
+
{}
|
|
78
99
|
end
|
|
79
100
|
end
|
|
80
101
|
|
data/lib/instana/tracing/span.rb
CHANGED
|
@@ -6,10 +6,13 @@ module Instana
|
|
|
6
6
|
REGISTERED_SPANS = [ :actioncontroller, :actionview, :activerecord, :excon,
|
|
7
7
|
:memcache, :'net-http', :rack, :render, :'rpc-client',
|
|
8
8
|
:'rpc-server', :'sidekiq-client', :'sidekiq-worker',
|
|
9
|
-
:redis, :'resque-client', :'resque-worker', :'graphql.server', :dynamodb, :s3, :sns, :sqs, :'aws.lambda.entry', :activejob, :log
|
|
10
|
-
|
|
9
|
+
:redis, :'resque-client', :'resque-worker', :'graphql.server', :dynamodb, :s3, :sns, :sqs, :'aws.lambda.entry', :activejob, :log, :"mail.actionmailer",
|
|
10
|
+
:"aws.lambda.invoke" ].freeze
|
|
11
|
+
ENTRY_SPANS = [ :rack, :'resque-worker', :'rpc-server', :'sidekiq-worker', :'graphql.server', :sqs,
|
|
12
|
+
:'aws.lambda.entry' ].freeze
|
|
11
13
|
EXIT_SPANS = [ :activerecord, :excon, :'net-http', :'resque-client',
|
|
12
|
-
:'rpc-client', :'sidekiq-client', :redis, :dynamodb, :s3, :sns, :sqs, :log
|
|
14
|
+
:'rpc-client', :'sidekiq-client', :redis, :dynamodb, :s3, :sns, :sqs, :log, :"mail.actionmailer",
|
|
15
|
+
:"aws.lambda.invoke" ].freeze
|
|
13
16
|
HTTP_SPANS = [ :rack, :excon, :'net-http' ].freeze
|
|
14
17
|
|
|
15
18
|
attr_accessor :parent
|
data/lib/instana/version.rb
CHANGED
|
@@ -158,4 +158,39 @@ class AwsTest < Minitest::Test
|
|
|
158
158
|
assert_equal send_span[:s], message.message_attributes['X_INSTANA_S'].string_value
|
|
159
159
|
assert_equal 'Sample', message.body
|
|
160
160
|
end
|
|
161
|
+
|
|
162
|
+
def test_lambda
|
|
163
|
+
stub_request(:post, "https://lambda.local.amazonaws.com/2015-03-31/functions/Test/invocations")
|
|
164
|
+
.with(
|
|
165
|
+
body: "data",
|
|
166
|
+
headers: {
|
|
167
|
+
'X-Amz-Client-Context' => /.+/
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
.to_return(status: 200, body: "", headers: {})
|
|
171
|
+
|
|
172
|
+
lambda = Aws::Lambda::Client.new(
|
|
173
|
+
endpoint: 'https://lambda.local.amazonaws.com',
|
|
174
|
+
region: 'local',
|
|
175
|
+
access_key_id: "test",
|
|
176
|
+
secret_access_key: "test"
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
Instana::Tracer.start_or_continue_trace(:lambda_test, {}) do
|
|
180
|
+
lambda.invoke(
|
|
181
|
+
function_name: 'Test',
|
|
182
|
+
invocation_type: 'Event',
|
|
183
|
+
payload: 'data'
|
|
184
|
+
)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
spans = ::Instana.processor.queued_spans
|
|
188
|
+
lambda_span, _entry_span, *rest = spans
|
|
189
|
+
|
|
190
|
+
assert rest.empty?
|
|
191
|
+
|
|
192
|
+
assert_equal :"aws.lambda.invoke", lambda_span[:n]
|
|
193
|
+
assert_equal 'Test', lambda_span[:data][:aws][:lambda][:invoke][:function]
|
|
194
|
+
assert_equal 'Event', lambda_span[:data][:aws][:lambda][:invoke][:type]
|
|
195
|
+
end
|
|
161
196
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
require 'test_helper'
|
|
5
|
+
require 'action_mailer'
|
|
6
|
+
|
|
7
|
+
class RailsActionMailerTest < Minitest::Test
|
|
8
|
+
class TestMailer < ActionMailer::Base
|
|
9
|
+
def sample_email
|
|
10
|
+
mail(
|
|
11
|
+
from: 'test@example.com',
|
|
12
|
+
to: 'test@example.com',
|
|
13
|
+
subject: 'Test Email',
|
|
14
|
+
body: 'Hello',
|
|
15
|
+
content_type: "text/html"
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def setup
|
|
21
|
+
TestMailer.delivery_method = :sendmail
|
|
22
|
+
|
|
23
|
+
clear_all!
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_mailer
|
|
27
|
+
Instana.tracer.start_or_continue_trace(:test) do
|
|
28
|
+
TestMailer.sample_email.deliver_now
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
mail_span, = *::Instana.processor.queued_spans
|
|
32
|
+
|
|
33
|
+
assert_equal :"mail.actionmailer", mail_span[:n]
|
|
34
|
+
assert_equal 'RailsActionMailerTest::TestMailer', mail_span[:data][:actionmailer][:class]
|
|
35
|
+
assert_equal 'sample_email', mail_span[:data][:actionmailer][:method]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
|
3
|
+
|
|
4
|
+
require 'test_helper'
|
|
5
|
+
require 'support/apps/active_record/active_record'
|
|
6
|
+
require 'fileutils'
|
|
7
|
+
|
|
8
|
+
class RailsActiveRecordDatabaseMissingTest < Minitest::Test
|
|
9
|
+
def setup
|
|
10
|
+
skip unless ENV['DATABASE_URL']
|
|
11
|
+
|
|
12
|
+
@old_url = ENV['DATABASE_URL']
|
|
13
|
+
SQLite3::Database.new('/tmp/test.db')
|
|
14
|
+
ENV['DATABASE_URL'] = 'sqlite3:///tmp/test.db'
|
|
15
|
+
|
|
16
|
+
@connection = ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
|
|
17
|
+
ActiveRecord::Migration.suppress_messages do
|
|
18
|
+
ActiveRecord::Migration.run(CreateBlocks, direction: :up)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def teardown
|
|
23
|
+
ActiveRecord::Base.remove_connection(@connection)
|
|
24
|
+
ENV['DATABASE_URL'] = @old_url
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_error_on_missing_database
|
|
28
|
+
assert_raises(ActiveRecord::StatementInvalid) do
|
|
29
|
+
Instana::Tracer.start_or_continue_trace(:ar_test, {}) do
|
|
30
|
+
b = Block.new
|
|
31
|
+
FileUtils.rm('/tmp/test.db')
|
|
32
|
+
b.save!
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
spans = ::Instana.processor.queued_spans
|
|
37
|
+
assert_equal 3, spans.length
|
|
38
|
+
span = find_first_span_by_name(spans, :activerecord)
|
|
39
|
+
|
|
40
|
+
assert_equal 1, span[:ec]
|
|
41
|
+
assert span[:data][:activerecord][:error].include?("SQLite3::ReadOnlyException: attempt to write a readonly database")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -22,6 +22,7 @@ class ResqueClientTest < Minitest::Test
|
|
|
22
22
|
::Resque.enqueue(FastJob)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
resque_job = Resque.reserve('critical')
|
|
25
26
|
spans = ::Instana.processor.queued_spans
|
|
26
27
|
assert_equal 2, spans.length
|
|
27
28
|
|
|
@@ -34,6 +35,9 @@ class ResqueClientTest < Minitest::Test
|
|
|
34
35
|
assert_equal "FastJob", resque_span[:data][:'resque-client'][:job]
|
|
35
36
|
assert_equal :critical, resque_span[:data][:'resque-client'][:queue]
|
|
36
37
|
assert_equal false, resque_span[:data][:'resque-client'].key?(:error)
|
|
38
|
+
|
|
39
|
+
assert_equal resque_job.args.first['trace_id'], resque_span[:t]
|
|
40
|
+
assert_equal resque_job.args.first['span_id'], resque_span[:s]
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
def test_enqueue_to
|
|
@@ -41,6 +45,7 @@ class ResqueClientTest < Minitest::Test
|
|
|
41
45
|
::Resque.enqueue_to(:critical, FastJob)
|
|
42
46
|
end
|
|
43
47
|
|
|
48
|
+
resque_job = Resque.reserve('critical')
|
|
44
49
|
spans = ::Instana.processor.queued_spans
|
|
45
50
|
assert_equal 2, spans.length
|
|
46
51
|
|
|
@@ -52,6 +57,9 @@ class ResqueClientTest < Minitest::Test
|
|
|
52
57
|
assert_equal "FastJob", resque_span[:data][:'resque-client'][:job]
|
|
53
58
|
assert_equal :critical, resque_span[:data][:'resque-client'][:queue]
|
|
54
59
|
assert_equal false, resque_span[:data][:'resque-client'].key?(:error)
|
|
60
|
+
|
|
61
|
+
assert_equal resque_job.args.first['trace_id'], resque_span[:t]
|
|
62
|
+
assert_equal resque_job.args.first['span_id'], resque_span[:s]
|
|
55
63
|
end
|
|
56
64
|
|
|
57
65
|
def test_dequeue
|
|
@@ -73,17 +81,25 @@ class ResqueClientTest < Minitest::Test
|
|
|
73
81
|
end
|
|
74
82
|
|
|
75
83
|
def test_worker_job
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
::Instana.tracer.start_or_continue_trace(:'resque-client_test') do
|
|
85
|
+
::Resque.enqueue_to(:critical, FastJob)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
resque_job = Resque.reserve('critical')
|
|
89
|
+
@worker.work_one_job(resque_job)
|
|
78
90
|
|
|
79
91
|
spans = ::Instana.processor.queued_spans
|
|
80
|
-
assert_equal
|
|
92
|
+
assert_equal 5, spans.length
|
|
93
|
+
|
|
94
|
+
client_span = spans[0]
|
|
95
|
+
resque_span = spans[4]
|
|
96
|
+
redis1_span = spans[3]
|
|
97
|
+
redis2_span = spans[2]
|
|
81
98
|
|
|
82
|
-
|
|
83
|
-
redis1_span = spans[1]
|
|
84
|
-
redis2_span = spans[0]
|
|
99
|
+
assert_equal :'resque-client', client_span[:n]
|
|
85
100
|
|
|
86
101
|
assert_equal :'resque-worker', resque_span[:n]
|
|
102
|
+
assert_equal client_span[:s], resque_span[:p]
|
|
87
103
|
assert_equal false, resque_span.key?(:error)
|
|
88
104
|
assert_equal false, resque_span.key?(:ec)
|
|
89
105
|
assert_equal "FastJob", resque_span[:data][:'resque-worker'][:job]
|
data/test/serverless_test.rb
CHANGED
|
@@ -320,4 +320,50 @@ class ServerlessTest < Minitest::Test
|
|
|
320
320
|
|
|
321
321
|
assert_equal 'test_arn', data[:messages].first[:queue]
|
|
322
322
|
end
|
|
323
|
+
|
|
324
|
+
def test_lambda_client_context
|
|
325
|
+
clear_all!
|
|
326
|
+
|
|
327
|
+
mock_context = OpenStruct.new(
|
|
328
|
+
invoked_function_arn: 'test_arn',
|
|
329
|
+
function_name: 'test_function',
|
|
330
|
+
function_version: '$TEST',
|
|
331
|
+
client_context: "eyJYLUlOU1RBTkEtVCI6IjEyMyIsIlgtSU5TVEFOQS1TIjoiNDU2IiwiWC1J\nTlNUQU5BLUwiOiIxIn0=\n"
|
|
332
|
+
)
|
|
333
|
+
mock_event = {
|
|
334
|
+
"Invoked" => true
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
@subject.wrap_aws(mock_event, mock_context) { 0 }
|
|
338
|
+
|
|
339
|
+
lambda_span, *rest = Instana.processor.queued_spans
|
|
340
|
+
assert rest.empty?
|
|
341
|
+
|
|
342
|
+
assert_equal 'aws.lambda.invoke', lambda_span[:data][:lambda][:trigger]
|
|
343
|
+
assert_equal '123', lambda_span[:t]
|
|
344
|
+
assert_equal '456', lambda_span[:p]
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
def test_lambda_client_context_error
|
|
348
|
+
clear_all!
|
|
349
|
+
|
|
350
|
+
mock_context = OpenStruct.new(
|
|
351
|
+
invoked_function_arn: 'test_arn',
|
|
352
|
+
function_name: 'test_function',
|
|
353
|
+
function_version: '$TEST',
|
|
354
|
+
client_context: "eyJYLUlOU1RBkEtVCI6IjEyMyIsIlgtSU5TVEFOQS1TIjoiNDU2IiwiWC1J\nTlNUQU5BLUwiOiIxIn0=\n"
|
|
355
|
+
)
|
|
356
|
+
mock_event = {
|
|
357
|
+
"Invoked" => true
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
@subject.wrap_aws(mock_event, mock_context) { 0 }
|
|
361
|
+
|
|
362
|
+
lambda_span, *rest = Instana.processor.queued_spans
|
|
363
|
+
assert rest.empty?
|
|
364
|
+
|
|
365
|
+
refute_equal 'aws.lambda.invoke', lambda_span[:data][:lambda][:trigger]
|
|
366
|
+
refute_equal '123', lambda_span[:t]
|
|
367
|
+
refute_equal '456', lambda_span[:p]
|
|
368
|
+
end
|
|
323
369
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: instana
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.203.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Giacomo Lombardo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-06-
|
|
11
|
+
date: 2021-06-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -135,6 +135,8 @@ files:
|
|
|
135
135
|
- ".codeclimate.yml"
|
|
136
136
|
- ".editorconfig"
|
|
137
137
|
- ".fasterer.yml"
|
|
138
|
+
- ".github/ISSUE_TEMPLATE/bug.yml"
|
|
139
|
+
- ".github/ISSUE_TEMPLATE/config.yml"
|
|
138
140
|
- ".gitignore"
|
|
139
141
|
- ".rubocop.yml"
|
|
140
142
|
- ".rubocop_todo.yml"
|
|
@@ -182,10 +184,12 @@ files:
|
|
|
182
184
|
- lib/instana/activators/action_cable.rb
|
|
183
185
|
- lib/instana/activators/action_controller_api.rb
|
|
184
186
|
- lib/instana/activators/action_controller_base.rb
|
|
187
|
+
- lib/instana/activators/action_mailer.rb
|
|
185
188
|
- lib/instana/activators/action_view.rb
|
|
186
189
|
- lib/instana/activators/active_job.rb
|
|
187
190
|
- lib/instana/activators/active_record.rb
|
|
188
191
|
- lib/instana/activators/aws_sdk_dynamodb.rb
|
|
192
|
+
- lib/instana/activators/aws_sdk_lambda.rb
|
|
189
193
|
- lib/instana/activators/aws_sdk_s3.rb
|
|
190
194
|
- lib/instana/activators/aws_sdk_sns.rb
|
|
191
195
|
- lib/instana/activators/aws_sdk_sqs.rb
|
|
@@ -224,10 +228,12 @@ files:
|
|
|
224
228
|
- lib/instana/frameworks/sinatra.rb
|
|
225
229
|
- lib/instana/instrumentation/action_cable.rb
|
|
226
230
|
- lib/instana/instrumentation/action_controller.rb
|
|
231
|
+
- lib/instana/instrumentation/action_mailer.rb
|
|
227
232
|
- lib/instana/instrumentation/action_view.rb
|
|
228
233
|
- lib/instana/instrumentation/active_job.rb
|
|
229
234
|
- lib/instana/instrumentation/active_record.rb
|
|
230
235
|
- lib/instana/instrumentation/aws_sdk_dynamodb.rb
|
|
236
|
+
- lib/instana/instrumentation/aws_sdk_lambda.rb
|
|
231
237
|
- lib/instana/instrumentation/aws_sdk_s3.rb
|
|
232
238
|
- lib/instana/instrumentation/aws_sdk_sns.rb
|
|
233
239
|
- lib/instana/instrumentation/aws_sdk_sqs.rb
|
|
@@ -296,8 +302,10 @@ files:
|
|
|
296
302
|
- test/instrumentation/rack_test.rb
|
|
297
303
|
- test/instrumentation/rails_action_cable_test.rb
|
|
298
304
|
- test/instrumentation/rails_action_controller_test.rb
|
|
305
|
+
- test/instrumentation/rails_action_mailer_test.rb
|
|
299
306
|
- test/instrumentation/rails_action_view_test.rb
|
|
300
307
|
- test/instrumentation/rails_active_job_test.rb
|
|
308
|
+
- test/instrumentation/rails_active_record_database_missing_test.rb
|
|
301
309
|
- test/instrumentation/rails_active_record_test.rb
|
|
302
310
|
- test/instrumentation/redis_test.rb
|
|
303
311
|
- test/instrumentation/resque_test.rb
|
|
@@ -366,82 +374,84 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
366
374
|
- !ruby/object:Gem::Version
|
|
367
375
|
version: '0'
|
|
368
376
|
requirements: []
|
|
369
|
-
rubygems_version: 3.
|
|
377
|
+
rubygems_version: 3.1.6
|
|
370
378
|
signing_key:
|
|
371
379
|
specification_version: 4
|
|
372
380
|
summary: Ruby Distributed Tracing & Metrics Sensor for Instana
|
|
373
381
|
test_files:
|
|
374
|
-
- test/config_test.rb
|
|
375
|
-
- test/serverless_test.rb
|
|
376
382
|
- test/activator_test.rb
|
|
377
|
-
- test/
|
|
378
|
-
- test/tracing/span_test.rb
|
|
379
|
-
- test/tracing/id_management_test.rb
|
|
380
|
-
- test/tracing/tracer_test.rb
|
|
381
|
-
- test/tracing/custom_test.rb
|
|
382
|
-
- test/tracing/opentracing_test.rb
|
|
383
|
-
- test/tracing/instrumented_logger_test.rb
|
|
384
|
-
- test/tracing/tracer_async_test.rb
|
|
385
|
-
- test/tracing/processor_test.rb
|
|
386
|
-
- test/snapshot/docker_container_test.rb
|
|
387
|
-
- test/snapshot/fargate_process_test.rb
|
|
388
|
-
- test/snapshot/deltable_test.rb
|
|
389
|
-
- test/snapshot/fargate_task_test.rb
|
|
390
|
-
- test/snapshot/ruby_process_test.rb
|
|
391
|
-
- test/snapshot/google_cloud_run_process_test.rb
|
|
392
|
-
- test/snapshot/lambda_function_test.rb
|
|
393
|
-
- test/snapshot/fargate_container_test.rb
|
|
394
|
-
- test/snapshot/google_cloud_run_instance_test.rb
|
|
395
|
-
- test/backend/host_agent_activation_observer_test.rb
|
|
396
|
-
- test/backend/host_agent_reporting_observer_test.rb
|
|
383
|
+
- test/backend/agent_test.rb
|
|
397
384
|
- test/backend/gc_snapshot_test.rb
|
|
385
|
+
- test/backend/host_agent_activation_observer_test.rb
|
|
398
386
|
- test/backend/host_agent_lookup_test.rb
|
|
399
|
-
- test/backend/
|
|
400
|
-
- test/backend/process_info_test.rb
|
|
401
|
-
- test/backend/agent_test.rb
|
|
387
|
+
- test/backend/host_agent_reporting_observer_test.rb
|
|
402
388
|
- test/backend/host_agent_test.rb
|
|
389
|
+
- test/backend/process_info_test.rb
|
|
403
390
|
- test/backend/request_client_test.rb
|
|
404
|
-
- test/
|
|
391
|
+
- test/backend/serverless_agent_test.rb
|
|
392
|
+
- test/benchmarks/bench_id_generation.rb
|
|
393
|
+
- test/benchmarks/bench_opentracing.rb
|
|
394
|
+
- test/config_test.rb
|
|
395
|
+
- test/frameworks/cuba_test.rb
|
|
396
|
+
- test/frameworks/roda_test.rb
|
|
397
|
+
- test/frameworks/sinatra_test.rb
|
|
398
|
+
- test/instana_test.rb
|
|
399
|
+
- test/instrumentation/aws_test.rb
|
|
400
|
+
- test/instrumentation/dalli_test.rb
|
|
401
|
+
- test/instrumentation/excon_test.rb
|
|
405
402
|
- test/instrumentation/graphql_test.rb
|
|
406
|
-
- test/instrumentation/
|
|
407
|
-
- test/instrumentation/rails_action_controller_test.rb
|
|
408
|
-
- test/instrumentation/rest_client_test.rb
|
|
403
|
+
- test/instrumentation/grpc_test.rb
|
|
409
404
|
- test/instrumentation/net_http_test.rb
|
|
410
|
-
- test/instrumentation/
|
|
411
|
-
- test/instrumentation/
|
|
405
|
+
- test/instrumentation/rack_instrumented_request_test.rb
|
|
406
|
+
- test/instrumentation/rack_test.rb
|
|
407
|
+
- test/instrumentation/rails_action_cable_test.rb
|
|
408
|
+
- test/instrumentation/rails_action_controller_test.rb
|
|
409
|
+
- test/instrumentation/rails_action_mailer_test.rb
|
|
412
410
|
- test/instrumentation/rails_action_view_test.rb
|
|
413
411
|
- test/instrumentation/rails_active_job_test.rb
|
|
414
|
-
- test/instrumentation/
|
|
415
|
-
- test/instrumentation/rack_instrumented_request_test.rb
|
|
416
|
-
- test/instrumentation/shoryuken_test.rb
|
|
412
|
+
- test/instrumentation/rails_active_record_database_missing_test.rb
|
|
417
413
|
- test/instrumentation/rails_active_record_test.rb
|
|
418
414
|
- test/instrumentation/redis_test.rb
|
|
419
|
-
- test/instrumentation/
|
|
420
|
-
- test/instrumentation/
|
|
421
|
-
- test/instrumentation/
|
|
422
|
-
- test/instrumentation/
|
|
423
|
-
- test/instrumentation/
|
|
424
|
-
- test/
|
|
425
|
-
- test/
|
|
426
|
-
- test/
|
|
427
|
-
- test/
|
|
428
|
-
- test/
|
|
429
|
-
- test/
|
|
430
|
-
- test/
|
|
415
|
+
- test/instrumentation/resque_test.rb
|
|
416
|
+
- test/instrumentation/rest_client_test.rb
|
|
417
|
+
- test/instrumentation/shoryuken_test.rb
|
|
418
|
+
- test/instrumentation/sidekiq-client_test.rb
|
|
419
|
+
- test/instrumentation/sidekiq-worker_test.rb
|
|
420
|
+
- test/secrets_test.rb
|
|
421
|
+
- test/serverless_test.rb
|
|
422
|
+
- test/snapshot/deltable_test.rb
|
|
423
|
+
- test/snapshot/docker_container_test.rb
|
|
424
|
+
- test/snapshot/fargate_container_test.rb
|
|
425
|
+
- test/snapshot/fargate_process_test.rb
|
|
426
|
+
- test/snapshot/fargate_task_test.rb
|
|
427
|
+
- test/snapshot/google_cloud_run_instance_test.rb
|
|
428
|
+
- test/snapshot/google_cloud_run_process_test.rb
|
|
429
|
+
- test/snapshot/lambda_function_test.rb
|
|
430
|
+
- test/snapshot/ruby_process_test.rb
|
|
431
|
+
- test/support/apps/active_record/active_record.rb
|
|
431
432
|
- test/support/apps/grpc/boot.rb
|
|
432
433
|
- test/support/apps/grpc/grpc_server.rb
|
|
433
|
-
- test/support/apps/active_record/active_record.rb
|
|
434
|
-
- test/support/apps/resque/boot.rb
|
|
435
|
-
- test/support/apps/resque/jobs/resque_error_job.rb
|
|
436
|
-
- test/support/apps/resque/jobs/resque_fast_job.rb
|
|
437
434
|
- test/support/apps/http_endpoint/boot.rb
|
|
435
|
+
- test/support/apps/rails/boot.rb
|
|
438
436
|
- test/support/apps/rails/models/block.rb
|
|
439
437
|
- test/support/apps/rails/models/block6.rb
|
|
440
|
-
- test/support/apps/
|
|
441
|
-
- test/
|
|
442
|
-
- test/
|
|
438
|
+
- test/support/apps/resque/boot.rb
|
|
439
|
+
- test/support/apps/resque/jobs/resque_error_job.rb
|
|
440
|
+
- test/support/apps/resque/jobs/resque_fast_job.rb
|
|
441
|
+
- test/support/apps/sidekiq/boot.rb
|
|
442
|
+
- test/support/apps/sidekiq/jobs/sidekiq_job_1.rb
|
|
443
|
+
- test/support/apps/sidekiq/jobs/sidekiq_job_2.rb
|
|
444
|
+
- test/support/apps/sidekiq/worker.rb
|
|
445
|
+
- test/support/helpers.rb
|
|
446
|
+
- test/support/mock_timer.rb
|
|
443
447
|
- test/test_helper.rb
|
|
444
|
-
- test/
|
|
445
|
-
- test/
|
|
446
|
-
- test/
|
|
447
|
-
- test/
|
|
448
|
+
- test/tracing/custom_test.rb
|
|
449
|
+
- test/tracing/id_management_test.rb
|
|
450
|
+
- test/tracing/instrumented_logger_test.rb
|
|
451
|
+
- test/tracing/opentracing_test.rb
|
|
452
|
+
- test/tracing/processor_test.rb
|
|
453
|
+
- test/tracing/span_context_test.rb
|
|
454
|
+
- test/tracing/span_test.rb
|
|
455
|
+
- test/tracing/tracer_async_test.rb
|
|
456
|
+
- test/tracing/tracer_test.rb
|
|
457
|
+
- test/util_test.rb
|