ddtrace 0.30.1 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +28 -0
  3. data/.circleci/images/primary/Dockerfile-2.7.0 +73 -0
  4. data/Appraisals +111 -2
  5. data/CHANGELOG.md +33 -1
  6. data/Rakefile +69 -1
  7. data/ddtrace.gemspec +1 -0
  8. data/docker-compose.yml +30 -0
  9. data/docs/GettingStarted.md +28 -3
  10. data/lib/ddtrace.rb +6 -0
  11. data/lib/ddtrace/buffer.rb +3 -3
  12. data/lib/ddtrace/configuration/base.rb +2 -1
  13. data/lib/ddtrace/configuration/settings.rb +15 -2
  14. data/lib/ddtrace/context.rb +62 -57
  15. data/lib/ddtrace/context_flush.rb +51 -114
  16. data/lib/ddtrace/context_provider.rb +45 -0
  17. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +25 -0
  18. data/lib/ddtrace/contrib/action_cable/event.rb +65 -0
  19. data/lib/ddtrace/contrib/action_cable/events.rb +33 -0
  20. data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +49 -0
  21. data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +52 -0
  22. data/lib/ddtrace/contrib/action_cable/events/transmit.rb +50 -0
  23. data/lib/ddtrace/contrib/action_cable/ext.rb +23 -0
  24. data/lib/ddtrace/contrib/action_cable/instrumentation.rb +31 -0
  25. data/lib/ddtrace/contrib/action_cable/integration.rb +36 -0
  26. data/lib/ddtrace/contrib/action_cable/patcher.rb +27 -0
  27. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +2 -2
  28. data/lib/ddtrace/contrib/action_view/events/render_partial.rb +5 -3
  29. data/lib/ddtrace/contrib/action_view/events/render_template.rb +5 -3
  30. data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +2 -1
  31. data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +4 -2
  32. data/lib/ddtrace/contrib/action_view/patcher.rb +1 -1
  33. data/lib/ddtrace/contrib/active_record/events/instantiation.rb +1 -1
  34. data/lib/ddtrace/contrib/active_record/events/sql.rb +1 -1
  35. data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +2 -2
  36. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +2 -2
  37. data/lib/ddtrace/contrib/dalli/patcher.rb +1 -1
  38. data/lib/ddtrace/contrib/dalli/quantize.rb +1 -1
  39. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -1
  40. data/lib/ddtrace/contrib/excon/middleware.rb +3 -3
  41. data/lib/ddtrace/contrib/faraday/connection.rb +18 -0
  42. data/lib/ddtrace/contrib/faraday/integration.rb +1 -1
  43. data/lib/ddtrace/contrib/faraday/patcher.rb +3 -3
  44. data/lib/ddtrace/contrib/grape/endpoint.rb +5 -5
  45. data/lib/ddtrace/contrib/grape/patcher.rb +1 -1
  46. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +1 -1
  47. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +2 -2
  48. data/lib/ddtrace/contrib/grpc/patcher.rb +1 -1
  49. data/lib/ddtrace/contrib/http/instrumentation.rb +1 -1
  50. data/lib/ddtrace/contrib/mongodb/subscribers.rb +2 -2
  51. data/lib/ddtrace/contrib/patchable.rb +1 -1
  52. data/lib/ddtrace/contrib/patcher.rb +1 -1
  53. data/lib/ddtrace/contrib/rack/middlewares.rb +2 -2
  54. data/lib/ddtrace/contrib/rack/patcher.rb +2 -2
  55. data/lib/ddtrace/contrib/rack/request_queue.rb +1 -1
  56. data/lib/ddtrace/contrib/rails/configuration/settings.rb +1 -0
  57. data/lib/ddtrace/contrib/rails/framework.rb +12 -0
  58. data/lib/ddtrace/contrib/rake/instrumentation.rb +2 -2
  59. data/lib/ddtrace/contrib/redis/quantize.rb +1 -1
  60. data/lib/ddtrace/contrib/sinatra/tracer.rb +1 -1
  61. data/lib/ddtrace/ext/forced_tracing.rb +1 -1
  62. data/lib/ddtrace/ext/sampling.rb +3 -0
  63. data/lib/ddtrace/logger.rb +42 -0
  64. data/lib/ddtrace/metrics.rb +5 -5
  65. data/lib/ddtrace/monkey.rb +1 -1
  66. data/lib/ddtrace/pin.rb +1 -1
  67. data/lib/ddtrace/pipeline.rb +1 -1
  68. data/lib/ddtrace/propagation/http_propagator.rb +2 -2
  69. data/lib/ddtrace/runtime/cgroup.rb +1 -1
  70. data/lib/ddtrace/runtime/container.rb +1 -1
  71. data/lib/ddtrace/runtime/metrics.rb +1 -1
  72. data/lib/ddtrace/sampler.rb +1 -1
  73. data/lib/ddtrace/sampling/rule.rb +1 -1
  74. data/lib/ddtrace/sampling/rule_sampler.rb +4 -4
  75. data/lib/ddtrace/span.rb +24 -6
  76. data/lib/ddtrace/sync_writer.rb +4 -3
  77. data/lib/ddtrace/tracer.rb +37 -77
  78. data/lib/ddtrace/transport/http/client.rb +2 -2
  79. data/lib/ddtrace/utils.rb +1 -1
  80. data/lib/ddtrace/version.rb +2 -2
  81. data/lib/ddtrace/workers.rb +3 -3
  82. data/lib/ddtrace/writer.rb +3 -2
  83. metadata +44 -6
  84. data/lib/ddtrace/contrib/faraday/rack_builder.rb +0 -18
  85. data/lib/ddtrace/provider.rb +0 -21
