instana 1.193.5 → 1.193.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a4bd641fb11b956073bc9d424e61e1425382ed0bd3e92fcb1c00223e07f8202
4
- data.tar.gz: 8f8627a078613dd16adcf67a37f5eacf163c21a34b3d6172f05f831d833720f0
3
+ metadata.gz: db77f1675976effa012f80a5d583f271b99e82db24e288a5af82eae4fa423cf1
4
+ data.tar.gz: 9fe2b02c6f58355876c91d8954d3039a14b948f67b7a5730319579fb5d405a9f
5
5
  SHA512:
6
- metadata.gz: 488afe1762be438b3d02ccc89a1616ce8a8600047dd9e7f5fdb988474d335d494a44a40fb3f1e4c24cb804dde777e6246adbc6b737eeab2317525cee4de90f33
7
- data.tar.gz: 5af49960b8f13c6fdd2a6f3b7e961da14632820e2b323853f53af2be45f3655aa36b07224ae9734cbd4ca505bd136c8e1b5da6e115b9019031667ea9cd708c9b
6
+ metadata.gz: e00009c32acb5e684ee6c2dea9c7a7d4a40133f14ff8ec5929e39e97622b6daf8c5a027ad6cfdf9c3ace7e27f7accb9f1fff25f954e51eab11854ffb7f0f5e9b
7
+ data.tar.gz: 7b8f0c486ab5deaa118debcedc1bf43b6164832cde533d52cb99fe8ac44c76ffe9c555101331ed7cff4b7e421fa321898ff3cf195af80d3a4cda4ed2b5c19db9
data/.circleci/config.yml CHANGED
@@ -10,6 +10,7 @@ executors:
10
10
  DATABASE_URL: 'sqlite3::memory:'
11
11
  - image: memcached
12
12
  - image: redis
13
+ - image: circleci/dynamodb
13
14
  ruby_26:
14
15
  docker:
15
16
  - image: circleci/ruby:2.6-node
@@ -19,6 +20,7 @@ executors:
19
20
  DATABASE_URL: 'sqlite3::memory:'
20
21
  - image: memcached
21
22
  - image: redis
23
+ - image: circleci/dynamodb
22
24
  ruby_27:
23
25
  docker:
24
26
  - image: circleci/ruby:2.7-node
@@ -28,6 +30,7 @@ executors:
28
30
  DATABASE_URL: 'sqlite3::memory:'
29
31
  - image: memcached
30
32
  - image: redis
33
+ - image: circleci/dynamodb
31
34
  ruby_25_mysql2:
32
35
  docker:
33
36
  - image: circleci/ruby:2.5-node
@@ -196,6 +199,7 @@ workflows:
196
199
  - ruby_26
197
200
  - ruby_25
198
201
  gemfile:
202
+ - "./gemfiles/aws_30.gemfile"
199
203
  - "./gemfiles/cuba_30.gemfile"
200
204
  - "./gemfiles/dalli_20.gemfile"
201
205
  - "./gemfiles/excon_02.gemfile"
data/Appraisals CHANGED
@@ -1,6 +1,10 @@
1
1
  # (c) Copyright IBM Corp. 2021
2
2
  # (c) Copyright Instana Inc. 2021
3
3
 
4
+ appraise 'aws-30' do
5
+ gem 'aws-sdk-dynamodb', '~> 1.59'
6
+ end
7
+
4
8
  appraise 'cuba-30' do
5
9
  gem 'cuba', '>= 3.0', '< 4.0'
6
10
  end
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ # (c) Copyright IBM Corp. 2021
4
+ # (c) Copyright Instana Inc. 2021
5
+
6
+ source "https://rubygems.org"
7
+
8
+ gem "rake"
9
+ gem "minitest", "5.9.1"
10
+ gem "minitest-reporters"
11
+ gem "webmock"
12
+ gem "puma"
13
+ gem "rubocop", "~> 1.9"
14
+ gem "rack-test"
15
+ gem "simplecov", "~> 0.21.2"
16
+ gem "aws-sdk-dynamodb", "~> 1.59"
17
+
18
+ gemspec path: "../"
@@ -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 AwsDynamoDB < Activator
7
+ def can_instrument?
8
+ defined?(Aws::DynamoDB::Client)
9
+ end
10
+
11
+ def instrument
12
+ require 'instana/instrumentation/aws_sdk_dynamodb'
13
+
14
+ ::Aws::DynamoDB::Client.add_plugin(Instana::Instrumentation::DynamoDB)
15
+
16
+ true
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,29 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
4
+ module Instana
5
+ module Instrumentation
6
+ class DynamoDB < Seahorse::Client::Plugin
7
+ class Handler < Seahorse::Client::Handler
8
+ def call(context)
9
+ dynamo_tags = {
10
+ op: context.operation_name,
11
+ table: table_name_from(context)
12
+ }
13
+
14
+ ::Instana.tracer.trace(:dynamodb, dynamo_tags) { @handler.call(context) }
15
+ end
16
+
17
+ private
18
+
19
+ def table_name_from(context)
20
+ context.params[:table_name] || context.params[:global_table_name] || 'Unknown'
21
+ end
22
+ end
23
+
24
+ def add_handlers(handlers, _config)
25
+ handlers.add(Handler, step: :initialize)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -5,7 +5,7 @@ module Instana
5
5
  module Instrumentation
