instana 1.11.8 → 1.193.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +10 -0
  3. data/Rakefile +26 -37
  4. data/gemfiles/libraries.gemfile +2 -0
  5. data/lib/instana/agent.rb +6 -0
  6. data/lib/instana/base.rb +2 -0
  7. data/lib/instana/config.rb +11 -0
  8. data/lib/instana/frameworks/cuba.rb +33 -0
  9. data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +5 -7
  10. data/lib/instana/frameworks/instrumentation/action_controller.rb +11 -0
  11. data/lib/instana/frameworks/instrumentation/action_view.rb +6 -10
  12. data/lib/instana/frameworks/instrumentation/active_record.rb +4 -4
  13. data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +17 -15
  14. data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +11 -7
  15. data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +33 -19
  16. data/lib/instana/frameworks/roda.rb +41 -0
  17. data/lib/instana/frameworks/sinatra.rb +17 -0
  18. data/lib/instana/instrumentation/dalli.rb +9 -14
  19. data/lib/instana/instrumentation/excon.rb +1 -1
  20. data/lib/instana/instrumentation/graphql.rb +77 -0
  21. data/lib/instana/instrumentation/grpc.rb +72 -62
  22. data/lib/instana/instrumentation/instrumented_request.rb +68 -0
  23. data/lib/instana/instrumentation/net-http.rb +44 -43
  24. data/lib/instana/instrumentation/rack.rb +17 -52
  25. data/lib/instana/instrumentation/redis.rb +15 -18
  26. data/lib/instana/instrumentation/resque.rb +17 -28
  27. data/lib/instana/instrumentation/rest-client.rb +3 -13
  28. data/lib/instana/secrets.rb +42 -0
  29. data/lib/instana/setup.rb +1 -0
  30. data/lib/instana/tracer.rb +6 -0
  31. data/lib/instana/tracing/span.rb +14 -10
  32. data/lib/instana/util.rb +15 -69
  33. data/lib/instana/version.rb +1 -1
  34. data/test/apps/cuba.rb +4 -0
  35. data/test/apps/roda.rb +3 -0
  36. data/test/apps/sinatra.rb +4 -0
  37. data/test/config_test.rb +1 -17
  38. data/test/frameworks/cuba_test.rb +14 -1
  39. data/test/frameworks/rack_test.rb +52 -19
  40. data/test/frameworks/rails/actioncontroller_test.rb +12 -0
  41. data/test/frameworks/rails/activerecord_test.rb +80 -28
  42. data/test/frameworks/roda_test.rb +14 -0
  43. data/test/frameworks/sinatra_test.rb +14 -0
  44. data/test/instrumentation/excon_test.rb +0 -2
  45. data/test/instrumentation/graphql_test.rb +116 -0
  46. data/test/instrumentation/instrumented_request_test.rb +84 -0
  47. data/test/instrumentation/redis_test.rb +10 -0
  48. data/test/secrets_test.rb +73 -0
  49. data/test/test_helper.rb +3 -9
  50. data/test/tracing/id_management_test.rb +4 -66
  51. metadata +16 -6
@@ -68,17 +68,11 @@ def clear_all!
68
68
  end
69
69
 
70
70
  def disable_redis_instrumentation
71
- ::Redis::Client.class_eval do
72
- alias call call_without_instana
73
- alias call_pipeline call_pipeline_without_instana
74
- end
71
+ ::Instana.config[:redis][:enabled] = false
75
72
  end
76
73
 
77
74
  def enable_redis_instrumentation
78
- ::Redis::Client.class_eval do
79
- alias call call_with_instana
80
- alias call_pipeline call_pipeline_with_instana
81
- end
75
+ ::Instana.config[:redis][:enabled] = true
82
76
  end
83
77
 
84
78
  def validate_sdk_span(json_span, sdk_hash = {}, errored = false, ec = 1)
