instana 1.200.0.pre1 → 1.203.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +14 -5
- data/.github/ISSUE_TEMPLATE/bug.yml +39 -0
- data/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/.rubocop.yml +11 -2
- data/Appraisals +1 -0
- data/README.md +1 -1
- data/gemfiles/aws_30.gemfile +1 -0
- data/lib/instana/activator.rb +13 -1
- data/lib/instana/activators/action_mailer.rb +22 -0
- data/lib/instana/activators/active_job.rb +21 -0
- data/lib/instana/activators/aws_sdk_dynamodb.rb +1 -1
- data/lib/instana/activators/aws_sdk_lambda.rb +20 -0
- data/lib/instana/activators/aws_sdk_s3.rb +1 -1
- data/lib/instana/activators/aws_sdk_sns.rb +1 -1
- data/lib/instana/activators/aws_sdk_sqs.rb +1 -1
- data/lib/instana/activators/redis.rb +1 -1
- data/lib/instana/activators/sidekiq_client.rb +1 -1
- data/lib/instana/activators/sidekiq_worker.rb +1 -1
- data/lib/instana/backend/host_agent.rb +1 -1
- data/lib/instana/backend/host_agent_reporting_observer.rb +2 -4
- data/lib/instana/backend/serverless_agent.rb +1 -1
- data/lib/instana/config.rb +3 -0
- data/lib/instana/frameworks/rails.rb +5 -5
- data/lib/instana/frameworks/roda.rb +1 -1
- data/lib/instana/instrumentation/action_mailer.rb +22 -0
- data/lib/instana/instrumentation/active_job.rb +52 -0
- data/lib/instana/instrumentation/aws_sdk_lambda.rb +37 -0
- data/lib/instana/instrumentation/aws_sdk_s3.rb +1 -1
- data/lib/instana/instrumentation/aws_sdk_sns.rb +1 -1
- data/lib/instana/instrumentation/aws_sdk_sqs.rb +1 -1
- data/lib/instana/instrumentation/instrumented_request.rb +4 -4
- data/lib/instana/instrumentation/rack.rb +1 -1
- data/lib/instana/instrumentation/resque.rb +11 -1
- data/lib/instana/instrumentation/shoryuken.rb +1 -1
- data/lib/instana/instrumented_logger.rb +26 -0
- data/lib/instana/serverless.rb +24 -3
- data/lib/instana/setup.rb +2 -0
- data/lib/instana/snapshot/docker_container.rb +1 -1
- data/lib/instana/snapshot/fargate_task.rb +1 -1
- data/lib/instana/snapshot/google_cloud_run_instance.rb +1 -1
- data/lib/instana/tracing/span.rb +6 -3
- data/lib/instana/tracing/span_context.rb +1 -1
- 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_job_test.rb +65 -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
- data/test/test_helper.rb +10 -1
- data/test/tracing/instrumented_logger_test.rb +39 -0
- metadata +21 -4
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
|
data/.circleci/config.yml
CHANGED
@@ -132,12 +132,12 @@ commands:
|
|
132
132
|
name: Install Depdendecies
|
133
133
|
command: |
|
134
134
|
bundle check || bundle install
|
135
|
-
|
135
|
+
run_sonarqube:
|
136
136
|
steps:
|
137
137
|
- run:
|
138
|
-
name:
|
138
|
+
name: Install Java
|
139
139
|
command: |
|
140
|
-
|
140
|
+
sudo apt-get install openjdk-11-jdk
|
141
141
|
- run:
|
142
142
|
name: Run SonarQube to capture coverage
|
143
143
|
command: |
|
@@ -147,8 +147,16 @@ commands:
|
|
147
147
|
-Dsonar.projectKey=ruby-sensor \
|
148
148
|
-Dsonar.sources=. \
|
149
149
|
-Dsonar.host.url="${SONARQUBE_URL}" \
|
150
|
-
-Dsonar.login="${SONARQUBE_LOGIN}"
|
151
|
-
|
150
|
+
-Dsonar.login="${SONARQUBE_LOGIN}"
|
151
|
+
run_tests:
|
152
|
+
steps:
|
153
|
+
- run:
|
154
|
+
name: Run Tests
|
155
|
+
command: |
|
156
|
+
mkdir _junit
|
157
|
+
bundle exec rake
|
158
|
+
- store_test_results:
|
159
|
+
path: ~/_junit
|
152
160
|
run_rubocop:
|
153
161
|
steps:
|
154
162
|
- run:
|
@@ -201,6 +209,7 @@ jobs:
|
|
201
209
|
- checkout
|
202
210
|
- setup
|
203
211
|
- run_rubocop
|
212
|
+
- run_sonarqube
|
204
213
|
publish:
|
205
214
|
executor: ruby_27
|
206
215
|
steps:
|
@@ -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/.rubocop.yml
CHANGED
@@ -2,11 +2,14 @@ inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
3
3
|
require:
|
4
4
|
- ./extras/license_header.rb
|
5
|
-
|
5
|
+
|
6
6
|
# Remove when we remove .rubocop_todo.yml
|
7
7
|
AllCops:
|
8
8
|
NewCops: disable
|
9
9
|
|
10
|
+
Metrics/PerceivedComplexity:
|
11
|
+
Max: 20
|
12
|
+
|
10
13
|
# Broken on 1.9
|
11
14
|
Style/HashSyntax:
|
12
15
|
Enabled: false
|
@@ -19,7 +22,13 @@ Style/NilComparison:
|
|
19
22
|
|
20
23
|
Style/SoleNestedConditional:
|
21
24
|
Enabled: false
|
22
|
-
|
25
|
+
|
23
26
|
# Ruby 2.1 compatibility
|
24
27
|
Style/SafeNavigation:
|
25
28
|
Enabled: false
|
29
|
+
|
30
|
+
Style/SymbolProc:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/MultilineBlockChain:
|
34
|
+
Enabled: false
|
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
data/lib/instana/activator.rb
CHANGED
@@ -43,4 +43,16 @@ module Instana
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
Dir["#{__dir__}/activators/*.rb"]
|
46
|
+
Dir["#{__dir__}/activators/*.rb"]
|
47
|
+
.sort
|
48
|
+
.select do |f|
|
49
|
+
# :nocov:
|
50
|
+
if ENV['INSTANA_ACTIVATE_SET']
|
51
|
+
base = File.basename(f, '.rb')
|
52
|
+
ENV.fetch('INSTANA_ACTIVATE_SET', '').split(',').include?(base)
|
53
|
+
else
|
54
|
+
true
|
55
|
+
end
|
56
|
+
# :nocov:
|
57
|
+
end
|
58
|
+
.each { |f| require(f) }
|
@@ -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,21 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
3
|
+
|
4
|
+
module Instana
|
5
|
+
module Activators
|
6
|
+
class ActiveJob < Activator
|
7
|
+
def can_instrument?
|
8
|
+
defined?(::ActiveJob::Base)
|
9
|
+
end
|
10
|
+
|
11
|
+
def instrument
|
12
|
+
require 'instana/instrumentation/active_job'
|
13
|
+
|
14
|
+
::ActiveJob::Base
|
15
|
+
.prepend(Instana::Instrumentation::ActiveJob)
|
16
|
+
|
17
|
+
true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
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
|
@@ -5,7 +5,7 @@ module Instana
|
|
5
5
|
module Activators
|
6
6
|
class SidekiqClient < Activator
|
7
7
|
def can_instrument?
|
8
|
-
defined?(::Sidekiq) && ::Instana.config[:'sidekiq-client'][:enabled]
|
8
|
+
defined?(::Sidekiq) && ::Sidekiq.respond_to?(:configure_client) && ::Instana.config[:'sidekiq-client'][:enabled]
|
9
9
|
end
|
10
10
|
|
11
11
|
def instrument
|
@@ -5,7 +5,7 @@ module Instana
|
|
5
5
|
module Activators
|
6
6
|
class SidekiqWorker < Activator
|
7
7
|
def can_instrument?
|
8
|
-
defined?(::Sidekiq) && ::Instana.config[:'sidekiq-worker'][:enabled]
|
8
|
+
defined?(::Sidekiq) && ::Sidekiq.respond_to?(:configure_server) && ::Instana.config[:'sidekiq-worker'][:enabled]
|
9
9
|
end
|
10
10
|
|
11
11
|
def instrument
|
@@ -49,11 +49,10 @@ module Instana
|
|
49
49
|
response = @client.send_request('POST', path, spans)
|
50
50
|
|
51
51
|
unless response.ok?
|
52
|
+
@logger.debug("Sent `#{spans.count}` spans to `#{path}` and got `#{response.code}`.")
|
52
53
|
@discovery.swap { nil }
|
53
54
|
break
|
54
55
|
end
|
55
|
-
|
56
|
-
@logger.debug("Sent `#{spans.count}` spans to `#{path}` and got `#{response.code}`.")
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
@@ -68,10 +67,9 @@ module Instana
|
|
68
67
|
if response.ok?
|
69
68
|
handle_agent_tasks(response, discovery) unless response.body.empty?
|
70
69
|
else
|
70
|
+
@logger.debug("Sent `#{payload}` to `#{path}` and got `#{response.code}`.")
|
71
71
|
@discovery.swap { nil }
|
72
72
|
end
|
73
|
-
|
74
|
-
@logger.debug("Sent `#{payload}` to `#{path}` and got `#{response.code}`.")
|
75
73
|
end
|
76
74
|
|
77
75
|
def handle_agent_tasks(response, discovery)
|
data/lib/instana/config.rb
CHANGED
@@ -27,6 +27,9 @@ module Instana
|
|
27
27
|
# Enable/disable tracing (default: enabled)
|
28
28
|
@config[:tracing] = { :enabled => true }
|
29
29
|
|
30
|
+
# Enable/Disable logging
|
31
|
+
@config[:logging] = { :enabled => true }
|
32
|
+
|
30
33
|
# Collector interval
|
31
34
|
@config[:collector] = { :enabled => true, :interval => 1 }
|
32
35
|
|
@@ -3,9 +3,6 @@
|
|
3
3
|
|
4
4
|
if ::Rails::VERSION::MAJOR < 3
|
5
5
|
::Rails.configuration.after_initialize do
|
6
|
-
# In Rails, let's use the Rails logger
|
7
|
-
::Instana.logger = ::Rails.logger if ::Rails.logger
|
8
|
-
|
9
6
|
if ::Instana.config[:tracing][:enabled]
|
10
7
|
::Instana.logger.debug "Instrumenting Rack"
|
11
8
|
::Rails.configuration.middleware.insert 0, ::Instana::Rack
|
@@ -17,8 +14,11 @@ else
|
|
17
14
|
module ::Instana
|
18
15
|
class Railtie < ::Rails::Railtie
|
19
16
|
initializer 'instana.rack' do |app|
|
20
|
-
#
|
21
|
-
::Instana.
|
17
|
+
# Configure the Instrumented Logger
|
18
|
+
if ::Instana.config[:logging][:enabled] && !ENV.key?('INSTANA_TEST')
|
19
|
+
logger = ::Instana::InstrumentedLogger.new('/dev/null')
|
20
|
+
Rails.logger.extend(ActiveSupport::Logger.broadcast(logger))
|
21
|
+
end
|
22
22
|
|
23
23
|
if ::Instana.config[:tracing][:enabled]
|
24
24
|
::Instana.logger.debug "Instrumenting Rack"
|
@@ -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,52 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
3
|
+
|
4
|
+
module Instana
|
5
|
+
module Instrumentation
|
6
|
+
module ActiveJob
|
7
|
+
def self.prepended(target)
|
8
|
+
target.around_enqueue do |job, block|
|
9
|
+
tags = {
|
10
|
+
activejob: {
|
11
|
+
queue: job.queue_name,
|
12
|
+
job: job.class.to_s,
|
13
|
+
action: :enqueue,
|
14
|
+
job_id: job.job_id
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
::Instana::Tracer.trace(:activejob, tags) do
|
19
|
+
context = ::Instana.tracer.context
|
20
|
+
job.arguments = [{
|
21
|
+
given_arguments: job.arguments,
|
22
|
+
instana_context: context ? context.to_hash : nil
|
23
|
+
}]
|
24
|
+
|
25
|
+
block.call
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
target.around_perform do |job, block|
|
30
|
+
tags = {
|
31
|
+
activejob: {
|
32
|
+
queue: job.queue_name,
|
33
|
+
job: job.class.to_s,
|
34
|
+
action: :perform,
|
35
|
+
job_id: job.job_id
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
incoming_context = if job.arguments.is_a?(Array) && job.arguments.first.is_a?(Hash)
|
40
|
+
instana_context = job.arguments.first[:instana_context]
|
41
|
+
job.arguments = job.arguments.first[:given_arguments]
|
42
|
+
instana_context ? ::Instana::SpanContext.new(instana_context[:trace_id], instana_context[:span_id]) : nil
|
43
|
+
end
|
44
|
+
|
45
|
+
::Instana::Tracer.start_or_continue_trace(:activejob, tags, incoming_context) do
|
46
|
+
block.call
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|