instana 1.199.6 → 1.202.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 +41 -6
- data/.rubocop.yml +11 -2
- data/lib/instana.rb +2 -4
- data/lib/instana/activator.rb +13 -1
- 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_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/resque_worker.rb +4 -2
- 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 +7 -6
- 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 +6 -1
- data/lib/instana/frameworks/rails.rb +5 -5
- data/lib/instana/frameworks/roda.rb +1 -1
- data/lib/instana/instrumentation/active_job.rb +52 -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/shoryuken.rb +1 -1
- data/lib/instana/instrumented_logger.rb +26 -0
- data/lib/instana/setup.rb +5 -1
- 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/processor.rb +8 -5
- data/lib/instana/tracing/span.rb +2 -2
- data/lib/instana/tracing/span_context.rb +1 -1
- data/lib/instana/version.rb +1 -1
- data/test/instrumentation/rails_active_job_test.rb +65 -0
- data/test/test_helper.rb +10 -1
- data/test/tracing/instrumented_logger_test.rb +39 -0
- metadata +9 -10
- data/benchmarks/10k-rack-traces.rb +0 -95
- data/benchmarks/Gemfile +0 -11
- data/benchmarks/Gemfile.lock +0 -38
- data/benchmarks/id_generation.rb +0 -16
- data/benchmarks/opentracing.rb +0 -30
- data/benchmarks/rack_vanilla_vs_traced.rb +0 -88
- data/benchmarks/stackprof_rack_tracing.rb +0 -80
- data/benchmarks/time_processing.rb +0 -16
@@ -10,7 +10,7 @@ module Instana
|
|
10
10
|
op: format_operation(context.operation_name),
|
11
11
|
bucket: bucket_name_from(context),
|
12
12
|
key: key_from_context(context)
|
13
|
-
}.
|
13
|
+
}.reject { |_, v| v.nil? }
|
14
14
|
|
15
15
|
::Instana.tracer.trace(:s3, {s3: s3_tags}) { @handler.call(context) }
|
16
16
|
end
|
@@ -11,7 +11,7 @@ module Instana
|
|
11
11
|
target: context.params[:target_arn],
|
12
12
|
phone: context.params[:phone_number],
|
13
13
|
subject: context.params[:subject]
|
14
|
-
}.
|
14
|
+
}.reject { |_, v| v.nil? }
|
15
15
|
|
16
16
|
if context.operation_name == :publish
|
17
17
|
::Instana.tracer.trace(:sns, {sns: sns_tags}) { @handler.call(context) }
|
@@ -13,7 +13,7 @@ module Instana
|
|
13
13
|
return @handler.call(context)
|
14
14
|
end
|
15
15
|
|
16
|
-
span_tags = tags_for(context.operation_name, context.params).
|
16
|
+
span_tags = tags_for(context.operation_name, context.params).reject { |_, v| v.nil? }
|
17
17
|
|
18
18
|
::Instana.tracer.trace(:sqs, {sqs: span_tags}) do |span|
|
19
19
|
case context.operation_name
|
@@ -74,7 +74,7 @@ module Instana
|
|
74
74
|
host: host_with_port,
|
75
75
|
header: extra_header_tags,
|
76
76
|
params: request_params
|
77
|
-
}.
|
77
|
+
}.reject { |_, v| v.nil? }
|
78
78
|
end
|
79
79
|
|
80
80
|
def correlation_data
|
@@ -123,7 +123,7 @@ module Instana
|
|
123
123
|
external_trace_id: external_trace_id,
|
124
124
|
external_state: @env['HTTP_TRACESTATE'],
|
125
125
|
from_w3: false
|
126
|
-
}.
|
126
|
+
}.reject { |_, v| v.nil? }
|
127
127
|
end
|
128
128
|
|
129
129
|
def context_from_trace_parent
|
@@ -150,7 +150,7 @@ module Instana
|
|
150
150
|
trace_id: state[:t],
|
151
151
|
span_id: state[:p],
|
152
152
|
from_w3: false
|
153
|
-
}.
|
153
|
+
}.reject { |_, v| v.nil? }
|
154
154
|
end
|
155
155
|
|
156
156
|
def parse_trace_state
|
@@ -179,7 +179,7 @@ module Instana
|
|
179
179
|
{
|
180
180
|
type: data['correlationType'],
|
181
181
|
id: data['correlationId']
|
182
|
-
}.
|
182
|
+
}.reject { |_, v| v.nil? }
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
3
|
+
|
4
|
+
module Instana
|
5
|
+
class InstrumentedLogger < Logger
|
6
|
+
LEVEL_LABELS = %w[Debug Info Warn Error Fatal Any].freeze
|
7
|
+
|
8
|
+
def instana_log_level
|
9
|
+
WARN
|
10
|
+
end
|
11
|
+
|
12
|
+
def add(severity, message = nil, progname = nil)
|
13
|
+
severity ||= UNKNOWN
|
14
|
+
|
15
|
+
if severity >= instana_log_level && ::Instana.tracer.tracing?
|
16
|
+
tags = {
|
17
|
+
level: LEVEL_LABELS[severity],
|
18
|
+
message: "#{message} #{progname}".strip
|
19
|
+
}
|
20
|
+
Instana::Tracer.trace(:log, {log: tags}) {}
|
21
|
+
end
|
22
|
+
|
23
|
+
super(severity, message, progname)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/instana/setup.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# (c) Copyright IBM Corp. 2021
|
2
2
|
# (c) Copyright Instana Inc. 2016
|
3
3
|
|
4
|
+
require 'logger'
|
5
|
+
require 'concurrent'
|
6
|
+
require 'sys-proctable'
|
7
|
+
|
4
8
|
require 'instana/logger_delegator'
|
9
|
+
require 'instana/instrumented_logger'
|
5
10
|
|
6
11
|
require "instana/base"
|
7
12
|
require "instana/config"
|
@@ -37,7 +42,6 @@ require 'instana/backend/agent'
|
|
37
42
|
|
38
43
|
::Instana.setup
|
39
44
|
::Instana.agent.setup
|
40
|
-
::Instana::Activator.start
|
41
45
|
|
42
46
|
# Require supported OpenTracing interfaces
|
43
47
|
require "opentracing"
|
@@ -5,6 +5,9 @@ require 'thread'
|
|
5
5
|
|
6
6
|
module Instana
|
7
7
|
class Processor
|
8
|
+
extend Forwardable
|
9
|
+
def_delegators :@queue, :empty?
|
10
|
+
|
8
11
|
def initialize(logger: ::Instana.logger)
|
9
12
|
# The main queue before being reported to the
|
10
13
|
# host agent. Spans in this queue are complete
|
@@ -15,7 +18,7 @@ module Instana
|
|
15
18
|
# agent at once.
|
16
19
|
@batch_size = 3000
|
17
20
|
@logger = logger
|
18
|
-
@pid =
|
21
|
+
@pid = Process.pid
|
19
22
|
end
|
20
23
|
|
21
24
|
# Adds a span to the span queue
|
@@ -23,10 +26,10 @@ module Instana
|
|
23
26
|
# @param [Trace] - the trace to be added to the queue
|
24
27
|
def add_span(span)
|
25
28
|
# :nocov:
|
26
|
-
if @pid !=
|
27
|
-
@logger.info("Proces `#{@pid}` has forked into #{
|
28
|
-
::Instana.
|
29
|
-
@pid =
|
29
|
+
if @pid != Process.pid
|
30
|
+
@logger.info("Proces `#{@pid}` has forked into #{Process.pid}. Running post fork hook.")
|
31
|
+
::Instana.config[:post_fork_proc].call
|
32
|
+
@pid = Process.pid
|
30
33
|
end
|
31
34
|
# :nocov:
|
32
35
|
|
data/lib/instana/tracing/span.rb
CHANGED
@@ -6,10 +6,10 @@ 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' ].freeze
|
9
|
+
:redis, :'resque-client', :'resque-worker', :'graphql.server', :dynamodb, :s3, :sns, :sqs, :'aws.lambda.entry', :activejob, :log ].freeze
|
10
10
|
ENTRY_SPANS = [ :rack, :'resque-worker', :'rpc-server', :'sidekiq-worker', :'graphql.server', :sqs, :'aws.lambda.entry' ].freeze
|
11
11
|
EXIT_SPANS = [ :activerecord, :excon, :'net-http', :'resque-client',
|
12
|
-
:'rpc-client', :'sidekiq-client', :redis, :dynamodb, :s3, :sns, :sqs ].freeze
|
12
|
+
:'rpc-client', :'sidekiq-client', :redis, :dynamodb, :s3, :sns, :sqs, :log ].freeze
|
13
13
|
HTTP_SPANS = [ :rack, :excon, :'net-http' ].freeze
|
14
14
|
|
15
15
|
attr_accessor :parent
|
data/lib/instana/version.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
|
6
|
+
require 'rails'
|
7
|
+
require 'active_job'
|
8
|
+
|
9
|
+
class RailsActiveJobTest < Minitest::Test
|
10
|
+
class SampleJob < ActiveJob::Base
|
11
|
+
queue_as :test_queue
|
12
|
+
|
13
|
+
def perform(*args); end
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@test_adapter = ActiveJob::Base.queue_adapter = ActiveJob::QueueAdapters::TestAdapter.new
|
18
|
+
ActiveJob::Base.logger = Logger.new('/dev/null')
|
19
|
+
|
20
|
+
clear_all!
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_perform_now
|
24
|
+
SampleJob.perform_now("test_perform_now")
|
25
|
+
spans = ::Instana.processor.queued_spans
|
26
|
+
|
27
|
+
server_span, *rest = spans
|
28
|
+
assert_equal [], rest
|
29
|
+
|
30
|
+
assert_equal :activejob, server_span[:n]
|
31
|
+
assert_equal 'RailsActiveJobTest::SampleJob', server_span[:data][:activejob][:job]
|
32
|
+
assert_equal :perform, server_span[:data][:activejob][:action]
|
33
|
+
assert_equal 'test_queue', server_span[:data][:activejob][:queue]
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_enqueue_perform
|
37
|
+
# ActiveJob::QueueAdapters::TestAdapter.new doesn't work for this test on any version less than 6
|
38
|
+
skip unless Rails::VERSION::MAJOR >= 6
|
39
|
+
|
40
|
+
Instana.tracer.start_or_continue_trace(:peform_test) do
|
41
|
+
SampleJob.perform_later("test_enqueue_perform")
|
42
|
+
end
|
43
|
+
|
44
|
+
job, *rest_jobs = @test_adapter.enqueued_jobs
|
45
|
+
assert_equal [], rest_jobs
|
46
|
+
|
47
|
+
ActiveJob::Base.execute(job)
|
48
|
+
|
49
|
+
spans = ::Instana.processor.queued_spans
|
50
|
+
client_span, _test_span, server_span, *rest = spans
|
51
|
+
assert_equal [], rest
|
52
|
+
|
53
|
+
assert_equal :activejob, server_span[:n]
|
54
|
+
assert_equal 'RailsActiveJobTest::SampleJob', server_span[:data][:activejob][:job]
|
55
|
+
assert_equal :perform, server_span[:data][:activejob][:action]
|
56
|
+
|
57
|
+
assert_equal :activejob, client_span[:n]
|
58
|
+
assert_equal 'RailsActiveJobTest::SampleJob', client_span[:data][:activejob][:job]
|
59
|
+
assert_equal :enqueue, client_span[:data][:activejob][:action]
|
60
|
+
assert_equal 'test_queue', server_span[:data][:activejob][:queue]
|
61
|
+
|
62
|
+
assert_equal client_span[:t], server_span[:t]
|
63
|
+
assert_equal client_span[:s], server_span[:p]
|
64
|
+
end
|
65
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -50,5 +50,14 @@ WebMock.disable_net_connect!(
|
|
50
50
|
|
51
51
|
Dir['test/support/*.rb'].each { |f| load(f) }
|
52
52
|
|
53
|
-
|
53
|
+
if ENV['CI']
|
54
|
+
Minitest::Reporters.use!([
|
55
|
+
Minitest::Reporters::JUnitReporter.new('_junit', false),
|
56
|
+
Minitest::Reporters::SpecReporter.new
|
57
|
+
])
|
58
|
+
else
|
59
|
+
Minitest::Reporters.use!([
|
60
|
+
MiniTest::Reporters::SpecReporter.new
|
61
|
+
])
|
62
|
+
end
|
54
63
|
Minitest::Test.include(Instana::TestHelpers)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2021
|
2
|
+
# (c) Copyright Instana Inc. 2021
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
|
6
|
+
class InstrumentedLoggerTest < Minitest::Test
|
7
|
+
def setup
|
8
|
+
clear_all!
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_log_warn_error
|
12
|
+
subject = Instana::InstrumentedLogger.new('/dev/null')
|
13
|
+
|
14
|
+
Instana::Tracer.start_or_continue_trace(:test_logging) do
|
15
|
+
subject.warn('warn')
|
16
|
+
subject.debug('test')
|
17
|
+
subject.error('error')
|
18
|
+
end
|
19
|
+
|
20
|
+
spans = ::Instana.processor.queued_spans
|
21
|
+
|
22
|
+
warn_span, error_span, = *spans
|
23
|
+
|
24
|
+
assert_equal :log, warn_span[:n]
|
25
|
+
assert_equal 'warn', warn_span[:data][:log][:message]
|
26
|
+
assert_equal 'Warn', warn_span[:data][:log][:level]
|
27
|
+
|
28
|
+
assert_equal :log, error_span[:n]
|
29
|
+
assert_equal 'error', error_span[:data][:log][:message]
|
30
|
+
assert_equal 'Error', error_span[:data][:log][:level]
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_no_trace
|
34
|
+
subject = Instana::InstrumentedLogger.new('/dev/null')
|
35
|
+
subject.warn('warn')
|
36
|
+
|
37
|
+
assert_equal [], ::Instana.processor.queued_spans
|
38
|
+
end
|
39
|
+
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.202.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-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -143,14 +143,6 @@ files:
|
|
143
143
|
- LICENSE
|
144
144
|
- README.md
|
145
145
|
- Rakefile
|
146
|
-
- benchmarks/10k-rack-traces.rb
|
147
|
-
- benchmarks/Gemfile
|
148
|
-
- benchmarks/Gemfile.lock
|
149
|
-
- benchmarks/id_generation.rb
|
150
|
-
- benchmarks/opentracing.rb
|
151
|
-
- benchmarks/rack_vanilla_vs_traced.rb
|
152
|
-
- benchmarks/stackprof_rack_tracing.rb
|
153
|
-
- benchmarks/time_processing.rb
|
154
146
|
- bin/console
|
155
147
|
- bin/setup
|
156
148
|
- docker-compose.yml
|
@@ -191,6 +183,7 @@ files:
|
|
191
183
|
- lib/instana/activators/action_controller_api.rb
|
192
184
|
- lib/instana/activators/action_controller_base.rb
|
193
185
|
- lib/instana/activators/action_view.rb
|
186
|
+
- lib/instana/activators/active_job.rb
|
194
187
|
- lib/instana/activators/active_record.rb
|
195
188
|
- lib/instana/activators/aws_sdk_dynamodb.rb
|
196
189
|
- lib/instana/activators/aws_sdk_s3.rb
|
@@ -232,6 +225,7 @@ files:
|
|
232
225
|
- lib/instana/instrumentation/action_cable.rb
|
233
226
|
- lib/instana/instrumentation/action_controller.rb
|
234
227
|
- lib/instana/instrumentation/action_view.rb
|
228
|
+
- lib/instana/instrumentation/active_job.rb
|
235
229
|
- lib/instana/instrumentation/active_record.rb
|
236
230
|
- lib/instana/instrumentation/aws_sdk_dynamodb.rb
|
237
231
|
- lib/instana/instrumentation/aws_sdk_s3.rb
|
@@ -250,6 +244,7 @@ files:
|
|
250
244
|
- lib/instana/instrumentation/shoryuken.rb
|
251
245
|
- lib/instana/instrumentation/sidekiq-client.rb
|
252
246
|
- lib/instana/instrumentation/sidekiq-worker.rb
|
247
|
+
- lib/instana/instrumented_logger.rb
|
253
248
|
- lib/instana/logger_delegator.rb
|
254
249
|
- lib/instana/open_tracing/carrier.rb
|
255
250
|
- lib/instana/open_tracing/instana_tracer.rb
|
@@ -302,6 +297,7 @@ files:
|
|
302
297
|
- test/instrumentation/rails_action_cable_test.rb
|
303
298
|
- test/instrumentation/rails_action_controller_test.rb
|
304
299
|
- test/instrumentation/rails_action_view_test.rb
|
300
|
+
- test/instrumentation/rails_active_job_test.rb
|
305
301
|
- test/instrumentation/rails_active_record_test.rb
|
306
302
|
- test/instrumentation/redis_test.rb
|
307
303
|
- test/instrumentation/resque_test.rb
|
@@ -339,6 +335,7 @@ files:
|
|
339
335
|
- test/test_helper.rb
|
340
336
|
- test/tracing/custom_test.rb
|
341
337
|
- test/tracing/id_management_test.rb
|
338
|
+
- test/tracing/instrumented_logger_test.rb
|
342
339
|
- test/tracing/opentracing_test.rb
|
343
340
|
- test/tracing/processor_test.rb
|
344
341
|
- test/tracing/span_context_test.rb
|
@@ -383,6 +380,7 @@ test_files:
|
|
383
380
|
- test/tracing/tracer_test.rb
|
384
381
|
- test/tracing/custom_test.rb
|
385
382
|
- test/tracing/opentracing_test.rb
|
383
|
+
- test/tracing/instrumented_logger_test.rb
|
386
384
|
- test/tracing/tracer_async_test.rb
|
387
385
|
- test/tracing/processor_test.rb
|
388
386
|
- test/snapshot/docker_container_test.rb
|
@@ -412,6 +410,7 @@ test_files:
|
|
412
410
|
- test/instrumentation/resque_test.rb
|
413
411
|
- test/instrumentation/sidekiq-worker_test.rb
|
414
412
|
- test/instrumentation/rails_action_view_test.rb
|
413
|
+
- test/instrumentation/rails_active_job_test.rb
|
415
414
|
- test/instrumentation/rack_test.rb
|
416
415
|
- test/instrumentation/rack_instrumented_request_test.rb
|
417
416
|
- test/instrumentation/shoryuken_test.rb
|
@@ -1,95 +0,0 @@
|
|
1
|
-
# (c) Copyright IBM Corp. 2021
|
2
|
-
# (c) Copyright Instana Inc. 2017
|
3
|
-
|
4
|
-
require "bundler"
|
5
|
-
|
6
|
-
require 'rack'
|
7
|
-
require 'rack/builder'
|
8
|
-
require 'rack/handler/puma'
|
9
|
-
require 'net/http'
|
10
|
-
require "cgi"
|
11
|
-
Bundler.require(:default)
|
12
|
-
require "instana/rack"
|
13
|
-
require 'ruby-prof'
|
14
|
-
|
15
|
-
Thread.new do
|
16
|
-
app = Rack::Builder.new {
|
17
|
-
map "/" do
|
18
|
-
run Proc.new {
|
19
|
-
[200, {"Content-Type" => "application/json"}, ["[\"Stan\",\"is\",\"on\",\"the\",\"scene!\"]"]]
|
20
|
-
}
|
21
|
-
end
|
22
|
-
map "/error" do
|
23
|
-
run Proc.new {
|
24
|
-
[500, {"Content-Type" => "application/json"}, ["[\"Stan\",\"is\",\"on\",\"the\",\"error!\"]"]]
|
25
|
-
}
|
26
|
-
end
|
27
|
-
}
|
28
|
-
|
29
|
-
Rack::Handler::Puma.run(app, {:Host => '127.0.0.1', :Port => 7011})
|
30
|
-
end
|
31
|
-
|
32
|
-
Thread.new do
|
33
|
-
app = Rack::Builder.new {
|
34
|
-
use ::Instana::Rack
|
35
|
-
map "/" do
|
36
|
-
run Proc.new {
|
37
|
-
[200, {"Content-Type" => "application/json"}, ["[\"Stan\",\"is\",\"on\",\"the\",\"scene!\"]"]]
|
38
|
-
}
|
39
|
-
end
|
40
|
-
map "/error" do
|
41
|
-
run Proc.new {
|
42
|
-
[500, {"Content-Type" => "application/json"}, ["[\"Stan\",\"is\",\"on\",\"the\",\"error!\"]"]]
|
43
|
-
}
|
44
|
-
end
|
45
|
-
}
|
46
|
-
|
47
|
-
Rack::Handler::Puma.run(app, {:Host => '127.0.0.1', :Port => 7012})
|
48
|
-
end
|
49
|
-
|
50
|
-
puts ""
|
51
|
-
puts "Vanilla Rack server started in background thread on localhost:7011"
|
52
|
-
puts "Instrumented Rack server started in background thread on localhost:7012"
|
53
|
-
puts ""
|
54
|
-
puts "Waiting on successful announce to host agent..."
|
55
|
-
puts ""
|
56
|
-
|
57
|
-
#RubyProf.measure_mode = RubyProf::WALL_TIME
|
58
|
-
#RubyProf.measure_mode = RubyProf::PROCESS_TIME
|
59
|
-
RubyProf.measure_mode = RubyProf::ALLOCATIONS
|
60
|
-
#RubyProf.measure_mode = RubyProf::MEMORY
|
61
|
-
|
62
|
-
while !::Instana.agent.ready? do
|
63
|
-
sleep 2
|
64
|
-
end
|
65
|
-
|
66
|
-
puts "Starting 10k Traces..."
|
67
|
-
|
68
|
-
# uri = URI.parse("http://127.0.0.1:7011/")
|
69
|
-
# ::Net::HTTP.start(uri.host, uri.port) do |hc|
|
70
|
-
# x.report("vanilla") {
|
71
|
-
# 10_000.times {
|
72
|
-
# req = Net::HTTP::Get.new(uri.request_uri)
|
73
|
-
# hc.request(req)
|
74
|
-
# }
|
75
|
-
# }
|
76
|
-
# end
|
77
|
-
|
78
|
-
uri = URI.parse("http://127.0.0.1:7012/")
|
79
|
-
result = RubyProf.profile do
|
80
|
-
1.times {
|
81
|
-
::Instana.tracer.start_or_continue_trace(:job, {:kind => :entry}) do
|
82
|
-
::Net::HTTP.start(uri.host, uri.port) do |hc|
|
83
|
-
::Instana.tracer.start_or_continue_trace(:rack_call) do
|
84
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
85
|
-
hc.request(req)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
}
|
90
|
-
end
|
91
|
-
|
92
|
-
puts "Done - displaying results..."
|
93
|
-
|
94
|
-
printer = RubyProf::FlatPrinter.new(result)
|
95
|
-
printer.print(STDOUT, {})
|