@@ -41,9 +41,9 @@ module Datadog
41
41
 
42
42
  # Log error
43
43
  if stats.consecutive_errors > 0
44
- Datadog::Tracer.log.debug(message)
44
+ Datadog::Logger.log.debug(message)
45
45
  else
46
- Datadog::Tracer.log.error(message)
46
+ Datadog::Logger.log.error(message)
47
47
  end
48
48
 
49
49
  # Update statistics
@@ -57,7 +57,7 @@ module Datadog
57
57
  str.encode(::Encoding::UTF_8)
58
58
  end
59
59
  rescue => e
60
- Tracer.log.debug("Error encoding string in UTF-8: #{e}")
60
+ Logger.log.debug("Error encoding string in UTF-8: #{e}")
61
61
 
62
62
  options.fetch(:placeholder, STRING_PLACEHOLDER)
63
63
  end
@@ -1,8 +1,8 @@
1
1
  module Datadog
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 30
5
- PATCH = 1
4
+ MINOR = 31
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
@@ -55,7 +55,7 @@ module Datadog
55
55
  # ensures that the thread will not die because of an exception.
56
56
  # TODO[manu]: findout the reason and reschedule the send if it's not
57
57
  # a fatal exception
58
- Datadog::Tracer.log.error(
58
+ Datadog::Logger.log.error(
59
59
  "Error during traces flush: dropped #{traces.length} items. Cause: #{e} Location: #{e.backtrace.first}"
60
60
  )
61
61
  end
@@ -64,7 +64,7 @@ module Datadog
64
64
  def callback_runtime_metrics
65
65
  @runtime_metrics_task.call unless @runtime_metrics_task.nil?
66
66
  rescue StandardError => e
67
- Datadog::Tracer.log.error(
67
+ Datadog::Logger.log.error(
68
68
  "Error during runtime metrics flush. Cause: #{e} Location: #{e.backtrace.first}"
69
69
  )
70
70
  end
@@ -74,7 +74,7 @@ module Datadog
74
74
  @mutex.synchronize do
75
75
  return if @run
76
76
  @run = true
77
- Tracer.log.debug("Starting thread in the process: #{Process.pid}")
77
+ Logger.log.debug("Starting thread in the process: #{Process.pid}")
78
78
  @worker = Thread.new { perform }
79
79
  end
80
80
  end
@@ -61,7 +61,7 @@ module Datadog
61
61
  interval: @flush_interval
62
62
  )
63
63
 
64
- @worker.start()
64
+ @worker.start
65
65
  end
66
66
 
67
67
  # stops worker for spans.
@@ -69,6 +69,7 @@ module Datadog
69
69
  return if worker.nil?
70
70
  @worker.stop
71
71
  @worker = nil
72
+ true
72
73
  end
73
74
 
74
75
  # flush spans to the trace-agent, handles spans only
@@ -104,7 +105,7 @@ module Datadog
104
105
  def write(trace, services = nil)
105
106
  unless services.nil?
106
107
  Datadog::Patcher.do_once('Writer#write') do
107
- Datadog::Tracer.log.warn(%(
108
+ Datadog::Logger.log.warn(%(
108
109
  write: Writing services has been deprecated and no longer need to be provided.
109
110
  write(traces, services) can be updated to write(traces)
110
111
  ))
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.30.1
4
+ version: 0.31.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: 2019-12-30 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.2'
139
+ - !ruby/object:Gem::Dependency
140
+ name: bundler
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "<="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.1.2
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "<="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.1.2
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: yard
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +290,20 @@ dependencies:
276
290
  - - "~>"
277
291
  - !ruby/object:Gem::Version
278
292
  version: 0.4.9.2
293
+ - !ruby/object:Gem::Dependency
294
+ name: warning
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ">="
298
+ - !ruby/object:Gem::Version
299
+ version: '0'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
279
307
  description: |
280
308
  ddtrace is Datadog’s tracing client for Ruby. It is used to trace requests
281
309
  as they flow across web servers, databases and microservices so that developers
@@ -294,6 +322,7 @@ files:
294
322
  - ".circleci/images/primary/Dockerfile-2.4.6"
295
323
  - ".circleci/images/primary/Dockerfile-2.5.6"
296
324
  - ".circleci/images/primary/Dockerfile-2.6.4"
325
+ - ".circleci/images/primary/Dockerfile-2.7.0"
297
326
  - ".dockerignore"
298
327
  - ".env"
299
328
  - ".github/CODEOWNERS"
@@ -333,6 +362,17 @@ files:
333
362
  - lib/ddtrace/configuration/settings.rb
334
363
  - lib/ddtrace/context.rb
335
364
  - lib/ddtrace/context_flush.rb
365
+ - lib/ddtrace/context_provider.rb
366
+ - lib/ddtrace/contrib/action_cable/configuration/settings.rb
367
+ - lib/ddtrace/contrib/action_cable/event.rb
368
+ - lib/ddtrace/contrib/action_cable/events.rb
369
+ - lib/ddtrace/contrib/action_cable/events/broadcast.rb
370
+ - lib/ddtrace/contrib/action_cable/events/perform_action.rb
371
+ - lib/ddtrace/contrib/action_cable/events/transmit.rb
372
+ - lib/ddtrace/contrib/action_cable/ext.rb
373
+ - lib/ddtrace/contrib/action_cable/instrumentation.rb
374
+ - lib/ddtrace/contrib/action_cable/integration.rb
375
+ - lib/ddtrace/contrib/action_cable/patcher.rb
336
376
  - lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb
337
377
  - lib/ddtrace/contrib/action_pack/action_controller/patcher.rb
338
378
  - lib/ddtrace/contrib/action_pack/configuration/settings.rb
@@ -425,11 +465,11 @@ files:
425
465
  - lib/ddtrace/contrib/excon/patcher.rb
426
466
  - lib/ddtrace/contrib/extensions.rb
427
467
  - lib/ddtrace/contrib/faraday/configuration/settings.rb
468
+ - lib/ddtrace/contrib/faraday/connection.rb
428
469
  - lib/ddtrace/contrib/faraday/ext.rb
429
470
  - lib/ddtrace/contrib/faraday/integration.rb
430
471
  - lib/ddtrace/contrib/faraday/middleware.rb
431
472
  - lib/ddtrace/contrib/faraday/patcher.rb
432
- - lib/ddtrace/contrib/faraday/rack_builder.rb
433
473
  - lib/ddtrace/contrib/grape/configuration/settings.rb
434
474
  - lib/ddtrace/contrib/grape/endpoint.rb
435
475
  - lib/ddtrace/contrib/grape/ext.rb
@@ -599,7 +639,6 @@ files:
599
639
  - lib/ddtrace/pipeline/span_processor.rb
600
640
  - lib/ddtrace/propagation/grpc_propagator.rb
601
641
  - lib/ddtrace/propagation/http_propagator.rb
602
- - lib/ddtrace/provider.rb
603
642
  - lib/ddtrace/quantization/hash.rb
604
643
  - lib/ddtrace/quantization/http.rb
605
644
  - lib/ddtrace/runtime/cgroup.rb
@@ -670,8 +709,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
670
709
  - !ruby/object:Gem::Version
671
710
  version: '0'
672
711
  requirements: []
673
- rubyforge_project:
674
- rubygems_version: 2.6.14
712
+ rubygems_version: 3.0.6
675
713
  signing_key:
676
714
  specification_version: 4
677
715
  summary: Datadog tracing code for your Ruby applications
@@ -1,18 +0,0 @@
1
- module Datadog
2
- module Contrib
3
- module Faraday
4
- # Handles installation of our middleware if the user has *not*
5
- # already explicitly configured it for this correction.
6
- #
7
- # RackBuilder class was introduced in faraday 0.9.0:
8
- # https://github.com/lostisland/faraday/commit/77d7546d6d626b91086f427c56bc2cdd951353b3
9
- module RackBuilder
10
- def adapter(*args)
11
- use(:ddtrace) unless @handlers.any? { |h| h.klass == Middleware }
12
-
13
- super
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,21 +0,0 @@
1
- module Datadog
2
- # DefaultContextProvider is a default context provider that retrieves
3
- # all contexts from the current thread-local storage. It is suitable for
4
- # synchronous programming.
5
- class DefaultContextProvider
6
- # Initializes the default context provider with a thread-bound context.
7
- def initialize
8
- @context = Datadog::ThreadLocalContext.new
9
- end
10
-
11
- # Sets the current context.
12
- def context=(ctx)
13
- @context.local = ctx
14
- end
15
-
16
- # Return the current context.
17
- def context
18
- @context.local
19
- end
20
- end
21
- end