6
6
  class Excon < ::Excon::Middleware::Base
7
7
  def request_call(datum)
8
- return @stack.request_call(datum) unless ::Instana.tracer.tracing?
8
+ return @stack.request_call(datum) unless ::Instana.tracer.tracing? || !Instana.tracer.current_span.exit_span?
9
9
 
10
10
  payload = { :http => {} }
11
11
  path = datum[:path].split('?').first
@@ -30,7 +30,7 @@ module Instana
30
30
  end
31
31
 
32
32
  def error_call(datum)
33
- return @stack.error_call(datum) unless ::Instana.tracer.tracing?
33
+ return @stack.error_call(datum) unless ::Instana.tracer.tracing? || !Instana.tracer.current_span.exit_span?
34
34
 
35
35
  if datum[:pipeline] == true
36
36
  ::Instana.tracer.log_async_error(datum[:error], datum[:instana_span])
@@ -43,7 +43,7 @@ module Instana
43
43
  def response_call(datum)
44
44
  # FIXME: Will connect exceptions call a response?
45
45
  #
46
- return @stack.response_call(datum) unless ::Instana.tracer.tracing?
46
+ return @stack.response_call(datum) unless ::Instana.tracer.tracing? || !Instana.tracer.current_span.exit_span?
47
47
 
48
48
  result = @stack.response_call(datum)
49
49
 
@@ -7,7 +7,7 @@ module Instana
7
7
  module Instrumentation
8
8
  module NetHTTPInstrumentation
9
9
  def request(*args, &block)
10
- if !Instana.tracer.tracing? || !started?
10
+ if !Instana.tracer.tracing? || Instana.tracer.current_span.exit_span? || !started?
11
11
  do_skip = true
12
12
  return super(*args, &block)
13
13
  end
@@ -7,7 +7,7 @@ module Instana
7
7
  def call(worker_class, msg, queue, _redis_pool)
8
8
  kv_payload = { :'sidekiq-client' => {} }
9
9
  kv_payload[:'sidekiq-client'][:queue] = queue
10
- kv_payload[:'sidekiq-client'][:job] = worker_class
10
+ kv_payload[:'sidekiq-client'][:job] = worker_class.to_s
11
11
  kv_payload[:'sidekiq-client'][:retry] = msg['retry'].to_s
12
12
  ::Instana.tracer.log_entry(:'sidekiq-client', kv_payload)
13
13
 
@@ -8,7 +8,7 @@ module Instana
8
8
  kv_payload = { :'sidekiq-worker' => {} }
9
9
  kv_payload[:'sidekiq-worker'][:job_id] = msg['jid']
10
10
  kv_payload[:'sidekiq-worker'][:queue] = msg['queue']
11
- kv_payload[:'sidekiq-worker'][:job] = msg['class']
11
+ kv_payload[:'sidekiq-worker'][:job] = msg['class'].to_s
12
12
  kv_payload[:'sidekiq-worker'][:retry] = msg['retry'].to_s
13
13
 
14
14
  # Temporary until we move connection collection to redis
@@ -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' ].freeze
9
+ :redis, :'resque-client', :'resque-worker', :'graphql.server', :dynamodb ].freeze
10
10
  ENTRY_SPANS = [ :rack, :'resque-worker', :'rpc-server', :'sidekiq-worker', :'graphql.server' ].freeze
11
11
  EXIT_SPANS = [ :activerecord, :excon, :'net-http', :'resque-client',
12
- :'rpc-client', :'sidekiq-client', :redis ].freeze
12
+ :'rpc-client', :'sidekiq-client', :redis, :dynamodb ].freeze
13
13
  HTTP_SPANS = [ :rack, :excon, :'net-http' ].freeze
