ddtrace 0.46.0 → 0.47.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +52 -12
  3. data/.circleci/images/primary/{Dockerfile-jruby-9.2 → Dockerfile-jruby-9.2-latest} +2 -1
  4. data/.circleci/images/primary/Dockerfile-jruby-9.2.0.0 +73 -0
  5. data/.circleci/images/primary/Dockerfile-truffleruby-21.0.0 +73 -0
  6. data/.github/workflows/create-next-milestone.yml +2 -2
  7. data/.rubocop_todo.yml +3 -2
  8. data/.simplecov +6 -0
  9. data/Appraisals +1 -1
  10. data/CHANGELOG.md +83 -1
  11. data/Gemfile +19 -4
  12. data/LICENSE-3rdparty.csv +2 -0
  13. data/docker-compose.yml +75 -7
  14. data/docs/GettingStarted.md +61 -8
  15. data/lib/ddtrace/configuration.rb +92 -23
  16. data/lib/ddtrace/configuration/options.rb +2 -4
  17. data/lib/ddtrace/context_provider.rb +0 -2
  18. data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +97 -26
  19. data/lib/ddtrace/contrib/aws/services.rb +1 -0
  20. data/lib/ddtrace/contrib/configurable.rb +63 -39
  21. data/lib/ddtrace/contrib/configuration/resolver.rb +70 -5
  22. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +19 -17
  23. data/lib/ddtrace/contrib/configuration/settings.rb +7 -6
  24. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -0
  25. data/lib/ddtrace/contrib/extensions.rb +26 -3
  26. data/lib/ddtrace/contrib/httpclient/instrumentation.rb +12 -16
  27. data/lib/ddtrace/contrib/httpclient/patcher.rb +5 -2
  28. data/lib/ddtrace/contrib/httprb/instrumentation.rb +12 -17
  29. data/lib/ddtrace/contrib/httprb/patcher.rb +5 -2
  30. data/lib/ddtrace/contrib/patcher.rb +8 -5
  31. data/lib/ddtrace/contrib/presto/patcher.rb +5 -2
  32. data/lib/ddtrace/contrib/rails/patcher.rb +6 -2
  33. data/lib/ddtrace/contrib/redis/configuration/resolver.rb +11 -4
  34. data/lib/ddtrace/contrib/resque/integration.rb +1 -1
  35. data/lib/ddtrace/ext/runtime.rb +2 -0
  36. data/lib/ddtrace/patcher.rb +23 -1
  37. data/lib/ddtrace/pin.rb +5 -9
  38. data/lib/ddtrace/runtime/cgroup.rb +1 -1
  39. data/lib/ddtrace/runtime/container.rb +25 -27
  40. data/lib/ddtrace/runtime/identity.rb +8 -0
  41. data/lib/ddtrace/sync_writer.rb +5 -2
  42. data/lib/ddtrace/tracer.rb +6 -4
  43. data/lib/ddtrace/transport/http.rb +14 -5
  44. data/lib/ddtrace/transport/http/adapters/net.rb +18 -4
  45. data/lib/ddtrace/transport/http/builder.rb +5 -1
  46. data/lib/ddtrace/transport/http/env.rb +8 -0
  47. data/lib/ddtrace/transport/io/response.rb +1 -3
  48. data/lib/ddtrace/transport/io/traces.rb +6 -0
  49. data/lib/ddtrace/transport/traces.rb +15 -1
  50. data/lib/ddtrace/utils/compression.rb +27 -0
  51. data/lib/ddtrace/utils/object_set.rb +41 -0
  52. data/lib/ddtrace/utils/only_once.rb +40 -0
  53. data/lib/ddtrace/utils/sequence.rb +17 -0
  54. data/lib/ddtrace/utils/string_table.rb +45 -0
  55. data/lib/ddtrace/utils/time.rb +7 -0
  56. data/lib/ddtrace/vendor/multipart-post/LICENSE +11 -0
  57. data/lib/ddtrace/vendor/multipart-post/multipart.rb +12 -0
  58. data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +8 -0
  59. data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +116 -0
  60. data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +57 -0
  61. data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +135 -0
  62. data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +9 -0
  63. data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +32 -0
  64. data/lib/ddtrace/version.rb +1 -1
  65. data/lib/ddtrace/workers/async.rb +3 -3
  66. data/lib/ddtrace/workers/loop.rb +14 -3
  67. data/lib/ddtrace/workers/queue.rb +1 -0
  68. data/lib/ddtrace/workers/trace_writer.rb +1 -0
  69. data/lib/ddtrace/writer.rb +4 -1
  70. metadata +21 -4