@@ -156,4 +150,4 @@ def find_first_span_by_qualifier(spans, &block)
156
150
  end
157
151
  end
158
152
  raise Exception.new("Span with qualifier not found")
159
- end
153
+ end
@@ -49,82 +49,20 @@ class TracerIDMgmtTest < Minitest::Test
49
49
  converted_id = Instana::Util.header_to_id(header_id)
50
50
 
51
51
  # Assert that it is an Integer
52
- assert converted_id.is_a?(Integer)
52
+ assert converted_id.is_a?(String)
53
53
  end
54
54
 
55
55
  def test_header_to_id_conversion_with_bogus_header
56
56
  # Bogus nil arg
57
57
  bogus_result = Instana::Util.header_to_id(nil)
58
- assert_equal 0, bogus_result
58
+ assert_equal '', bogus_result
59
59
 
60
60
  # Bogus Integer arg
61
61
  bogus_result = Instana::Util.header_to_id(1234)
62
- assert_equal 0, bogus_result
62
+ assert_equal '', bogus_result
63
63
 
64
64
  # Bogus Array arg
65
65
  bogus_result = Instana::Util.header_to_id([1234])
66
- assert_equal 0, bogus_result
67
- end
68
-
69
- def test_id_conversion_back_and_forth
70
- # id --> header --> id
71
- original_id = ::Instana::Util.generate_id
72
- header_id = Instana::Util.id_to_header(original_id)
73
- converted_back_id = Instana::Util.header_to_id(header_id)
74
- assert original_id == converted_back_id
75
-
76
- # header --> id --> header
77
- original_header_id = "c025ee93b1aeda7b"
78
- id = Instana::Util.header_to_id(original_header_id)
79
- converted_back_header_id = Instana::Util.id_to_header(id)
80
- assert_equal original_header_id, converted_back_header_id
81
-
82
- # Test a random value
83
- id = -7815363404733516491
84
- header = "938a406416457535"
85
-
86
- result = Instana::Util.header_to_id(header)
87
- assert_equal id, result
88
-
89
- result = Instana::Util.id_to_header(id)
90
- assert_equal header, result
91
-
92
- 10000.times do
93
- original_id = ::Instana::Util.generate_id
94
- header_id = Instana::Util.id_to_header(original_id)
95
- converted_back_id = Instana::Util.header_to_id(header_id)
96
- assert original_id == converted_back_id
97
- end
98
- end
99
-
100
- def test_id_max_value_and_conversion
101
- max_id = 9223372036854775807
102
- min_id = -9223372036854775808
103
- max_hex = "7fffffffffffffff"
104
- min_hex = "8000000000000000"
105
-
106
- assert_equal max_hex, Instana::Util.id_to_header(max_id)
107
- assert_equal min_hex, Instana::Util.id_to_header(min_id)
108
-
109
- assert_equal max_id, Instana::Util.header_to_id(max_hex)
110
- assert_equal min_id, Instana::Util.header_to_id(min_hex)
111
- end
112
-
113
- def test_that_leading_zeros_handled_correctly
114
-
115
- header = ::Instana::Util.id_to_header(16)
116
- assert_equal "10", header
117
-
118
- id = ::Instana::Util.header_to_id("10")
119
- assert_equal 16, id
120
-
121
- id = ::Instana::Util.header_to_id("0000000000000010")
122
- assert_equal 16, id
123
-
124
- id = ::Instana::Util.header_to_id("88b6c735206ca42")
125
- assert_equal 615705016619420226, id
126
-
127
- id = ::Instana::Util.header_to_id("088b6c735206ca42")
128
- assert_equal 615705016619420226, id
66
+ assert_equal '', bogus_result
129
67
  end
130
68
  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.11.8
4
+ version: 1.193.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-23 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -175,6 +175,7 @@ extra_rdoc_files: []
175
175
  files:
176
176
  - ".circleci/config.yml"
177
177
  - ".codeclimate.yml"