14
14
 
15
15
  attr_accessor :parent
@@ -289,6 +289,12 @@ module Instana
289
289
  @data.inspect
290
290
  end
291
291
 
292
+ # Check to see if the current span indicates an exit from application
293
+ # code and into an external service
294
+ def exit_span?
295
+ EXIT_SPANS.include?(@data[:n])
296
+ end
297
+
292
298
  #############################################################
293
299
  # OpenTracing Compatibility Methods
294
300
  #############################################################
@@ -2,6 +2,6 @@
2
2
  # (c) Copyright Instana Inc. 2016
3
3
 
4
4
  module Instana
5
- VERSION = "1.193.5"
5
+ VERSION = "1.193.6"
6
6
  VERSION_FULL = "instana-#{VERSION}"
7
7
  end
@@ -0,0 +1,33 @@
1
+ # (c) Copyright IBM Corp. 2021
2
+ # (c) Copyright Instana Inc. 2021
3
+
4
+ require 'test_helper'
5
+
6
+ class AwsTest < Minitest::Test
7
+ def test_dynamo_db
8
+ dynamo = Aws::DynamoDB::Client.new(
9
+ region: "local",
10
+ access_key_id: "placeholder",
11
+ secret_access_key: "placeholder",
12
+ endpoint: "http://localhost:8000"
13
+ )
14
+
15
+ assert_raises Aws::DynamoDB::Errors::ResourceNotFoundException do
16
+ Instana::Tracer.start_or_continue_trace(:dynamo_test, {}) do
17
+ dynamo.get_item(
18
+ table_name: 'sample_table',
19
+ key: { s: 'sample_item' }
20
+ )
21
+ end
22
+ end
23
+
24
+ spans = ::Instana.processor.queued_spans
25
+ dynamo_span, entry_span, *rest = spans
26
+
27
+ assert rest.empty?
28
+ assert_equal entry_span[:s], dynamo_span[:p]
29
+ assert_equal :dynamodb, dynamo_span[:n]
30
+ assert_equal :get_item, dynamo_span[:data][:op]
31
+ assert_equal 'sample_table', dynamo_span[:data][:table]
32
+ end
33
+ 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.193.5
4
+ version: 1.193.6
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-02-12 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,6 +172,7 @@ files:
172
172
  - examples/tracing.rb
173
173
  - extras/license_header.rb
174
174
  - gemfiles/.bundle/config
175
+ - gemfiles/aws_30.gemfile
175
176
  - gemfiles/cuba_30.gemfile
176
177
  - gemfiles/dalli_20.gemfile
177
178
  - gemfiles/excon_02.gemfile
@@ -202,6 +203,7 @@ files:
202
203
  - lib/instana/activators/action_controller_base.rb
203
204
  - lib/instana/activators/action_view.rb
204
205
  - lib/instana/activators/active_record.rb
206
+ - lib/instana/activators/aws_sdk_dynamodb.rb
205
207
  - lib/instana/activators/cuba.rb
206
208
  - lib/instana/activators/dalli.rb
207
209
  - lib/instana/activators/excon.rb
@@ -240,6 +242,7 @@ files:
240
242
  - lib/instana/instrumentation/action_controller.rb
241
243
  - lib/instana/instrumentation/action_view.rb
242
244
  - lib/instana/instrumentation/active_record.rb
245
+ - lib/instana/instrumentation/aws_sdk_dynamodb.rb
243
246
  - lib/instana/instrumentation/dalli.rb
244
247
  - lib/instana/instrumentation/excon.rb
245
248
  - lib/instana/instrumentation/graphql.rb
@@ -276,6 +279,7 @@ files:
276
279
  - test/frameworks/roda_test.rb
277
280
  - test/frameworks/sinatra_test.rb
278
281
  - test/instana_test.rb
282
+ - test/instrumentation/aws_test.rb
279
283
  - test/instrumentation/dalli_test.rb
280
284
  - test/instrumentation/excon_test.rb
281
285
  - test/instrumentation/graphql_test.rb
@@ -367,6 +371,7 @@ test_files:
367
371
  - test/instrumentation/rails_action_cable_test.rb
368
372
  - test/instrumentation/excon_test.rb
369
373
  - test/instrumentation/grpc_test.rb
374
+ - test/instrumentation/aws_test.rb
370
375
  - test/support/helpers.rb
371
376
  - test/support/apps/sidekiq/boot.rb
372
377
  - test/support/apps/sidekiq/jobs/sidekiq_job_2.rb