instana 1.199.3 → 1.200.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/.circleci/config.yml +27 -1
- data/.rubocop.yml +11 -2
- data/lib/instana.rb +2 -4
- 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 +17 -11
- data/lib/instana/backend/host_agent_activation_observer.rb +2 -2
- data/lib/instana/backend/serverless_agent.rb +1 -1
- data/lib/instana/config.rb +3 -1
- data/lib/instana/frameworks/roda.rb +1 -1
- 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/setup.rb +3 -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_context.rb +1 -1
- data/lib/instana/version.rb +1 -1
- metadata +59 -67
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 300da2a4ba4b62f11b6028d9c1482c896be48bf8e17d78f3053e0e54c9bbfa0d
|
4
|
+
data.tar.gz: 2956c4c1f541ed290aad66c937ef3700a8e5809062cb29c4badb24754fbcf2f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac726cfb46337984d4a57e372b6a64dd39b8cbcfdd8b4c34bd03ab6a01013293526d52842709dee38b7dd657c27c8bf0634cc065bcc523b740bfa8377b601f5
|
7
|
+
data.tar.gz: 97c0442d0ce046cddef5b782d365b64d8b5b28501967541585b8859f45fe5266f95ac35a9a1ddd137c30818948515ae1f163cb565a5b6807273f01faccf26447
|
data/.circleci/config.yml
CHANGED
@@ -155,7 +155,19 @@ commands:
|
|
155
155
|
name: Run Tests
|
156
156
|
command: |
|
157
157
|
bundle exec rubocop
|
158
|
-
|
158
|
+
publish_gem:
|
159
|
+
steps:
|
160
|
+
- run:
|
161
|
+
name: Setup Access
|
162
|
+
command: |
|
163
|
+
mkdir -p ~/.gem
|
164
|
+
echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
|
165
|
+
chmod 0600 /home/circleci/.gem/credentials
|
166
|
+
- run:
|
167
|
+
name: Publish Gem
|
168
|
+
command: |
|
169
|
+
bundle exec rake release[origin]
|
170
|
+
|
159
171
|
jobs:
|
160
172
|
test_core:
|
161
173
|
parameters:
|
@@ -189,8 +201,22 @@ jobs:
|
|
189
201
|
- checkout
|
190
202
|
- setup
|
191
203
|
- run_rubocop
|
204
|
+
publish:
|
205
|
+
executor: ruby_27
|
206
|
+
steps:
|
207
|
+
- checkout
|
208
|
+
- setup
|
209
|
+
- publish_gem
|
192
210
|
|
193
211
|
workflows:
|
212
|
+
publish:
|
213
|
+
jobs:
|
214
|
+
- publish:
|
215
|
+
filters:
|
216
|
+
branches:
|
217
|
+
ignore: /.*/
|
218
|
+
tags:
|
219
|
+
only: /^v.*/
|
194
220
|
core:
|
195
221
|
jobs:
|
196
222
|
- lint
|
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/lib/instana.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# (c) Copyright IBM Corp. 2021
|
2
2
|
# (c) Copyright Instana Inc. 2016
|
3
3
|
|
4
|
-
require '
|
5
|
-
require 'sys-proctable'
|
6
|
-
|
7
|
-
require "instana/setup"
|
4
|
+
require 'instana/setup'
|
8
5
|
|
9
6
|
# Boot the instana agent background thread. If you wish to have greater
|
10
7
|
# control on the where and which thread this is run in, instead use
|
@@ -15,4 +12,5 @@ require "instana/setup"
|
|
15
12
|
# the thread of your choice.
|
16
13
|
#
|
17
14
|
|
15
|
+
::Instana::Activator.start
|
18
16
|
::Instana.agent.spawn_background_thread
|
@@ -16,8 +16,10 @@ module Instana
|
|
16
16
|
::Resque::Worker.prepend(::Instana::Instrumentation::ResqueWorker)
|
17
17
|
::Resque::Job.prepend(::Instana::Instrumentation::ResqueJob)
|
18
18
|
|
19
|
-
::
|
20
|
-
::
|
19
|
+
if ::Instana.config[:'resque-worker'][:'setup-fork']
|
20
|
+
::Resque.after_fork do |_job|
|
21
|
+
::Instana.agent.after_fork
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
# Set this so we assure that any remaining collected traces are reported at_exit
|
@@ -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
|
@@ -5,12 +5,13 @@ module Instana
|
|
5
5
|
module Backend
|
6
6
|
# @since 1.197.0
|
7
7
|
class HostAgent
|
8
|
-
attr_reader :future
|
8
|
+
attr_reader :future, :client
|
9
9
|
|
10
10
|
def initialize(discovery: Concurrent::Atom.new(nil), logger: ::Instana.logger)
|
11
11
|
@discovery = discovery
|
12
12
|
@logger = logger
|
13
13
|
@future = nil
|
14
|
+
@client = nil
|
14
15
|
end
|
15
16
|
|
16
17
|
def setup; end
|
@@ -19,19 +20,24 @@ module Instana
|
|
19
20
|
return if ENV.key?('INSTANA_TEST')
|
20
21
|
|
21
22
|
@future = Concurrent::Promises.future do
|
22
|
-
|
23
|
-
@discovery.delete_observers
|
24
|
-
@discovery
|
25
|
-
.with_observer(HostAgentActivationObserver.new(client, @discovery))
|
26
|
-
.with_observer(HostAgentReportingObserver.new(client, @discovery))
|
27
|
-
|
28
|
-
@discovery.swap { nil }
|
29
|
-
client
|
23
|
+
announce
|
30
24
|
end
|
31
25
|
end
|
32
26
|
|
33
27
|
alias start spawn_background_thread
|
34
|
-
|
28
|
+
|
29
|
+
def announce
|
30
|
+
@client = until_not_nil { HostAgentLookup.new.call }
|
31
|
+
@discovery.delete_observers
|
32
|
+
@discovery
|
33
|
+
.with_observer(HostAgentActivationObserver.new(@client, @discovery))
|
34
|
+
.with_observer(HostAgentReportingObserver.new(@client, @discovery))
|
35
|
+
|
36
|
+
@discovery.swap { nil }
|
37
|
+
@client
|
38
|
+
end
|
39
|
+
|
40
|
+
alias after_fork announce
|
35
41
|
|
36
42
|
# @return [Boolean] true if the agent able to send spans to the backend
|
37
43
|
def ready?
|
@@ -43,7 +49,7 @@ module Instana
|
|
43
49
|
{
|
44
50
|
e: discovery_value['pid'],
|
45
51
|
h: discovery_value['agentUuid']
|
46
|
-
}.
|
52
|
+
}.reject { |_, v| v.nil? }
|
47
53
|
end
|
48
54
|
|
49
55
|
# @return [Array] extra headers to include in the trace
|
@@ -12,7 +12,7 @@ module Instana
|
|
12
12
|
|
13
13
|
# @param [RequestClient] client used to make requests to the backend
|
14
14
|
# @param [Concurrent::Atom] discovery object used to store discovery response in
|
15
|
-
def initialize(client, discovery, wait_time:
|
15
|
+
def initialize(client, discovery, wait_time: 30, logger: ::Instana.logger, max_wait_tries: 60, proc_table: Sys::ProcTable, socket_proc: default_socket_proc) # rubocop:disable Metrics/ParameterLists
|
16
16
|
@client = client
|
17
17
|
@discovery = discovery
|
18
18
|
@wait_time = wait_time
|
@@ -82,7 +82,7 @@ module Instana
|
|
82
82
|
def try_forever_with_backoff
|
83
83
|
yield
|
84
84
|
rescue DiscoveryError, Net::OpenTimeout => e
|
85
|
-
@logger.
|
85
|
+
@logger.debug(e)
|
86
86
|
sleep(@wait_time)
|
87
87
|
retry
|
88
88
|
rescue StandardError => e
|
data/lib/instana/config.rb
CHANGED
@@ -53,6 +53,8 @@ module Instana
|
|
53
53
|
# W3 Trace Context Support
|
54
54
|
@config[:w3_trace_correlation] = ENV['INSTANA_DISABLE_W3C_TRACE_CORRELATION'].nil?
|
55
55
|
|
56
|
+
@config[:post_fork_proc] = proc { ::Instana.agent.spawn_background_thread }
|
57
|
+
|
56
58
|
@config[:action_controller] = { :enabled => true }
|
57
59
|
@config[:action_view] = { :enabled => true }
|
58
60
|
@config[:active_record] = { :enabled => true }
|
@@ -63,7 +65,7 @@ module Instana
|
|
63
65
|
@config[:nethttp] = { :enabled => true }
|
64
66
|
@config[:redis] = { :enabled => true }
|
65
67
|
@config[:'resque-client'] = { :enabled => true }
|
66
|
-
@config[:'resque-worker'] = { :enabled => true }
|
68
|
+
@config[:'resque-worker'] = { :enabled => true, :'setup-fork' => true }
|
67
69
|
@config[:'rest-client'] = { :enabled => true }
|
68
70
|
@config[:'sidekiq-client'] = { :enabled => true }
|
69
71
|
@config[:'sidekiq-worker'] = { :enabled => true }
|
@@ -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
|
data/lib/instana/setup.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# (c) Copyright IBM Corp. 2021
|
2
2
|
# (c) Copyright Instana Inc. 2016
|
3
3
|
|
4
|
+
require 'concurrent'
|
5
|
+
require 'sys-proctable'
|
6
|
+
|
4
7
|
require 'instana/logger_delegator'
|
5
8
|
|
6
9
|
require "instana/base"
|
@@ -37,7 +40,6 @@ require 'instana/backend/agent'
|
|
37
40
|
|
38
41
|
::Instana.setup
|
39
42
|
::Instana.agent.setup
|
40
|
-
::Instana::Activator.start
|
41
43
|
|
42
44
|
# Require supported OpenTracing interfaces
|
43
45
|
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/version.rb
CHANGED
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.200.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-08 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
|
@@ -369,80 +361,80 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
361
|
- !ruby/object:Gem::Version
|
370
362
|
version: '0'
|
371
363
|
requirements: []
|
372
|
-
rubygems_version: 3.
|
364
|
+
rubygems_version: 3.1.6
|
373
365
|
signing_key:
|
374
366
|
specification_version: 4
|
375
367
|
summary: Ruby Distributed Tracing & Metrics Sensor for Instana
|
376
368
|
test_files:
|
377
|
-
- test/config_test.rb
|
378
|
-
- test/serverless_test.rb
|
379
369
|
- test/activator_test.rb
|
380
|
-
- test/
|
381
|
-
- test/tracing/span_test.rb
|
382
|
-
- test/tracing/id_management_test.rb
|
383
|
-
- test/tracing/tracer_test.rb
|
384
|
-
- test/tracing/custom_test.rb
|
385
|
-
- test/tracing/opentracing_test.rb
|
386
|
-
- test/tracing/tracer_async_test.rb
|
387
|
-
- test/tracing/processor_test.rb
|
388
|
-
- test/snapshot/docker_container_test.rb
|
389
|
-
- test/snapshot/fargate_process_test.rb
|
390
|
-
- test/snapshot/deltable_test.rb
|
391
|
-
- test/snapshot/fargate_task_test.rb
|
392
|
-
- test/snapshot/ruby_process_test.rb
|
393
|
-
- test/snapshot/google_cloud_run_process_test.rb
|
394
|
-
- test/snapshot/lambda_function_test.rb
|
395
|
-
- test/snapshot/fargate_container_test.rb
|
396
|
-
- test/snapshot/google_cloud_run_instance_test.rb
|
397
|
-
- test/backend/host_agent_activation_observer_test.rb
|
398
|
-
- test/backend/host_agent_reporting_observer_test.rb
|
370
|
+
- test/backend/agent_test.rb
|
399
371
|
- test/backend/gc_snapshot_test.rb
|
372
|
+
- test/backend/host_agent_activation_observer_test.rb
|
400
373
|
- test/backend/host_agent_lookup_test.rb
|
401
|
-
- test/backend/
|
402
|
-
- test/backend/process_info_test.rb
|
403
|
-
- test/backend/agent_test.rb
|
374
|
+
- test/backend/host_agent_reporting_observer_test.rb
|
404
375
|
- test/backend/host_agent_test.rb
|
376
|
+
- test/backend/process_info_test.rb
|
405
377
|
- test/backend/request_client_test.rb
|
406
|
-
- test/
|
378
|
+
- test/backend/serverless_agent_test.rb
|
379
|
+
- test/benchmarks/bench_id_generation.rb
|
380
|
+
- test/benchmarks/bench_opentracing.rb
|
381
|
+
- test/config_test.rb
|
382
|
+
- test/frameworks/cuba_test.rb
|
383
|
+
- test/frameworks/roda_test.rb
|
384
|
+
- test/frameworks/sinatra_test.rb
|
385
|
+
- test/instana_test.rb
|
386
|
+
- test/instrumentation/aws_test.rb
|
387
|
+
- test/instrumentation/dalli_test.rb
|
388
|
+
- test/instrumentation/excon_test.rb
|
407
389
|
- test/instrumentation/graphql_test.rb
|
408
|
-
- test/instrumentation/
|
409
|
-
- test/instrumentation/rails_action_controller_test.rb
|
410
|
-
- test/instrumentation/rest_client_test.rb
|
390
|
+
- test/instrumentation/grpc_test.rb
|
411
391
|
- test/instrumentation/net_http_test.rb
|
412
|
-
- test/instrumentation/resque_test.rb
|
413
|
-
- test/instrumentation/sidekiq-worker_test.rb
|
414
|
-
- test/instrumentation/rails_action_view_test.rb
|
415
|
-
- test/instrumentation/rack_test.rb
|
416
392
|
- test/instrumentation/rack_instrumented_request_test.rb
|
417
|
-
- test/instrumentation/
|
393
|
+
- test/instrumentation/rack_test.rb
|
394
|
+
- test/instrumentation/rails_action_cable_test.rb
|
395
|
+
- test/instrumentation/rails_action_controller_test.rb
|
396
|
+
- test/instrumentation/rails_action_view_test.rb
|
418
397
|
- test/instrumentation/rails_active_record_test.rb
|
419
398
|
- test/instrumentation/redis_test.rb
|
420
|
-
- test/instrumentation/
|
421
|
-
- test/instrumentation/
|
422
|
-
- test/instrumentation/
|
423
|
-
- test/instrumentation/
|
424
|
-
- test/instrumentation/
|
425
|
-
- test/
|
426
|
-
- test/
|
427
|
-
- test/
|
428
|
-
- test/
|
429
|
-
- test/
|
430
|
-
- test/
|
431
|
-
- test/
|
399
|
+
- test/instrumentation/resque_test.rb
|
400
|
+
- test/instrumentation/rest_client_test.rb
|
401
|
+
- test/instrumentation/shoryuken_test.rb
|
402
|
+
- test/instrumentation/sidekiq-client_test.rb
|
403
|
+
- test/instrumentation/sidekiq-worker_test.rb
|
404
|
+
- test/secrets_test.rb
|
405
|
+
- test/serverless_test.rb
|
406
|
+
- test/snapshot/deltable_test.rb
|
407
|
+
- test/snapshot/docker_container_test.rb
|
408
|
+
- test/snapshot/fargate_container_test.rb
|
409
|
+
- test/snapshot/fargate_process_test.rb
|
410
|
+
- test/snapshot/fargate_task_test.rb
|
411
|
+
- test/snapshot/google_cloud_run_instance_test.rb
|
412
|
+
- test/snapshot/google_cloud_run_process_test.rb
|
413
|
+
- test/snapshot/lambda_function_test.rb
|
414
|
+
- test/snapshot/ruby_process_test.rb
|
415
|
+
- test/support/apps/active_record/active_record.rb
|
432
416
|
- test/support/apps/grpc/boot.rb
|
433
417
|
- test/support/apps/grpc/grpc_server.rb
|
434
|
-
- test/support/apps/active_record/active_record.rb
|
435
|
-
- test/support/apps/resque/boot.rb
|
436
|
-
- test/support/apps/resque/jobs/resque_error_job.rb
|
437
|
-
- test/support/apps/resque/jobs/resque_fast_job.rb
|
438
418
|
- test/support/apps/http_endpoint/boot.rb
|
419
|
+
- test/support/apps/rails/boot.rb
|
439
420
|
- test/support/apps/rails/models/block.rb
|
440
421
|
- test/support/apps/rails/models/block6.rb
|
441
|
-
- test/support/apps/
|
442
|
-
- test/
|
443
|
-
- test/
|
422
|
+
- test/support/apps/resque/boot.rb
|
423
|
+
- test/support/apps/resque/jobs/resque_error_job.rb
|
424
|
+
- test/support/apps/resque/jobs/resque_fast_job.rb
|
425
|
+
- test/support/apps/sidekiq/boot.rb
|
426
|
+
- test/support/apps/sidekiq/jobs/sidekiq_job_1.rb
|
427
|
+
- test/support/apps/sidekiq/jobs/sidekiq_job_2.rb
|
428
|
+
- test/support/apps/sidekiq/worker.rb
|
429
|
+
- test/support/helpers.rb
|
430
|
+
- test/support/mock_timer.rb
|
444
431
|
- test/test_helper.rb
|
445
|
-
- test/
|
446
|
-
- test/
|
447
|
-
- test/
|
448
|
-
- test/
|
432
|
+
- test/tracing/custom_test.rb
|
433
|
+
- test/tracing/id_management_test.rb
|
434
|
+
- test/tracing/opentracing_test.rb
|
435
|
+
- test/tracing/processor_test.rb
|
436
|
+
- test/tracing/span_context_test.rb
|
437
|
+
- test/tracing/span_test.rb
|
438
|
+
- test/tracing/tracer_async_test.rb
|
439
|
+
- test/tracing/tracer_test.rb
|
440
|
+
- test/util_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, {})
|
data/benchmarks/Gemfile
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# (c) Copyright IBM Corp. 2021
|
4
|
-
# (c) Copyright Instana Inc. 2017
|
5
|
-
|
6
|
-
source "https://rubygems.org"
|
7
|
-
|
8
|
-
git_source(:github) {|repo_name| "https://github.com/instana/#{repo_name}" }
|
9
|
-
|
10
|
-
gem "instana", :path => "~/Projects/instana/ruby-sensor"
|
11
|
-
|
data/benchmarks/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
instana (1.9.6)
|
5
|
-
ffi (>= 1.0.11)
|
6
|
-
get_process_mem (>= 0.2.1)
|
7
|
-
oj (>= 3.0.11)
|
8
|
-
sys-proctable (>= 0.9.2)
|
9
|
-
timers (>= 4.0.0)
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: https://rubygems.org/
|
13
|
-
specs:
|
14
|
-
ffi (1.11.1)
|
15
|
-
get_process_mem (0.2.4)
|
16
|
-
ffi (~> 1.0)
|
17
|
-
nio4r (2.4.0)
|
18
|
-
oj (3.8.1)
|
19
|
-
puma (4.1.0)
|
20
|
-
nio4r (~> 2.0)
|
21
|
-
rack (2.0.7)
|
22
|
-
ruby-prof (1.0.0)
|
23
|
-
sys-proctable (1.2.2)
|
24
|
-
ffi
|
25
|
-
timers (4.3.0)
|
26
|
-
|
27
|
-
PLATFORMS
|
28
|
-
ruby
|
29
|
-
x86_64-darwin-18
|
30
|
-
|
31
|
-
DEPENDENCIES
|
32
|
-
instana!
|
33
|
-
puma
|
34
|
-
rack
|
35
|
-
ruby-prof
|
36
|
-
|
37
|
-
BUNDLED WITH
|
38
|
-
2.0.2
|
data/benchmarks/id_generation.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# (c) Copyright IBM Corp. 2021
|
4
|
-
# (c) Copyright Instana Inc. 2017
|
5
|
-
|
6
|
-
require "bundler"
|
7
|
-
Bundler.require(:default)
|
8
|
-
|
9
|
-
require "benchmark"
|
10
|
-
|
11
|
-
ID_RANGE = -2**63..2**63-1
|
12
|
-
|
13
|
-
Benchmark.bm do |x|
|
14
|
-
x.report("generate_id raw ") { 1_000_000.times { rand(-2**63..2**63-1) } }
|
15
|
-
x.report("with fixed range ") { 1_000_000.times { rand(ID_RANGE) } }
|
16
|
-
end
|
data/benchmarks/opentracing.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# (c) Copyright IBM Corp. 2021
|
4
|
-
# (c) Copyright Instana Inc. 2017
|
5
|
-
|
6
|
-
require "bundler"
|
7
|
-
Bundler.require(:default)
|
8
|
-
|
9
|
-
require "benchmark"
|
10
|
-
|
11
|
-
Benchmark.bm do |x|
|
12
|
-
x.report("start_span, finish: ") {
|
13
|
-
50_000.times {
|
14
|
-
::Instana.tracer.start_span(:blah).finish
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
x.report("start_span, set_tag(5x), finish:") {
|
19
|
-
50_000.times {
|
20
|
-
span = ::Instana.tracer.start_span(:blah)
|
21
|
-
span.set_tag(:blah, 1)
|
22
|
-
span.set_tag(:dog, 1)
|
23
|
-
span.set_tag(:moon, "ok")
|
24
|
-
span.set_tag(:ape, 1)
|
25
|
-
span.set_tag(:blah, 1)
|
26
|
-
span.finish
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
end
|
@@ -1,88 +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 "benchmark"
|
11
|
-
require "cgi"
|
12
|
-
Bundler.require(:default)
|
13
|
-
require "instana/rack"
|
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
|
-
while !::Instana.agent.ready? do
|
58
|
-
sleep 2
|
59
|
-
end
|
60
|
-
|
61
|
-
puts "Starting benchmarks"
|
62
|
-
Benchmark.bm do |x|
|
63
|
-
|
64
|
-
uri = URI.parse("http://127.0.0.1:7011/")
|
65
|
-
::Net::HTTP.start(uri.host, uri.port) do |hc|
|
66
|
-
x.report("vanilla") {
|
67
|
-
1_000.times {
|
68
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
69
|
-
hc.request(req)
|
70
|
-
}
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
uri = URI.parse("http://127.0.0.1:7012/")
|
75
|
-
::Net::HTTP.start(uri.host, uri.port) do |hc|
|
76
|
-
x.report("traced ") {
|
77
|
-
1_000.times {
|
78
|
-
::Instana.tracer.start_or_continue_trace(:rack_call) do
|
79
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
80
|
-
hc.request(req)
|
81
|
-
end
|
82
|
-
}
|
83
|
-
}
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
sleep 10
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# (c) Copyright IBM Corp. 2021
|
2
|
-
# (c) Copyright Instana Inc. 2017
|
3
|
-
|
4
|
-
require "bundler"
|
5
|
-
require "stackprof"
|
6
|
-
require 'rack'
|
7
|
-
require 'rack/builder'
|
8
|
-
require 'rack/handler/puma'
|
9
|
-
require 'net/http'
|
10
|
-
require "benchmark"
|
11
|
-
require "cgi"
|
12
|
-
Bundler.require(:default)
|
13
|
-
require "instana/rack"
|
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
|
-
sleep(2)
|
51
|
-
puts "Rack server started in background thread on localhost:7011"
|
52
|
-
puts "Sleeping for 10 to allow announce"
|
53
|
-
sleep(10)
|
54
|
-
|
55
|
-
puts "Starting profile"
|
56
|
-
uri = URI.parse("http://127.0.0.1:7011/")
|
57
|
-
StackProf.run(mode: :wall, out: 'tmp/stackprof-rack-vanilla.dump') do
|
58
|
-
::Net::HTTP.start(uri.host, uri.port) do |hc|
|
59
|
-
5_000.times {
|
60
|
-
::Instana.tracer.start_or_continue_trace(:rack_call) do
|
61
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
62
|
-
hc.request(req)
|
63
|
-
end
|
64
|
-
}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
puts "stackprof tmp/stackprof-rack-vanilla.dump --text"
|
68
|
-
|
69
|
-
uri = URI.parse("http://127.0.0.1:7012/")
|
70
|
-
StackProf.run(mode: :wall, out: 'tmp/stackprof-rack-instrumented.dump') do
|
71
|
-
::Net::HTTP.start(uri.host, uri.port) do |hc|
|
72
|
-
5_000.times {
|
73
|
-
::Instana.tracer.start_or_continue_trace(:rack_call) do
|
74
|
-
req = Net::HTTP::Get.new(uri.request_uri)
|
75
|
-
hc.request(req)
|
76
|
-
end
|
77
|
-
}
|
78
|
-
end
|
79
|
-
end
|
80
|
-
puts "stackprof tmp/stackprof-rack-instrumented.dump --text"
|
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# (c) Copyright IBM Corp. 2021
|
4
|
-
# (c) Copyright Instana Inc. 2017
|
5
|
-
|
6
|
-
require "bundler"
|
7
|
-
Bundler.require(:default)
|
8
|
-
|
9
|
-
require "benchmark"
|
10
|
-
|
11
|
-
# Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
|
12
|
-
|
13
|
-
Benchmark.bm do |x|
|
14
|
-
x.report("Time.now: ") { 1_000_000.times { (Time.now.to_f * 1000).floor } }
|
15
|
-
x.report("get_clocktime:") { 1_000_000.times { Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond) } }
|
16
|
-
end
|