ddtrace 0.52.0 → 0.53.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +65 -1
  3. data/ddtrace.gemspec +1 -1
  4. data/docs/DevelopmentGuide.md +1 -6
  5. data/docs/GettingStarted.md +66 -16
  6. data/lib/datadog/ci/contrib/rspec/integration.rb +2 -2
  7. data/lib/datadog/ci/ext/environment.rb +41 -4
  8. data/lib/datadog/contrib.rb +2 -0
  9. data/lib/datadog/core/environment/vm_cache.rb +46 -0
  10. data/lib/ddtrace/configuration/agent_settings_resolver.rb +107 -40
  11. data/lib/ddtrace/configuration/components.rb +1 -1
  12. data/lib/ddtrace/configuration/settings.rb +13 -3
  13. data/lib/ddtrace/contrib/action_cable/instrumentation.rb +46 -0
  14. data/lib/ddtrace/contrib/action_cable/patcher.rb +1 -0
  15. data/lib/ddtrace/contrib/action_mailer/configuration/settings.rb +32 -0
  16. data/lib/ddtrace/contrib/action_mailer/event.rb +50 -0
  17. data/lib/ddtrace/contrib/action_mailer/events/deliver.rb +54 -0
  18. data/lib/ddtrace/contrib/action_mailer/events/process.rb +41 -0
  19. data/lib/ddtrace/contrib/action_mailer/events.rb +31 -0
  20. data/lib/ddtrace/contrib/action_mailer/ext.rb +32 -0
  21. data/lib/ddtrace/contrib/action_mailer/integration.rb +45 -0
  22. data/lib/ddtrace/contrib/action_mailer/patcher.rb +27 -0
  23. data/lib/ddtrace/contrib/active_job/configuration/settings.rb +33 -0
  24. data/lib/ddtrace/contrib/active_job/event.rb +54 -0
  25. data/lib/ddtrace/contrib/active_job/events/discard.rb +46 -0
  26. data/lib/ddtrace/contrib/active_job/events/enqueue.rb +45 -0
  27. data/lib/ddtrace/contrib/active_job/events/enqueue_at.rb +45 -0
  28. data/lib/ddtrace/contrib/active_job/events/enqueue_retry.rb +47 -0
  29. data/lib/ddtrace/contrib/active_job/events/perform.rb +45 -0
  30. data/lib/ddtrace/contrib/active_job/events/retry_stopped.rb +46 -0
  31. data/lib/ddtrace/contrib/active_job/events.rb +39 -0
  32. data/lib/ddtrace/contrib/active_job/ext.rb +32 -0
  33. data/lib/ddtrace/contrib/active_job/integration.rb +46 -0
  34. data/lib/ddtrace/contrib/active_job/log_injection.rb +21 -0
  35. data/lib/ddtrace/contrib/active_job/patcher.rb +33 -0
  36. data/lib/ddtrace/contrib/auto_instrument.rb +0 -1
  37. data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +0 -1
  38. data/lib/ddtrace/contrib/rails/framework.rb +22 -0
  39. data/lib/ddtrace/contrib/rails/patcher.rb +19 -10
  40. data/lib/ddtrace/contrib/registerable.rb +0 -1
  41. data/lib/ddtrace/contrib/sidekiq/ext.rb +3 -0
  42. data/lib/ddtrace/contrib/sidekiq/integration.rb +10 -0
  43. data/lib/ddtrace/contrib/sidekiq/patcher.rb +26 -0
  44. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/heartbeat.rb +30 -0
  45. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/job_fetch.rb +30 -0
  46. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +29 -0
  47. data/lib/ddtrace/contrib/sinatra/env.rb +2 -1
  48. data/lib/ddtrace/contrib/sinatra/tracer.rb +15 -2
  49. data/lib/ddtrace/ext/git.rb +12 -0
  50. data/lib/ddtrace/ext/profiling.rb +1 -0
  51. data/lib/ddtrace/ext/runtime.rb +3 -0
  52. data/lib/ddtrace/ext/transport.rb +11 -0
  53. data/lib/ddtrace/profiling/collectors/stack.rb +71 -27
  54. data/lib/ddtrace/profiling/encoding/profile.rb +9 -1
  55. data/lib/ddtrace/profiling/events/stack.rb +7 -7
  56. data/lib/ddtrace/profiling/pprof/converter.rb +22 -9
  57. data/lib/ddtrace/profiling/pprof/stack_sample.rb +28 -2
  58. data/lib/ddtrace/profiling/tasks/setup.rb +0 -1
  59. data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +1 -1
  60. data/lib/ddtrace/profiling/trace_identifiers/helper.rb +3 -3
  61. data/lib/ddtrace/profiling/transport/http.rb +8 -17
  62. data/lib/ddtrace/runtime/metrics.rb +14 -0
  63. data/lib/ddtrace/span.rb +7 -19
  64. data/lib/ddtrace/tracer.rb +1 -1
  65. data/lib/ddtrace/transport/http/adapters/net.rb +13 -3
  66. data/lib/ddtrace/transport/http/adapters/test.rb +4 -2
  67. data/lib/ddtrace/transport/http/adapters/unix_socket.rb +23 -12
  68. data/lib/ddtrace/transport/http/builder.rb +13 -6
  69. data/lib/ddtrace/transport/http.rb +5 -11
  70. data/lib/ddtrace/utils/time.rb +5 -6
  71. data/lib/ddtrace/version.rb +1 -1
  72. metadata +27 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f5ee0735d05ecdadc38bbc0978a2087141d136f31b1848845518d2086f877d2
