datadog 2.0.0.beta1 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +181 -1
  3. data/ext/datadog_profiling_native_extension/NativeExtensionDesign.md +1 -1
  4. data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +40 -32
  5. data/ext/datadog_profiling_native_extension/collectors_thread_context.c +23 -12
  6. data/ext/datadog_profiling_native_extension/crashtracker.c +108 -0
  7. data/ext/datadog_profiling_native_extension/extconf.rb +9 -23
  8. data/ext/datadog_profiling_native_extension/heap_recorder.c +81 -4
  9. data/ext/datadog_profiling_native_extension/heap_recorder.h +12 -1
  10. data/ext/datadog_profiling_native_extension/http_transport.c +1 -94
  11. data/ext/datadog_profiling_native_extension/libdatadog_helpers.c +86 -0
  12. data/ext/datadog_profiling_native_extension/libdatadog_helpers.h +4 -0
  13. data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +2 -12
  14. data/ext/datadog_profiling_native_extension/private_vm_api_access.c +25 -86
  15. data/ext/datadog_profiling_native_extension/profiling.c +2 -0
  16. data/ext/datadog_profiling_native_extension/ruby_helpers.h +3 -5
  17. data/ext/datadog_profiling_native_extension/stack_recorder.c +161 -62
  18. data/lib/datadog/appsec/contrib/devise/tracking.rb +8 -0
  19. data/lib/datadog/appsec/contrib/rack/request_middleware.rb +43 -13
  20. data/lib/datadog/appsec/event.rb +2 -2
  21. data/lib/datadog/core/configuration/components.rb +2 -1
  22. data/lib/datadog/core/configuration/option.rb +7 -5
  23. data/lib/datadog/core/configuration/settings.rb +34 -79
  24. data/lib/datadog/core/configuration.rb +20 -4
  25. data/lib/datadog/core/environment/platform.rb +7 -1
  26. data/lib/datadog/core/remote/client/capabilities.rb +2 -1
  27. data/lib/datadog/core/remote/client.rb +1 -5
  28. data/lib/datadog/core/remote/configuration/repository.rb +1 -1
  29. data/lib/datadog/core/remote/dispatcher.rb +3 -3
  30. data/lib/datadog/core/remote/transport/http/config.rb +5 -5
  31. data/lib/datadog/core/telemetry/client.rb +18 -10
  32. data/lib/datadog/core/telemetry/emitter.rb +9 -13
  33. data/lib/datadog/core/telemetry/event.rb +247 -57
  34. data/lib/datadog/core/telemetry/ext.rb +1 -0
  35. data/lib/datadog/core/telemetry/heartbeat.rb +1 -3
  36. data/lib/datadog/core/telemetry/http/ext.rb +4 -1
  37. data/lib/datadog/core/telemetry/http/response.rb +4 -0
  38. data/lib/datadog/core/telemetry/http/transport.rb +9 -4
  39. data/lib/datadog/core/telemetry/request.rb +59 -0
  40. data/lib/datadog/core/utils/base64.rb +22 -0
  41. data/lib/datadog/opentelemetry/sdk/span_processor.rb +19 -2
  42. data/lib/datadog/opentelemetry/sdk/trace/span.rb +3 -17
  43. data/lib/datadog/profiling/collectors/code_provenance.rb +10 -4
  44. data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +25 -0
  45. data/lib/datadog/profiling/component.rb +49 -17
  46. data/lib/datadog/profiling/crashtracker.rb +91 -0
  47. data/lib/datadog/profiling/exporter.rb +6 -3
  48. data/lib/datadog/profiling/http_transport.rb +7 -11
  49. data/lib/datadog/profiling/load_native_extension.rb +14 -1
  50. data/lib/datadog/profiling/profiler.rb +9 -2
  51. data/lib/datadog/profiling/stack_recorder.rb +6 -2
  52. data/lib/datadog/profiling.rb +12 -0
  53. data/lib/datadog/tracing/component.rb +5 -1
  54. data/lib/datadog/tracing/configuration/dynamic.rb +39 -1
  55. data/lib/datadog/tracing/configuration/settings.rb +1 -0
  56. data/lib/datadog/tracing/contrib/action_pack/integration.rb +1 -1
  57. data/lib/datadog/tracing/contrib/action_view/integration.rb +1 -1
  58. data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +1 -0
  59. data/lib/datadog/tracing/contrib/active_record/integration.rb +11 -1
  60. data/lib/datadog/tracing/contrib/active_support/integration.rb +1 -1
  61. data/lib/datadog/tracing/contrib/configuration/resolver.rb +43 -0
  62. data/lib/datadog/tracing/contrib/grape/endpoint.rb +43 -5
  63. data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +1 -1
  64. data/lib/datadog/tracing/correlation.rb +3 -4
  65. data/lib/datadog/tracing/remote.rb +5 -1
  66. data/lib/datadog/tracing/sampling/ext.rb +5 -1
  67. data/lib/datadog/tracing/sampling/matcher.rb +75 -26
  68. data/lib/datadog/tracing/sampling/rule.rb +27 -4
  69. data/lib/datadog/tracing/sampling/rule_sampler.rb +19 -1
  70. data/lib/datadog/tracing/sampling/span/matcher.rb +13 -41
  71. data/lib/datadog/tracing/span.rb +7 -2
  72. data/lib/datadog/tracing/span_link.rb +92 -0
  73. data/lib/datadog/tracing/span_operation.rb +6 -4
  74. data/lib/datadog/tracing/trace_operation.rb +12 -0
  75. data/lib/datadog/tracing/tracer.rb +4 -3
  76. data/lib/datadog/tracing/transport/serializable_trace.rb +3 -1
  77. data/lib/datadog/tracing/utils.rb +16 -0
  78. data/lib/datadog/version.rb +1 -1
  79. metadata +10 -31
  80. data/lib/datadog/core/telemetry/collector.rb +0 -248
  81. data/lib/datadog/core/telemetry/v1/app_event.rb +0 -59
  82. data/lib/datadog/core/telemetry/v1/application.rb +0 -94
  83. data/lib/datadog/core/telemetry/v1/configuration.rb +0 -27
  84. data/lib/datadog/core/telemetry/v1/dependency.rb +0 -45
  85. data/lib/datadog/core/telemetry/v1/host.rb +0 -59
  86. data/lib/datadog/core/telemetry/v1/install_signature.rb +0 -38
  87. data/lib/datadog/core/telemetry/v1/integration.rb +0 -66
  88. data/lib/datadog/core/telemetry/v1/product.rb +0 -36
  89. data/lib/datadog/core/telemetry/v1/telemetry_request.rb +0 -108
  90. data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +0 -41
  91. data/lib/datadog/core/telemetry/v2/request.rb +0 -29
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../utils/hash'
4
-
5
- module Datadog
6
- module Core
7
- module Telemetry
8
- module V1
9
- # Describes attributes for integration object
10
- class Integration
11
- using Core::Utils::Hash::Refinement
12
-
13
- ERROR_NIL_ENABLED_MESSAGE = ':enabled must not be nil'
14
- ERROR_NIL_NAME_MESSAGE = ':name must not be nil'
15
-
16
- attr_reader \
17
- :auto_enabled,
18
- :compatible,
19
- :enabled,
20
- :error,
21
- :name,
22
- :version
23
-
24
- # @param enabled [Boolean] Whether integration is enabled at time of request
25
- # @param name [String] Integration name
26
- # @param auto_enabled [Boolean] If integration is not enabled by default, but by user choice
27
- # @param compatible [Boolean] If integration is available, but incompatible
28
- # @param error [String] Error message if integration fails to load
29
- # @param version [String] Integration version (if specified in app-started, it should be for other events too)
30
- def initialize(enabled:, name:, auto_enabled: nil, compatible: nil, error: nil, version: nil)
31
- validate(enabled: enabled, name: name)
32
- @auto_enabled = auto_enabled
33
- @compatible = compatible
34
- @enabled = enabled
35
- @error = error
36
- @name = name
37
- @version = version
38
- end
39
-
40
- def to_h
41
- hash = {
42
- auto_enabled: @auto_enabled,
43
- compatible: @compatible,
44
- enabled: @enabled,
45
- error: @error,
46
- name: @name,
47
- version: @version
48
- }
49
- hash.compact!
50
- hash
51
- end
52
-
53
- private
54
-
55
- # Validates all required arguments passed to the class on initialization are not nil
56
- #
57
- # @!visibility private
58
- def validate(enabled:, name:)
59
- raise ArgumentError, ERROR_NIL_ENABLED_MESSAGE if enabled.nil?
60
- raise ArgumentError, ERROR_NIL_NAME_MESSAGE if name.nil?
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../utils/hash'
4
-
5
- module Datadog
6
- module Core
7
- module Telemetry
8
- module V1
9
- # Describes attributes for products object
10
- class Product
11
- using Core::Utils::Hash::Refinement
12
-
13
- attr_reader \
14
- :appsec,
15
- :profiler
16
-
17
- # @param appsec [Telemetry::V1::AppSec] Holds custom information about the appsec product
18
- # @param profiler [Telemetry::V1::Profiler] Holds custom information about the profiler product
19
- def initialize(appsec: nil, profiler: nil)
20
- @appsec = appsec
21
- @profiler = profiler
22
- end
23
-
24
- def to_h
25
- hash = {
26
- appsec: @appsec,
27
- profiler: @profiler
28
- }
29
- hash.compact!
30
- hash
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,108 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../utils/hash'
4
-
5
- module Datadog
6
- module Core
7
- module Telemetry
8
- module V1
9
- # Describes attributes for telemetry API request
10
- class TelemetryRequest
11
- using Core::Utils::Hash::Refinement
12
-
13
- ERROR_NIL_API_VERSION_MESSAGE = ':api_version must not be nil'
14
- ERROR_NIL_APPLICATION_MESSAGE = ':application must not be nil'
15
- ERROR_NIL_HOST_MESSAGE = ':host must not be nil'
16
- ERROR_NIL_PAYLOAD_MESSAGE = ':payload must not be nil'
17
- ERROR_NIL_REQUEST_TYPE_MESSAGE = ':request_type must not be nil'
18
- ERROR_NIL_RUNTIME_ID_MESSAGE = ':runtime_id must not be nil'
19
- ERROR_NIL_SEQ_ID_MESSAGE = ':seq_id must not be nil'
20
- ERROR_NIL_TRACER_TIME_MESSAGE = ':tracer_time must not be nil'
21
-
22
- attr_reader \
23
- :api_version,
24
- :application,
25
- :debug,
26
- :host,
27
- :payload,
28
- :request_type,
29
- :runtime_id,
30
- :seq_id,
31
- :session_id,
32
- :tracer_time
33
-
34
- # @param api_version [String] Requested API version, `v1`
35
- # @param application [Telemetry::V1::Application] Object that contains information about the environment of the
36
- # application
37
- # @param host [Telemetry::V1::Host] Object that holds host related information
38
- # @param payload [Telemetry::V1::AppEvent] The payload of the request, type impacted by :request_type
39
- # @param request_type [String] Requested API function impacting the Payload type, `app-started`
40
- # @param runtime_id [String] V4 UUID that represents a tracer session
41
- # @param seq_id [Integer] Counter that should be auto incremented every time an API call is being made
42
- # @param tracer_time [Integer] Unix timestamp (in seconds) of when the message is being sent
43
- # @param debug [Boolean] Flag that enables payload debug mode
44
- # @param session_id [String] V4 UUID that represents the session of the top level tracer process, often same\
45
- # as runtime_id
46
- def initialize(
47
- api_version:, application:, host:, payload:, request_type:, runtime_id:, seq_id:, tracer_time:,
48
- debug: nil, session_id: nil
49
- )
50
- validate(
51
- api_version: api_version,
52
- application: application,
53
- host: host,
54
- payload: payload,
55
- request_type: request_type,
56
- runtime_id: runtime_id,
57
- seq_id: seq_id,
58
- tracer_time: tracer_time
59
- )
60
- @api_version = api_version
61
- @application = application
62
- @debug = debug
63
- @host = host
64
- @payload = payload
65
- @request_type = request_type
66
- @runtime_id = runtime_id
67
- @seq_id = seq_id
68
- @session_id = session_id
69
- @tracer_time = tracer_time
70
- end
71
-
72
- def to_h
73
- hash = {
74
- api_version: @api_version,
75
- application: @application.to_h,
76
- debug: @debug,
77
- host: @host.to_h,
78
- payload: @payload.to_h,
79
- request_type: @request_type,
80
- runtime_id: @runtime_id,
81
- seq_id: @seq_id,
82
- session_id: @session_id,
83
- tracer_time: @tracer_time
84
- }
85
- hash.compact!
86
- hash
87
- end
88
-
89
- private
90
-
91
- # Validates all required arguments passed to the class on initialization are not nil
92
- #
93
- # @!visibility private
94
- def validate(api_version:, application:, host:, payload:, request_type:, runtime_id:, seq_id:, tracer_time:)
95
- raise ArgumentError, ERROR_NIL_API_VERSION_MESSAGE if api_version.nil?
96
- raise ArgumentError, ERROR_NIL_APPLICATION_MESSAGE if application.nil?
97
- raise ArgumentError, ERROR_NIL_HOST_MESSAGE if host.nil?
98
- raise ArgumentError, ERROR_NIL_PAYLOAD_MESSAGE if payload.nil?
99
- raise ArgumentError, ERROR_NIL_REQUEST_TYPE_MESSAGE if request_type.nil?
100
- raise ArgumentError, ERROR_NIL_RUNTIME_ID_MESSAGE if runtime_id.nil?
101
- raise ArgumentError, ERROR_NIL_SEQ_ID_MESSAGE if seq_id.nil?
102
- raise ArgumentError, ERROR_NIL_TRACER_TIME_MESSAGE if tracer_time.nil?
103
- end
104
- end
105
- end
106
- end
107
- end
108
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'request'
4
-
5
- module Datadog
6
- module Core
7
- module Telemetry
8
- module V2
9
- # Telemetry 'app-client-configuration-change' event.
10
- # This request should contain client library configuration that have changes since the app-started event.
11
- class AppClientConfigurationChange < Request
12
- def initialize(configuration_changes, origin: 'unknown')
13
- super('app-client-configuration-change')
14
-
15
- @configuration_changes = configuration_changes
16
- @origin = origin
17
- end
18
-
19
- # @see [Request#to_h]
20
- def to_h
21
- super.merge(payload: payload)
22
- end
23
-
24
- private
25
-
26
- def payload
27
- {
28
- configuration: @configuration_changes.map do |name, value|
29
- {
30
- name: name,
31
- value: value,
32
- origin: @origin,
33
- }
34
- end
35
- }
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Datadog
4
- module Core
5
- module Telemetry
6
- module V2
7
- # Base request object for Telemetry V2.
8
- #
9
- # `#to_h` is the main API, which returns a Ruby
10
- # Hash that will be serialized as JSON.
11
- class Request
12
- # @param [String] request_type the Telemetry request type, which dictates how the Hash payload should be processed
13
- def initialize(request_type)
14
- @request_type = request_type
15
- end
16
-
17
- # Converts this request to a Hash that will
18
- # be serialized as JSON.
19
- # @return [Hash]
20
- def to_h
21
- {
22
- request_type: @request_type
23
- }
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end