@@ -1,7 +1,7 @@
1
1
  module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 46
4
+ MINOR = 47
5
5
  PATCH = 0
6
6
  PRE = nil
7
7
 
@@ -18,7 +18,7 @@ module Datadog
18
18
  # Methods that must be prepended
19
19
  module PrependedMethods
20
20
  def perform(*args)
21
- start { self.result = super(*args) } unless started?
21
+ start_async { self.result = super(*args) } unless started?
22
22
  end
23
23
  end
24
24
 
@@ -105,7 +105,7 @@ module Datadog
105
105
  @worker ||= nil
106
106
  end
107
107
 
108
- def start(&block)
108
+ def start_async(&block)
109
109
  mutex.synchronize do
110
110
  return if running?
111
111
 
@@ -126,7 +126,7 @@ module Datadog
126
126
  @run_async = true
127
127
  @pid = Process.pid
128
128
  @error = nil
129
- Datadog.logger.debug("Starting thread in the process: #{Process.pid}")
129
+ Datadog.logger.debug("Starting thread in the process: #{Process.pid} for: #{self}")
130
130
 
131
131
  @worker = ::Thread.new do
132
132
  begin
@@ -55,12 +55,21 @@ module Datadog
55
55
  @loop_wait_time ||= loop_base_interval
56
56
  end
57
57
 
58
+ def loop_wait_time=(value)
59
+ @loop_wait_time = value
60
+ end
61
+
62
+ def reset_loop_wait_time
63
+ self.loop_wait_time = loop_base_interval
64
+ end
65
+
66
+ # Should the loop "back off" when there's no work?
58
67
  def loop_back_off?
59
68
  false
60
69
  end
61
70
 
62
- def loop_back_off!(amount = nil)
63
- @loop_wait_time = amount || [loop_wait_time * BACK_OFF_RATIO, BACK_OFF_MAX].min
71
+ def loop_back_off!
72
+ self.loop_wait_time = [loop_wait_time * BACK_OFF_RATIO, BACK_OFF_MAX].min
64
73
  end
65
74
 
66
75
  protected
@@ -81,12 +90,14 @@ module Datadog
81
90
 
82
91
  loop do
83
92
  if work_pending?
93
+ # There's work to do...
84
94
  # Run the task
85
95
  yield
86
96
 
87
97
  # Reset the wait interval
88
- loop_back_off!(loop_base_interval)
98
+ reset_loop_wait_time if loop_back_off?
89
99
  elsif loop_back_off?
100
+ # There's no work to do...
90
101
  # Back off the wait interval a bit
91
102
  loop_back_off!
92
103
  end
@@ -26,6 +26,7 @@ module Datadog
26
26
  buffer.shift
27
27
  end
28
28
 
29
+ # Are there more items to be processed next?
29
30
  def work_pending?
30
31
  !buffer.empty?
31
32
  end
@@ -145,6 +145,7 @@ module Datadog
145
145
  [buffer.pop]
146
146
  end
147
147
 
148
+ # Are there more traces to be processed next?
148
149
  def work_pending?
149
150
  !buffer.empty?
150
151
  end
@@ -8,10 +8,13 @@ require 'ddtrace/transport/io'
8
8
  require 'ddtrace/encoding'