4
- data.tar.gz: dd677af05b413d5593440aedca7b36dc9aba0c9ba08e9213eb8eb9c5443cb2d9
3
+ metadata.gz: 5d503fa2075462a3264c15a5e05ed1bc19afae88994c6df987dd32c6ee4f500c
4
+ data.tar.gz: 93a4cfaa1b395f1f968b1e87525df21b44c3a2fd63458013a1d506c9ae3b28e2
5
5
  SHA512:
6
- metadata.gz: 9f964c58615348135d915933cea46dac145c1266fa7d573fd8609c7eaf13be8667a8917af8ad5d93340935c00d2dc4bcd89adc7e14db7667eadf005448594f91
7
- data.tar.gz: 23ee7b6812d641a0f6bdc65e43baac6f7f17cc68ca2c07a42e87158400a9b97944aa0f6416c2002fdbbfd0e00f92b1e0a6907de7ee3df39e0840f408a6ec1aec
6
+ metadata.gz: 63918fc0a3b1d50a76842f6b500ae80300c6df9afd873628230a70a17b83b8971904fe2e1b1ff71cb44143eb6ef62b294f4958188c4db24cb12ee61a2069ab34
7
+ data.tar.gz: 5de75c82e3030e4c617a0b06b590574f5389d428eba9294e8b1a5221bd7f4e3b0bfbc40295cb86d1fb91af1a199585015ea6d6d4e3080dc475e15e8bba1288f0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.53.0] - 2021-10-06
6
+
7
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.53.0
8
+
9
+ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.52.0...v0.53.0
10
+
11
+ ### Added
12
+
13
+ - ActiveJob integration ([#1639][]) ([@bensheldon][])
14
+ - Instrument Action Cable subscribe/unsubscribe hooks ([#1674][]) ([@agrobbin][])
15
+ - Instrument Sidekiq server internal events (heartbeat, job fetch, and scheduled push) ([#1685][]) ([@agrobbin][])
16
+ - Correlate Active Job logs to the active DataDog trace ([#1694][]) ([@agrobbin][])
17
+ - Runtime Metrics: Global VM cache statistics ([#1680][])
18
+ - Automatically send traces to agent Unix socket if present ([#1700][])
19
+ - CI-App: User Provided Git Metadata ([#1662][])
20
+
21
+ ### Changed
22
+
23
+ - Profiler: Set Sinatra resource setting at beginning of request and delay setting fallback resource ([#1628][])
24
+ - Profiler: Use most recent event for trace resource name ([#1695][])
25
+ - Profiler: Limit number of threads per sample ([#1699][])
26
+ - Profiler: Rename `extract_trace_resource` to `endpoint.collection.enabled` ([#1702][])
27
+
28
+ ### Fixed
29
+
30
+ - Capture Rails exception before default error page is rendered ([#1684][])
31
+ - `NoMethodError` in sinatra integration when Tracer middleware is missing ([#1643][], [#1644][]) ([@mscrivo][])
32
+ - CI-App: Require `rspec-core` for RSpec integration ([#1654][]) ([@elliterate][])
33
+ - CI-App: Use the merge request branch on merge requests ([#1687][]) ([@carlallen][])
34
+ - Remove circular dependencies. ([#1668][]) ([@saturnflyer][])
35
+ - Links in the Table of Contents ([#1661][]) ([@chychkan][])
36
+ - CI-App: Fix CI Visibility Spec Tests ([#1706][])
37
+
38
+ ### Refactored
39
+
40
+ - Profiler: pprof encoding benchmark and improvements ([#1511][])
41
+
5
42
  ## [0.52.0] - 2021-08-09
6
43
 
7
44
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.52.0
@@ -1810,7 +1847,9 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
1810
1847
 
1811
1848
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
1812
1849
 
1813
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.48.0...master
1850
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v0.53.0...master
1851
+ [0.53.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.52.0...v0.53.0
1852
+ [0.52.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.51.1...v0.52.0
1814
1853
  [0.51.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.51.0...v0.51.1
1815
1854
  [0.51.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.50.0...v0.51.0
1816
1855
  [0.48.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.47.0...v0.48.0
@@ -2511,6 +2550,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2511
2550
  [#1507]: https://github.com/DataDog/dd-trace-rb/issues/1507
2512
2551
  [#1509]: https://github.com/DataDog/dd-trace-rb/issues/1509
2513
2552
  [#1510]: https://github.com/DataDog/dd-trace-rb/issues/1510
2553
+ [#1511]: https://github.com/DataDog/dd-trace-rb/issues/1511
2514
2554
  [#1523]: https://github.com/DataDog/dd-trace-rb/issues/1523
2515
2555
  [#1524]: https://github.com/DataDog/dd-trace-rb/issues/1524
2516
2556
  [#1529]: https://github.com/DataDog/dd-trace-rb/issues/1529
@@ -2549,6 +2589,24 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2549
2589
  [#1630]: https://github.com/DataDog/dd-trace-rb/issues/1630
2550
2590
  [#1632]: https://github.com/DataDog/dd-trace-rb/issues/1632
2551
2591
  [#1636]: https://github.com/DataDog/dd-trace-rb/issues/1636
2592
+ [#1639]: https://github.com/DataDog/dd-trace-rb/issues/1639
2593
+ [#1643]: https://github.com/DataDog/dd-trace-rb/issues/1643
2594
+ [#1644]: https://github.com/DataDog/dd-trace-rb/issues/1644
2595
+ [#1654]: https://github.com/DataDog/dd-trace-rb/issues/1654
2596
+ [#1661]: https://github.com/DataDog/dd-trace-rb/issues/1661
2597
+ [#1662]: https://github.com/DataDog/dd-trace-rb/issues/1662
2598
+ [#1668]: https://github.com/DataDog/dd-trace-rb/issues/1668
2599
+ [#1674]: https://github.com/DataDog/dd-trace-rb/issues/1674
2600
+ [#1680]: https://github.com/DataDog/dd-trace-rb/issues/1680
2601
+ [#1684]: https://github.com/DataDog/dd-trace-rb/issues/1684
2602
+ [#1685]: https://github.com/DataDog/dd-trace-rb/issues/1685
2603
+ [#1687]: https://github.com/DataDog/dd-trace-rb/issues/1687
2604
+ [#1694]: https://github.com/DataDog/dd-trace-rb/issues/1694
2605
+ [#1695]: https://github.com/DataDog/dd-trace-rb/issues/1695
2606
+ [#1699]: https://github.com/DataDog/dd-trace-rb/issues/1699
2607
+ [#1700]: https://github.com/DataDog/dd-trace-rb/issues/1700
2608
+ [#1702]: https://github.com/DataDog/dd-trace-rb/issues/1702
2609
+ [#1706]: https://github.com/DataDog/dd-trace-rb/issues/1706
2552
2610
  [@AdrianLC]: https://github.com/AdrianLC
2553
2611
  [@Azure7111]: https://github.com/Azure7111
2554
2612
  [@BabyGroot]: https://github.com/BabyGroot
@@ -2577,11 +2635,14 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2577
2635
  [@awendt]: https://github.com/awendt
2578
2636
  [@bartekbsh]: https://github.com/bartekbsh
2579
2637
  [@benhutton]: https://github.com/benhutton
2638
+ [@bensheldon]: https://github.com/bensheldon
2580
2639
  [@bheemreddy181]: https://github.com/bheemreddy181
2581
2640
  [@blaines]: https://github.com/blaines
2582
2641
  [@brafales]: https://github.com/brafales
2583
2642
  [@bzf]: https://github.com/bzf
2584
2643
  [@callumj]: https://github.com/callumj
2644
+ [@carlallen]: https://github.com/carlallen
2645
+ [@chychkan]: https://github.com/chychkan
2585
2646
  [@cjford]: https://github.com/cjford
2586
2647
  [@ck3g]: https://github.com/ck3g
2587
2648
  [@components]: https://github.com/components
@@ -2593,6 +2654,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2593
2654
  [@dorner]: https://github.com/dorner
2594
2655
  [@drcapulet]: https://github.com/drcapulet
2595
2656
  [@e1senh0rn]: https://github.com/e1senh0rn
2657
+ [@elliterate]: https://github.com/elliterate
2596
2658
  [@elyalvarado]: https://github.com/elyalvarado
2597
2659
  [@ericmustin]: https://github.com/ericmustin
2598
2660
  [@erict-square]: https://github.com/erict-square
@@ -2632,6 +2694,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2632
2694
  [@mdross95]: https://github.com/mdross95
2633
2695
  [@michaelkl]: https://github.com/michaelkl
2634
2696
  [@mriddle]: https://github.com/mriddle
2697
+ [@mscrivo]: https://github.com/mscrivo
2635
2698
  [@mstruve]: https://github.com/mstruve
2636
2699
  [@mustela]: https://github.com/mustela
2637
2700
  [@nic-lan]: https://github.com/nic-lan
@@ -2647,6 +2710,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2647
2710
  [@renchap]: https://github.com/renchap
2648
2711
  [@ricbartm]: https://github.com/ricbartm
2649
2712
  [@roccoblues]: https://github.com/roccoblues
2713
+ [@saturnflyer]: https://github.com/saturnflyer
2650
2714
  [@sco11morgan]: https://github.com/sco11morgan
2651
2715
  [@senny]: https://github.com/senny
2652
2716
  [@shayonj]: https://github.com/shayonj
data/ddtrace.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  .reject { |f| f.match(%r{^(test|spec|features|[.]circleci|[.]github|[.]dd-ci|benchmarks|gemfiles|integration|tasks|sorbet)/}) }
35
35
  .reject do |f|
36
36
  ['.dockerignore', '.env', '.gitattributes', '.gitlab-ci.yml', '.rspec', '.rubocop.yml',
37
- '.rubocop_todo.yml', '.simplecov', 'Appraisals', 'Gemfile', 'Rakefile', 'docker-compose.yml'].include?(f)
37
+ '.rubocop_todo.yml', '.simplecov', 'Appraisals', 'Gemfile', 'Rakefile', 'docker-compose.yml', '.pryrc'].include?(f)
38
38
  end
39
39
  spec.executables = ['ddtracerb']
40
40
  spec.require_paths = ['lib']
@@ -42,9 +42,7 @@ Then within this container you can [run tests](#running-tests), or [run code qua
42
42
 
43
43
  ## Testing
44
44
 
45
- The test suite uses both [Minitest](https://github.com/seattlerb/minitest) and [RSpec](https://rspec.info/) tests to verify the correctness of both the core trace library and its integrations.
46
-
47
- Minitest is deprecated in favor of RSpec; all new tests should be written in RSpec, and only existing minitests should be updated.
45
+ The test suite uses [RSpec](https://rspec.info/) tests to verify the correctness of both the core trace library and its integrations.
48
46
 
49
47
  ### Writing tests
50
48
 
@@ -68,9 +66,6 @@ Simplest way to run tests is to run `bundle exec rake ci`, which will run the en
68
66
  Run the tests for the core library with:
69
67
 
70
68
  ```
71
- # Run Minitest
72
- $ bundle exec rake test:main
73
- # Run RSpec
74
69
  $ bundle exec rake spec:main
75
70
  ```
76
71
 
@@ -28,8 +28,10 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
28
28
  - [Integration instrumentation](#integration-instrumentation)
29
29
  - [Action Cable](#action-cable)
30
30
  - [Action View](#action-view)
31
+ - [Action Mailer](#action-mailer)
31
32
  - [Active Model Serializers](#active-model-serializers)
32
33
  - [Action Pack](#action-pack)
34
+ - [Active Job](#active-job)
33
35
  - [Active Record](#active-record)
34
36
  - [Active Support](#active-support)
35
37
  - [AWS](#aws)
@@ -44,12 +46,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
44
46
  - [Grape](#grape)
45
47
  - [GraphQL](#graphql)
46
48
  - [gRPC](#grpc)
47
- - [http.rb](#http-rb)
49
+ - [http.rb](#httprb)
48
50
  - [httpclient](#httpclient)
49
51
  - [httpx](#httpx)
50
52
  - [MongoDB](#mongodb)
51
53
  - [MySQL2](#mysql2)
52
- - [Net/HTTP](#net-http)
54
+ - [Net/HTTP](#nethttp)
53
55
  - [Presto](#presto)
54
56
  - [Qless](#qless)
55
57
  - [Que](#que)
@@ -165,7 +167,7 @@ Install and configure the Datadog Agent to receive traces from your now instrume
165
167
 
166
168
  2. Install the gem with `bundle install`
167
169
 
168
- 3. You can configure, override, or disable any specific integration settings by also adding a [Rails Manual Configuration](#rails-manual-configuration) file.
170
+ 3. You can configure, override, or disable any specific integration settings by also adding a Rails manual instrumentation configuration file (next).
169
171
 
170
172
  #### Manual instrumentation
171
173
 
@@ -205,7 +207,7 @@ Install and configure the Datadog Agent to receive traces from your now instrume
205
207
  require 'ddtrace/auto_instrument'
206
208
  ```
207
209
 
208
- You can configure, override, or disable any specific integration settings by also adding a [Ruby Manual Configuration Block](#ruby-manual-configuration).
210
+ You can configure, override, or disable any specific integration settings by also adding a Ruby manual configuration block (next).
209
211
 
210
212
  #### Manual instrumentation
211
213
 
@@ -388,14 +390,16 @@ For a list of available integrations, and their configuration options, please re
388
390
  | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
389
391
  | ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
390
392
  | Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
393
+ | Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
391
394
  | Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
392
395
  | Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
393
396
  | Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
397
+ | Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
394
398
  | Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
395
399
  | Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
396
400
  | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
397
401
  | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
398
- | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
402
+ | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
399
403
  | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
400
404
  | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
401
405
  | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
@@ -405,7 +409,7 @@ For a list of available integrations, and their configuration options, please re
405
409
  | Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
406
410
  | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
407
411
  | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
408
- | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
412
+ | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
409
413
  | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
410
414
  | httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
411
415
  | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
@@ -471,6 +475,27 @@ Where `options` is an optional `Hash` that accepts the following parameters:
471
475
  | `service_name` | Service name used for rendering instrumentation. | `action_view` |
472
476
  | `template_base_path` | Used when the template name is parsed. If you don't store your templates in the `views/` folder, you may need to change this value | `'views/'` |
473
477
 
478
+ ### Action Mailer
479
+
480
+ The Action Mailer integration provides tracing for Rails 5 ActionMailer actions.
481
+
482
+ You can enable it through `Datadog.configure`:
483
+
484
+ ```ruby
485
+ require 'ddtrace'
486
+ Datadog.configure do |c|
487
+ c.use :action_mailer, options
488
+ end
489
+ ```
490
+
491
+ Where `options` is an optional `Hash` that accepts the following parameters:
492
+
493
+ | Key | Description | Default |
494
+ | --- | ----------- | ------- |
495
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
496
+ | `service_name` | Service name used for `action_mailer` instrumentation | `'action_mailer'` |
497
+ | `email_data` | Whether or not to append additional email payload metadata to `action_mailer.deliver` spans. Fields include `['subject', 'to', 'from', 'bcc', 'cc', 'date', 'perform_deliveries']`. | `false` |
498
+
474
499
  ### Active Model Serializers
475
500
 
476
501
  The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
@@ -510,6 +535,28 @@ Where `options` is an optional `Hash` that accepts the following parameters:
510
535
  | ---| --- | --- |
511
536
  | `service_name` | Service name used for rendering instrumentation. | `action_pack` |
512
537
 
538
+ ### Active Job
539
+
540
+ Most of the time, Active Job is set up as part of Rails, but it can be activated separately:
541
+
542
+ ```ruby
543
+ require 'activejob'
544
+ require 'ddtrace'
545
+
546
+ Datadog.configure do |c|
547
+ c.use :active_job, options
548
+ end
549
+
550
+ ExampleJob.perform_later
551
+ ```
552
+
553
+ Where `options` is an optional `Hash` that accepts the following parameters:
554
+
555
+ | Key | Description | Default |
556
+ | --- | ----------- | ------- |
557
+ | `service_name` | Service name used for `active_job` instrumentation | `'active_job'` |
558
+ | `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Active Job logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. | `false` |
559
+
513
560
  ### Active Record
514
561
 
515
562
  Most of the time, Active Record is set up as part of a web framework (Rails, Sinatra...) however, it can be set up alone:
@@ -1434,7 +1481,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1434
1481
 
1435
1482
  | MRI Versions | JRuby Versions | Rails Versions |
1436
1483
  | ------------- | -------------- | -------------- |
1437
- | 2.0 | | 3.0 - 3.2 |
1438
1484
  | 2.1 | | 3.0 - 4.2 |
1439
1485
  | 2.2 - 2.3 | | 3.0 - 5.2 |
1440
1486
  | 2.4 | | 4.2.8 - 5.2 |
@@ -2125,7 +2171,7 @@ For more details on how to activate distributed tracing for integrations, see th
2125
2171
  - [Rack](#rack)
2126
2172
  - [Rails](#rails)
2127
2173
  - [Sinatra](#sinatra)
2128
- - [http.rb](#http-rb)
2174
+ - [http.rb](#httprb)
2129
2175
  - [httpclient](#httpclient)
2130
2176
  - [httpx](#httpx)
2131
2177
 
@@ -2343,7 +2389,9 @@ Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.'
2343
2389
 
2344
2390
  ### Configuring the transport layer
2345
2391
 
2346
- By default, the tracer submits trace data using `Net::HTTP` to `127.0.0.1:8126`, the default location for the Datadog trace agent process. However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
2392
+ By default, the tracer submits trace data using the Unix socket `/var/run/datadog/apm.socket`, if one is created by the Agent. Otherwise, it connects via HTTP to `127.0.0.1:8126`, the default TCP location the Agent listens on.
2393
+
2394
+ However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
2347
2395
 
2348
2396
  Some basic settings, such as hostname and port, can be configured using [tracer settings](#tracer-settings).
2349
2397
 
@@ -2369,7 +2417,7 @@ To use, first configure your trace agent to listen by Unix socket, then configur
2369
2417
  ```ruby
2370
2418
  Datadog.configure do |c|
2371
2419
  c.tracer.transport_options = proc { |t|
2372
- # Provide filepath to trace agent Unix socket
2420
+ # Provide local path to trace agent Unix socket
2373
2421
  t.adapter :unix, '/tmp/ddagent/trace.sock'
2374
2422
  }
2375
2423
  end
@@ -2442,11 +2490,13 @@ See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogsta
2442
2490
 
2443
2491
  The stats are VM specific and will include:
2444
2492
 
2445
- | Name | Type | Description |
2446
- | -------------------------- | ------- | -------------------------------------------------------- |
2447
- | `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. |
2448
- | `runtime.ruby.thread_count` | `gauge` | Number of threads. |
2449
- | `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics: collected from `GC.stat`. |
2493
+ | Name | Type | Description | Available on |
2494
+ | -------------------------- | ------- | -------------------------------------------------------- | ------------ |
2495
+ | `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. | CRuby |
2496
+ | `runtime.ruby.gc.*` | `gauge` | Garbage collection statistics: collected from `GC.stat`. | All runtimes |
2497
+ | `runtime.ruby.thread_count` | `gauge` | Number of threads. | All runtimes |
2498
+ | `runtime.ruby.global_constant_state` | `gauge` | Global constant cache generation. | CRuby |
2499
+ | `runtime.ruby.global_method_state` | `gauge` | [Global method cache generation.](https://tenderlovemaking.com/2015/12/23/inline-caching-in-mri.html) | [CRuby < 3.0.0](https://docs.ruby-lang.org/en/3.0.0/NEWS_md.html#label-Implementation+improvements) |
2450
2500
 
2451
2501
  In addition, all metrics include the following tags:
2452
2502
 
@@ -2492,7 +2542,7 @@ However, additional instrumentation provided by Datadog can be activated alongsi
2492
2542
 
2493
2543
  **Setup**
2494
2544
 
2495
- To get started with profiling, follow the [Profiler Getting Started Guide](https://docs.datadoghq.com/tracing/profiler/getting_started/?code-lang=ruby).
2545
+ To get started with profiling, follow the [Enabling the Ruby Profiler](https://docs.datadoghq.com/tracing/profiler/enabling/ruby/) guide.
2496
2546
 
2497
2547
  #### Troubleshooting
2498
2548
 
@@ -17,8 +17,8 @@ module Datadog
17
17
  register_as :rspec, auto_patch: true
18
18
 
19
19
  def self.version
20
- Gem.loaded_specs['rspec'] \
21
- && Gem.loaded_specs['rspec'].version
20
+ Gem.loaded_specs['rspec-core'] \
21
+ && Gem.loaded_specs['rspec-core'].version
22
22
  end
23
23
 
24
24
  def self.loaded?
@@ -63,6 +63,9 @@ module Datadog
63
63
  tags[key] ||= value
64
64
  end
65
65
 
66
+ # If user defined metadata is defined, overwrite
67
+ tags.merge!(extract_user_defined_git(env))
68
+
66
69
  tags.reject { |_, v| v.nil? }
67
70
  end
68
71
 
@@ -131,6 +134,8 @@ module Datadog
131
134
  TAG_PIPELINE_NUMBER => build_id,
132
135
  TAG_PIPELINE_URL => pipeline_url,
133
136
  TAG_JOB_URL => job_url,
137
+ TAG_STAGE_NAME => env['SYSTEM_STAGEDISPLAYNAME'],
138
+ TAG_JOB_NAME => env['SYSTEM_JOBDISPLAYNAME'],
134
139
  Datadog::Ext::Git::TAG_REPOSITORY_URL =>
135
140
  env['SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI'] || env['BUILD_REPOSITORY_URI'],
136
141
  Datadog::Ext::Git::TAG_COMMIT_SHA => env['SYSTEM_PULLREQUEST_SOURCECOMMITID'] || env['BUILD_SOURCEVERSION'],
@@ -225,12 +230,17 @@ module Datadog
225
230
  end
226
231
 
227
232
  def extract_gitlab(env)
233
+ commit_author_name, commit_author_email = extract_name_email(env['CI_COMMIT_AUTHOR'])
234
+
228
235
  url = env['CI_PIPELINE_URL']
229
236
  {
230
- Datadog::Ext::Git::TAG_BRANCH => env['CI_COMMIT_BRANCH'],
237
+ Datadog::Ext::Git::TAG_BRANCH => env['CI_COMMIT_REF_NAME'],
231
238
  Datadog::Ext::Git::TAG_COMMIT_SHA => env['CI_COMMIT_SHA'],
232
239
  Datadog::Ext::Git::TAG_REPOSITORY_URL => env['CI_REPOSITORY_URL'],
233
240
  Datadog::Ext::Git::TAG_TAG => env['CI_COMMIT_TAG'],
241
+ Datadog::Ext::Git::TAG_COMMIT_AUTHOR_NAME => commit_author_name,
242
+ Datadog::Ext::Git::TAG_COMMIT_AUTHOR_EMAIL => commit_author_email,
243
+ Datadog::Ext::Git::TAG_COMMIT_AUTHOR_DATE => env['CI_COMMIT_TIMESTAMP'],
234
244
  TAG_STAGE_NAME => env['CI_JOB_STAGE'],
235
245
  TAG_JOB_NAME => env['CI_JOB_NAME'],
236
246
  TAG_JOB_URL => env['CI_JOB_URL'],
@@ -254,7 +264,7 @@ module Datadog
254
264
  {
255
265
  Datadog::Ext::Git::TAG_BRANCH => branch,
256
266
  Datadog::Ext::Git::TAG_COMMIT_SHA => env['GIT_COMMIT'],
257
- Datadog::Ext::Git::TAG_REPOSITORY_URL => env['GIT_URL'],
267
+ Datadog::Ext::Git::TAG_REPOSITORY_URL => env['GIT_URL'] || env['GIT_URL_1'],
258
268
  Datadog::Ext::Git::TAG_TAG => tag,
259
269
  TAG_PIPELINE_ID => env['BUILD_TAG'],
260
270
  TAG_PIPELINE_NAME => name,
@@ -312,7 +322,7 @@ module Datadog
312
322
  {
313
323
  TAG_PROVIDER_NAME => 'bitrise',
314
324
  TAG_PIPELINE_ID => env['BITRISE_BUILD_SLUG'],
315
- TAG_PIPELINE_NAME => env['BITRISE_APP_TITLE'],
325
+ TAG_PIPELINE_NAME => env['BITRISE_TRIGGERED_WORKFLOW_ID'],
316
326
  TAG_PIPELINE_NUMBER => env['BITRISE_BUILD_NUMBER'],
317
327
  TAG_PIPELINE_URL => env['BITRISE_BUILD_URL'],
318
328
  TAG_WORKSPACE_PATH => env['BITRISE_SOURCE_DIR'],
@@ -324,6 +334,22 @@ module Datadog
324
334
  }
325
335
  end
326
336
 
337
+ def extract_user_defined_git(env)
338
+ {
339
+ Datadog::Ext::Git::TAG_REPOSITORY_URL => env[Datadog::Ext::Git::ENV_REPOSITORY_URL],
340
+ Datadog::Ext::Git::TAG_COMMIT_SHA => env[Datadog::Ext::Git::ENV_COMMIT_SHA],
341
+ Datadog::Ext::Git::TAG_BRANCH => env[Datadog::Ext::Git::ENV_BRANCH],
342
+ Datadog::Ext::Git::TAG_TAG => env[Datadog::Ext::Git::ENV_TAG],
343
+ Datadog::Ext::Git::TAG_COMMIT_MESSAGE => env[Datadog::Ext::Git::ENV_COMMIT_MESSAGE],
344
+ Datadog::Ext::Git::TAG_COMMIT_AUTHOR_NAME => env[Datadog::Ext::Git::ENV_COMMIT_AUTHOR_NAME],
345
+ Datadog::Ext::Git::TAG_COMMIT_AUTHOR_EMAIL => env[Datadog::Ext::Git::ENV_COMMIT_AUTHOR_EMAIL],
346
+ Datadog::Ext::Git::TAG_COMMIT_AUTHOR_DATE => env[Datadog::Ext::Git::ENV_COMMIT_AUTHOR_DATE],
347
+ Datadog::Ext::Git::TAG_COMMIT_COMMITTER_NAME => env[Datadog::Ext::Git::ENV_COMMIT_COMMITTER_NAME],
348
+ Datadog::Ext::Git::TAG_COMMIT_COMMITTER_EMAIL => env[Datadog::Ext::Git::ENV_COMMIT_COMMITTER_EMAIL],
349
+ Datadog::Ext::Git::TAG_COMMIT_COMMITTER_DATE => env[Datadog::Ext::Git::ENV_COMMIT_COMMITTER_DATE]
350
+ }.reject { |_, v| v.nil? || v.strip.empty? }
351
+ end
352
+
327
353
  def git_commit_users
328
354
  # Get committer and author information in one command.
329
355
  output = exec_git_command("git show -s --format='%an\t%ae\t%at\t%cn\t%ce\t%ct'")
@@ -428,7 +454,7 @@ module Datadog
428
454
 
429
455
  def branch_or_tag(branch_or_tag)
430
456
  branch = tag = nil
431
- if branch_or_tag.include?('tags/')
457
+ if branch_or_tag && branch_or_tag.include?('tags/')
432
458
  tag = branch_or_tag
433
459
  else
434
460
  branch = branch_or_tag
@@ -436,6 +462,17 @@ module Datadog
436
462
 
437
463
  [branch, tag]
438
464
  end
465
+
466
+ def extract_name_email(name_and_email)
467
+ if name_and_email.include?('<') && (match = /^([^<]*)<([^>]*)>$/.match(name_and_email))
468
+ name = match[1]
469
+ name = name.strip if name
470
+ email = match[2]
471
+ return [name, email] if name && email
472
+ end
473
+
474
+ [nil, name_and_email]
475
+ end
439
476
  end
440
477
  # rubocop:enable Metrics/ModuleLength:
441
478
  end
@@ -26,9 +26,11 @@ module Datadog
26
26
  end
27
27
 
28
28
  require 'ddtrace/contrib/action_cable/integration'
29
+ require 'ddtrace/contrib/action_mailer/integration'
29
30
  require 'ddtrace/contrib/action_pack/integration'
30
31
  require 'ddtrace/contrib/action_view/integration'
31
32
  require 'ddtrace/contrib/active_model_serializers/integration'
33
+ require 'ddtrace/contrib/active_job/integration'
32
34
  require 'ddtrace/contrib/active_record/integration'
33
35
  require 'ddtrace/contrib/active_support/integration'
34
36
  require 'ddtrace/contrib/aws/integration'
@@ -0,0 +1,46 @@
1
+ # typed: true
2
+ module Datadog
3
+ module Core
4
+ module Environment
5
+ # Reports Ruby VM cache performance statistics.
6
+ # This currently encompasses cache invalidation counters and is CRuby-specific.
7
+ #
8
+ # JRuby emulates some CRuby global cache statistics, but they are synthetic and don't
9
+ # provide actionable performance information in the same way CRuby does.
10
+ # @see https://github.com/jruby/jruby/issues/4384#issuecomment-267069314
11
+ #
12
+ # TruffleRuby does not have a global runtime cache invalidation cache.
13
+ # @see http://archive.today/2021.09.10-205702/https://medium.com/graalvm/precise-method-and-constant-invalidation-in-truffleruby-4dd56c6bac1a
14
+ module VMCache
15
+ module_function
16
+
17
+ # Global constant cache "generation" counter.
18
+ #
19
+ # Whenever a constant creation busts the global constant cache
20
+ # this value is incremented. This has a measurable performance impact
21
+ # and thus show be avoided after application warm up.
22
+ def global_constant_state
23
+ ::RubyVM.stat[:global_constant_state]
24
+ end
25
+
26
+ # Global method cache "generation" counter.
27
+ #
28
+ # Whenever a method creation busts the global method cache
29
+ # this value is incremented. This has a measurable performance impact
30
+ # and thus show be avoided after application warm up.
31
+ #
32
+ # Since Ruby 3.0, the method class is kept on a per-class basis,
33
+ # largely mitigating global method cache busting. `global_method_state`
34
+ # is thus not available since Ruby 3.0.
35
+ # @see https://bugs.ruby-lang.org/issues/16614
36
+ def global_method_state
37
+ ::RubyVM.stat[:global_method_state]
38
+ end
39
+
40
+ def available?
41
+ defined?(::RubyVM) && ::RubyVM.respond_to?(:stat)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end