178
+ - ".editorconfig"
178
179
  - ".fasterer.yml"
179
180
  - ".gitignore"
180
181
  - ".rubocop.yml"
@@ -231,7 +232,9 @@ files:
231
232
  - lib/instana/instrumentation.rb
232
233
  - lib/instana/instrumentation/dalli.rb
233
234
  - lib/instana/instrumentation/excon.rb
235
+ - lib/instana/instrumentation/graphql.rb
234
236
  - lib/instana/instrumentation/grpc.rb
237
+ - lib/instana/instrumentation/instrumented_request.rb
235
238
  - lib/instana/instrumentation/net-http.rb
236
239
  - lib/instana/instrumentation/rack.rb
237
240
  - lib/instana/instrumentation/redis.rb
@@ -242,6 +245,7 @@ files:
242
245
  - lib/instana/opentracing/carrier.rb
243
246
  - lib/instana/opentracing/tracer.rb
244
247
  - lib/instana/rack.rb
248
+ - lib/instana/secrets.rb
245
249
  - lib/instana/setup.rb
246
250
  - lib/instana/test.rb
247
251
  - lib/instana/thread_local.rb
@@ -274,7 +278,9 @@ files:
274
278
  - test/instana_test.rb
275
279
  - test/instrumentation/dalli_test.rb
276
280
  - test/instrumentation/excon_test.rb
281
+ - test/instrumentation/graphql_test.rb
277
282
  - test/instrumentation/grpc_test.rb
283
+ - test/instrumentation/instrumented_request_test.rb
278
284
  - test/instrumentation/net-http_test.rb
279
285
  - test/instrumentation/redis_test.rb
280
286
  - test/instrumentation/resque_test.rb
@@ -287,6 +293,7 @@ files:
287
293
  - test/jobs/sidekiq_job_2.rb
288
294
  - test/models/block.rb
289
295
  - test/models/block6.rb
296
+ - test/secrets_test.rb
290
297
  - test/servers/grpc_50051.rb
291
298
  - test/servers/helpers/sidekiq_worker_initializer.rb
292
299
  - test/servers/rackapp_6511.rb
@@ -306,7 +313,7 @@ metadata:
306
313
  documentation_uri: https://docs.instana.io/ecosystem/ruby/
307
314
  homepage_uri: https://www.instana.com/
308
315
  source_code_uri: https://github.com/instana/ruby-sensor
309
- post_install_message:
316
+ post_install_message:
310
317
  rdoc_options: []
311
318
  require_paths:
312
319
  - lib
@@ -321,8 +328,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
328
  - !ruby/object:Gem::Version
322
329
  version: '0'
323
330
  requirements: []
324
- rubygems_version: 3.0.6
325
- signing_key:
331
+ rubygems_version: 3.2.6
332
+ signing_key:
326
333
  specification_version: 4
327
334
  summary: Ruby Distributed Tracing & Metrics Sensor for Instana
328
335
  test_files:
@@ -335,6 +342,8 @@ test_files:
335
342
  - test/agent/agent_test.rb
336
343
  - test/models/block.rb
337
344
  - test/models/block6.rb
345
+ - test/secrets_test.rb
346
+ - test/instrumentation/graphql_test.rb
338
347
  - test/instrumentation/sidekiq-client_test.rb
339
348
  - test/instrumentation/resque_test.rb
340
349
  - test/instrumentation/sidekiq-worker_test.rb
@@ -342,6 +351,7 @@ test_files:
342
351
  - test/instrumentation/rest-client_test.rb
343
352
  - test/instrumentation/dalli_test.rb
344
353
  - test/instrumentation/excon_test.rb
354
+ - test/instrumentation/instrumented_request_test.rb
345
355
  - test/instrumentation/grpc_test.rb
346
356
  - test/instrumentation/net-http_test.rb
347
357
  - test/benchmarks/bench_opentracing.rb