9
9
  require 'ddtrace/workers'
10
10
  require 'ddtrace/diagnostics/environment_logger'
11
+ require 'ddtrace/utils/only_once'
11
12
 
12
13
  module Datadog
13
14
  # Processor that sends traces and metadata to the agent
14
15
  class Writer
16
+ DEPRECATION_WARN_ONLY_ONCE = Datadog::Utils::OnlyOnce.new
17
+
15
18
  attr_reader \
16
19
  :priority_sampler,
17
20
  :transport,
@@ -127,7 +130,7 @@ module Datadog
127
130
  # enqueue the trace for submission to the API
128
131
  def write(trace, services = nil)
129
132
  unless services.nil?
130
- Datadog::Patcher.do_once('Writer#write') do
133
+ DEPRECATION_WARN_ONLY_ONCE.run do
131
134
  Datadog.logger.warn(%(
132
135
  write: Writing services has been deprecated and no longer need to be provided.
133
136
  write(traces, services) can be updated to write(traces)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.46.0
4
+ version: 0.47.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -44,7 +44,9 @@ files:
44
44
  - ".circleci/images/primary/Dockerfile-2.6.4"
45
45
  - ".circleci/images/primary/Dockerfile-2.7.0"
46
46
  - ".circleci/images/primary/Dockerfile-3.0.0"
47
- - ".circleci/images/primary/Dockerfile-jruby-9.2"
47
+ - ".circleci/images/primary/Dockerfile-jruby-9.2-latest"
48
+ - ".circleci/images/primary/Dockerfile-jruby-9.2.0.0"
49
+ - ".circleci/images/primary/Dockerfile-truffleruby-21.0.0"
48
50
  - ".dockerignore"
49
51
  - ".env"
50
52
  - ".github/CODEOWNERS"
@@ -62,6 +64,7 @@ files:
62
64
  - CONTRIBUTING.md
63
65
  - Gemfile
64
66
  - LICENSE
67
+ - LICENSE-3rdparty.csv
65
68
  - LICENSE.Apache
66
69
  - LICENSE.BSD3
67
70
  - NOTICE
@@ -623,11 +626,24 @@ files:
623
626
  - lib/ddtrace/transport/statistics.rb
624
627
  - lib/ddtrace/transport/traces.rb
625
628
  - lib/ddtrace/utils.rb
629
+ - lib/ddtrace/utils/compression.rb
626
630
  - lib/ddtrace/utils/database.rb
627
631
  - lib/ddtrace/utils/forking.rb
632
+ - lib/ddtrace/utils/object_set.rb
633
+ - lib/ddtrace/utils/only_once.rb
634
+ - lib/ddtrace/utils/sequence.rb
635
+ - lib/ddtrace/utils/string_table.rb
628
636
  - lib/ddtrace/utils/time.rb
629
637
  - lib/ddtrace/vendor/active_record/MIT-LICENSE
630
638
  - lib/ddtrace/vendor/active_record/connection_specification.rb
639
+ - lib/ddtrace/vendor/multipart-post/LICENSE
640
+ - lib/ddtrace/vendor/multipart-post/multipart.rb
641
+ - lib/ddtrace/vendor/multipart-post/multipart/post.rb
642
+ - lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb
643
+ - lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb
644
+ - lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb
645
+ - lib/ddtrace/vendor/multipart-post/multipart/post/version.rb
646
+ - lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb
631
647
  - lib/ddtrace/version.rb
632
648
  - lib/ddtrace/worker.rb
633
649
  - lib/ddtrace/workers.rb
@@ -659,7 +675,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
659
675
  - !ruby/object:Gem::Version
660
676
  version: 2.0.0
661
677
  requirements: []
662
- rubygems_version: 3.1.2
678
+ rubyforge_project:
679
+ rubygems_version: 2.5.2.3
663
680
  signing_key:
664
681
  specification_version: 4
665
682
  summary: Datadog tracing code for your Ruby applications