instana 1.213.3 → 1.214.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 +5 -63
- data/gemfiles/redis_50.gemfile +14 -0
- data/instana.gemspec +1 -1
- data/lib/instana/activators/redis.rb +7 -2
- data/lib/instana/instrumentation/redis.rb +57 -30
- data/lib/instana/version.rb +1 -1
- data/test/instrumentation/redis_test.rb +12 -12
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f17a988f6d3117cee6198d76f4d1d927c78170857122933700352905ddf06382
|
4
|
+
data.tar.gz: 852125ef23731dca4817a18999b9cb1af142d8c62ff8bc5c81c717e370b0a943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce8ce7e27297c544e50e7efa4a0ab79cdafacaa4faf7d0a860c7976a7d4bcf671996079f5f019af33215feabe024f1f495edf584f20cf940923883a65e9550dd
|
7
|
+
data.tar.gz: 3cc3695f26bdb194206e688996027366fed40adfd907c80f2d924209ac0d63a7f53155f277f7edd2180f4ab085d86c8a75c096f9891f83e7b1cc5ade1230de50
|
data/.circleci/config.yml
CHANGED
@@ -9,7 +9,6 @@ library_gemfile: &library_gemfile
|
|
9
9
|
- "./gemfiles/dalli_20.gemfile"
|
10
10
|
- "./gemfiles/dalli_30.gemfile"
|
11
11
|
- "./gemfiles/dalli_32.gemfile"
|
12
|
-
- "./gemfiles/excon_02.gemfile"
|
13
12
|
- "./gemfiles/excon_079.gemfile"
|
14
13
|
- "./gemfiles/excon_100.gemfile"
|
15
14
|
- "./gemfiles/graphql_10.gemfile"
|
@@ -19,6 +18,7 @@ library_gemfile: &library_gemfile
|
|
19
18
|
- "./gemfiles/rack_20.gemfile"
|
20
19
|
- "./gemfiles/rack_30.gemfile"
|
21
20
|
- "./gemfiles/redis_40.gemfile"
|
21
|
+
- "./gemfiles/redis_50.gemfile"
|
22
22
|
- "./gemfiles/rest_client_20.gemfile"
|
23
23
|
- "./gemfiles/resque_122.gemfile"
|
24
24
|
- "./gemfiles/resque_20.gemfile"
|
@@ -35,42 +35,6 @@ library_gemfile: &library_gemfile
|
|
35
35
|
- "./gemfiles/mongo_216.gemfile"
|
36
36
|
- "./gemfiles/mongo_219.gemfile"
|
37
37
|
executors:
|
38
|
-
ruby_27:
|
39
|
-
docker:
|
40
|
-
- image: cimg/ruby:2.7-node
|
41
|
-
environment:
|
42
|
-
MEMCACHED_HOST: '127.0.0.1:11211'
|
43
|
-
REDIS_URL: 'redis://127.0.0.1:6379'
|
44
|
-
DATABASE_URL: 'sqlite3::memory:'
|
45
|
-
- image: memcached
|
46
|
-
- image: redis
|
47
|
-
- image: amazon/dynamodb-local
|
48
|
-
- image: minio/minio:latest
|
49
|
-
command: ["server", "/data"]
|
50
|
-
- image: s12v/sns
|
51
|
-
- image: softwaremill/elasticmq-native
|
52
|
-
- image: mongo:5-focal
|
53
|
-
ruby_27_mysql2:
|
54
|
-
docker:
|
55
|
-
- image: cimg/ruby:2.7-node
|
56
|
-
environment:
|
57
|
-
DATABASE_URL: "mysql2://root:passw0rd@127.0.0.1:3306/ci_test"
|
58
|
-
- image: mariadb
|
59
|
-
environment:
|
60
|
-
MYSQL_DATABASE: 'ci_test'
|
61
|
-
MYSQL_USER: 'root'
|
62
|
-
MYSQL_ROOT_PASSWORD: 'passw0rd'
|
63
|
-
MYSQL_ROOT_HOST: '%'
|
64
|
-
ruby_27_postgres:
|
65
|
-
docker:
|
66
|
-
- image: cimg/ruby:2.7-node
|
67
|
-
environment:
|
68
|
-
DATABASE_URL: "postgres://root:passw0rd@127.0.0.1:5432/ci_test"
|
69
|
-
- image: postgres
|
70
|
-
environment:
|
71
|
-
POSTGRES_DB: 'ci_test'
|
72
|
-
POSTGRES_USER: 'root'
|
73
|
-
POSTGRES_PASSWORD: 'passw0rd'
|
74
38
|
ruby_30:
|
75
39
|
docker:
|
76
40
|
- image: cimg/ruby:3.0-node
|
@@ -327,7 +291,7 @@ jobs:
|
|
327
291
|
parameters:
|
328
292
|
stack:
|
329
293
|
type: executor
|
330
|
-
default:
|
294
|
+
default: ruby_30
|
331
295
|
executor: << parameters.stack >>
|
332
296
|
steps:
|
333
297
|
- checkout
|
@@ -337,7 +301,7 @@ jobs:
|
|
337
301
|
parameters:
|
338
302
|
stack:
|
339
303
|
type: executor
|
340
|
-
default:
|
304
|
+
default: ruby_30
|
341
305
|
gemfile:
|
342
306
|
type: string
|
343
307
|
default: "./gemfiles/aws_30.gemfile"
|
@@ -350,7 +314,7 @@ jobs:
|
|
350
314
|
- setup
|
351
315
|
- run_tests
|
352
316
|
lint:
|
353
|
-
executor:
|
317
|
+
executor: ruby_30
|
354
318
|
steps:
|
355
319
|
- checkout
|
356
320
|
- setup
|
@@ -361,7 +325,7 @@ jobs:
|
|
361
325
|
- checkout
|
362
326
|
- run_sonarqube
|
363
327
|
publish:
|
364
|
-
executor:
|
328
|
+
executor: ruby_30
|
365
329
|
steps:
|
366
330
|
- checkout
|
367
331
|
- setup
|
@@ -383,7 +347,6 @@ workflows:
|
|
383
347
|
matrix:
|
384
348
|
parameters:
|
385
349
|
stack:
|
386
|
-
- ruby_27
|
387
350
|
- ruby_30
|
388
351
|
- ruby_31
|
389
352
|
- ruby_32
|
@@ -399,27 +362,6 @@ workflows:
|
|
399
362
|
- ruby_32
|
400
363
|
- ruby_33
|
401
364
|
<<: *library_gemfile
|
402
|
-
libraries_ruby_2:
|
403
|
-
jobs:
|
404
|
-
- test_apprisal:
|
405
|
-
matrix:
|
406
|
-
parameters:
|
407
|
-
stack:
|
408
|
-
- ruby_27
|
409
|
-
<<: *library_gemfile
|
410
|
-
rails_ruby_2:
|
411
|
-
jobs:
|
412
|
-
- test_apprisal:
|
413
|
-
matrix:
|
414
|
-
parameters:
|
415
|
-
stack:
|
416
|
-
- ruby_27
|
417
|
-
- ruby_27_postgres
|
418
|
-
- ruby_27_mysql2
|
419
|
-
gemfile:
|
420
|
-
- "./gemfiles/rails_60.gemfile"
|
421
|
-
- "./gemfiles/rails_52.gemfile"
|
422
|
-
- "./gemfiles/rails_50.gemfile"
|
423
365
|
rails_ruby_3:
|
424
366
|
jobs:
|
425
367
|
- test_apprisal:
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# (c) Copyright IBM Corp. 2024
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "minitest-reporters"
|
6
|
+
gem "webmock"
|
7
|
+
gem "puma"
|
8
|
+
gem "rubocop", "~> 1.9"
|
9
|
+
gem "rack-test"
|
10
|
+
gem "simplecov", "~> 0.21.2"
|
11
|
+
gem "redis", ">= 5.0.0"
|
12
|
+
gem "debug"
|
13
|
+
|
14
|
+
gemspec path: "../"
|
data/instana.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
spec.test_files = Dir.glob("{test}/**/*.rb")
|
33
33
|
|
34
|
-
spec.required_ruby_version = '>=
|
34
|
+
spec.required_ruby_version = '>= 3.0'
|
35
35
|
spec.platform = defined?(JRUBY_VERSION) ? 'java' : Gem::Platform::RUBY
|
36
36
|
|
37
37
|
spec.add_development_dependency "bundler", "~> 2.0"
|
@@ -5,13 +5,18 @@ module Instana
|
|
5
5
|
module Activators
|
6
6
|
class Redis < Activator
|
7
7
|
def can_instrument?
|
8
|
-
defined?(::Redis) && defined?(::Redis::Client) && ::Instana.config[:redis][:enabled]
|
8
|
+
defined?(::Redis) && defined?(::Redis::Client) && ::Instana.config[:redis][:enabled] &&
|
9
|
+
(Gem::Specification.find_by_name('redis').version < Gem::Version.new('5.0') || defined?(::RedisClient))
|
9
10
|
end
|
10
11
|
|
11
12
|
def instrument
|
12
13
|
require 'instana/instrumentation/redis'
|
13
14
|
|
14
|
-
::
|
15
|
+
if Gem::Specification.find_by_name('redis').version >= Gem::Version.new('5.0')
|
16
|
+
::RedisClient.prepend(::Instana::RedisInstrumentation)
|
17
|
+
else
|
18
|
+
::Redis::Client.prepend(::Instana::RedisInstrumentation)
|
19
|
+
end
|
15
20
|
|
16
21
|
true
|
17
22
|
end
|
@@ -1,58 +1,85 @@
|
|
1
|
-
# (c) Copyright IBM Corp.
|
1
|
+
# (c) Copyright IBM Corp. 2024
|
2
2
|
# (c) Copyright Instana Inc. 2017
|
3
3
|
|
4
4
|
module Instana
|
5
5
|
module RedisInstrumentation
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
if Gem::Specification.find_by_name('redis').version >= Gem::Version.new('5.0') && defined?(::RedisClient)
|
7
|
+
ORIGINAL_METHODS = {
|
8
|
+
:call_v => ::RedisClient.instance_method(:call_v),
|
9
|
+
:pipelined => ::RedisClient.instance_method(:pipelined),
|
10
|
+
:multi => ::RedisClient.instance_method(:multi)
|
11
|
+
}.freeze
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
def call_v(*args, &block)
|
14
|
+
if skip_instrumentation?
|
15
|
+
super(*args, &block)
|
16
|
+
else
|
17
|
+
call_with_instana(args[0][0].to_s.upcase, ORIGINAL_METHODS[:call_v], *args, &block)
|
18
|
+
end
|
12
19
|
end
|
13
20
|
|
14
|
-
|
15
|
-
|
21
|
+
def pipelined(*args, &block)
|
22
|
+
if skip_instrumentation?
|
23
|
+
super(*args, &block)
|
24
|
+
else
|
25
|
+
call_with_instana('PIPELINE', ORIGINAL_METHODS[:pipelined], *args, &block)
|
26
|
+
end
|
27
|
+
end
|
16
28
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
29
|
+
# Since, starting with 5.1 redis/client.rb:114:multi takes an unused default argument `watch: nil`
|
30
|
+
# but calls redis_client.rb:442:multi, which doesn't take any argument,
|
31
|
+
# here we have to take arguments but we should not use it.
|
32
|
+
def multi(*_, &block)
|
33
|
+
if skip_instrumentation?
|
34
|
+
super(&block)
|
35
|
+
else
|
36
|
+
call_with_instana('MULTI', ORIGINAL_METHODS[:multi], &block)
|
23
37
|
end
|
38
|
+
end
|
24
39
|
|
25
|
-
|
26
|
-
|
27
|
-
::
|
28
|
-
::
|
29
|
-
|
30
|
-
|
31
|
-
|
40
|
+
else
|
41
|
+
ORIGINAL_METHODS = {
|
42
|
+
:call => ::Redis::Client.instance_method(:call),
|
43
|
+
:call_pipeline => ::Redis::Client.instance_method(:call_pipeline)
|
44
|
+
}.freeze
|
45
|
+
|
46
|
+
def call(*args, &block)
|
47
|
+
if skip_instrumentation?
|
48
|
+
super(*args, &block)
|
49
|
+
else
|
50
|
+
call_with_instana(args[0][0].to_s.upcase, ORIGINAL_METHODS[:call], *args, &block)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def call_pipeline(*args, &block)
|
55
|
+
if skip_instrumentation?
|
56
|
+
super(*args, &block)
|
57
|
+
else
|
58
|
+
call_with_instana(args.first.is_a?(::Redis::Pipeline::Multi) ? 'MULTI' : 'PIPELINE', ORIGINAL_METHODS[:call_pipeline], *args, &block)
|
59
|
+
end
|
32
60
|
end
|
33
61
|
end
|
34
62
|
|
35
|
-
def
|
36
|
-
kv_payload = { redis: {} }
|
63
|
+
def skip_instrumentation?
|
37
64
|
dnt_spans = [:redis, :'resque-client', :'sidekiq-client']
|
65
|
+
!Instana.tracer.tracing? || dnt_spans.include?(::Instana.tracer.current_span.name) || !Instana.config[:redis][:enabled]
|
66
|
+
end
|
38
67
|
|
39
|
-
|
40
|
-
|
41
|
-
|
68
|
+
def call_with_instana(*args, &block)
|
69
|
+
command, original_super, *original_args = *args
|
70
|
+
kv_payload = { redis: {} }
|
42
71
|
|
43
72
|
begin
|
44
73
|
::Instana.tracer.log_entry(:redis)
|
45
74
|
|
46
|
-
pipeline = args.first
|
47
75
|
begin
|
48
76
|
kv_payload[:redis][:connection] = "#{self.host}:#{self.port}"
|
49
77
|
kv_payload[:redis][:db] = db.to_s
|
50
|
-
kv_payload[:redis][:command] =
|
78
|
+
kv_payload[:redis][:command] = command
|
51
79
|
rescue
|
52
80
|
nil
|
53
81
|
end
|
54
|
-
|
55
|
-
super(*args, &block)
|
82
|
+
original_super.bind(self).call(*original_args, &block)
|
56
83
|
rescue => e
|
57
84
|
::Instana.tracer.log_info({ redis: {error: true} })
|
58
85
|
::Instana.tracer.log_error(e)
|
data/lib/instana/version.rb
CHANGED
@@ -49,9 +49,9 @@ class RedisTest < Minitest::Test
|
|
49
49
|
clear_all!
|
50
50
|
|
51
51
|
Instana.tracer.start_or_continue_trace(:redis_test) do
|
52
|
-
@redis_client.pipelined do
|
53
|
-
|
54
|
-
|
52
|
+
@redis_client.pipelined do |pipeline|
|
53
|
+
pipeline.set('hello', 'world')
|
54
|
+
pipeline.set('other', 'world')
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -63,9 +63,9 @@ class RedisTest < Minitest::Test
|
|
63
63
|
|
64
64
|
Instana.tracer.start_or_continue_trace(:redis_test) do
|
65
65
|
begin
|
66
|
-
@redis_client.pipelined do
|
67
|
-
|
68
|
-
|
66
|
+
@redis_client.pipelined do |pipeline|
|
67
|
+
pipeline.set('other', 'world')
|
68
|
+
pipeline.call('invalid')
|
69
69
|
end
|
70
70
|
rescue; end
|
71
71
|
end
|
@@ -77,9 +77,9 @@ class RedisTest < Minitest::Test
|
|
77
77
|
clear_all!
|
78
78
|
|
79
79
|
Instana.tracer.start_or_continue_trace(:redis_test) do
|
80
|
-
@redis_client.multi do
|
81
|
-
|
82
|
-
|
80
|
+
@redis_client.multi do |multi|
|
81
|
+
multi.set('hello', 'world')
|
82
|
+
multi.set('other', 'world')
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -91,9 +91,9 @@ class RedisTest < Minitest::Test
|
|
91
91
|
|
92
92
|
Instana.tracer.start_or_continue_trace(:redis_test) do
|
93
93
|
begin
|
94
|
-
@redis_client.multi do
|
95
|
-
|
96
|
-
|
94
|
+
@redis_client.multi do |multi|
|
95
|
+
multi.set('other', 'world')
|
96
|
+
multi.call('invalid')
|
97
97
|
end
|
98
98
|
rescue; end
|
99
99
|
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.214.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: 2024-03-
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- gemfiles/rails_70.gemfile
|
186
186
|
- gemfiles/rails_71.gemfile
|
187
187
|
- gemfiles/redis_40.gemfile
|
188
|
+
- gemfiles/redis_50.gemfile
|
188
189
|
- gemfiles/resque_122.gemfile
|
189
190
|
- gemfiles/resque_20.gemfile
|
190
191
|
- gemfiles/rest_client_20.gemfile
|
@@ -391,14 +392,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
391
392
|
requirements:
|
392
393
|
- - ">="
|
393
394
|
- !ruby/object:Gem::Version
|
394
|
-
version: '
|
395
|
+
version: '3.0'
|
395
396
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
396
397
|
requirements:
|
397
398
|
- - ">="
|
398
399
|
- !ruby/object:Gem::Version
|
399
400
|
version: '0'
|
400
401
|
requirements: []
|
401
|
-
rubygems_version: 3.4.
|
402
|
+
rubygems_version: 3.4.19
|
402
403
|
signing_key:
|
403
404
|
specification_version: 4
|
404
405
|
summary: Ruby Distributed Tracing & Metrics Sensor for Instana
|