ddtrace 1.20.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +115 -1
- data/LICENSE-3rdparty.csv +1 -1
- data/bin/ddprofrb +15 -0
- data/bin/ddtracerb +3 -1
- data/ext/{ddtrace_profiling_loader/ddtrace_profiling_loader.c → datadog_profiling_loader/datadog_profiling_loader.c} +2 -2
- data/ext/{ddtrace_profiling_loader → datadog_profiling_loader}/extconf.rb +3 -3
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_cpu_and_wall_time_worker.c +238 -61
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_discrete_dynamic_sampler.c +145 -72
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_discrete_dynamic_sampler.h +17 -5
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_thread_context.c +97 -4
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/extconf.rb +2 -2
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.c +45 -3
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/heap_recorder.h +7 -1
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/http_transport.c +15 -19
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/native_extension_helpers.rb +4 -4
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/private_vm_api_access.c +14 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/private_vm_api_access.h +4 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/profiling.c +1 -1
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/ruby_helpers.c +10 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/ruby_helpers.h +2 -0
- data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.c +7 -9
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +43 -13
- data/lib/datadog/appsec/event.rb +1 -1
- data/lib/datadog/auto_instrument.rb +3 -0
- data/lib/datadog/core/configuration/components.rb +7 -6
- data/lib/datadog/core/configuration/option.rb +8 -6
- data/lib/datadog/core/configuration/settings.rb +130 -63
- data/lib/datadog/core/configuration.rb +20 -4
- data/lib/datadog/core/diagnostics/environment_logger.rb +4 -3
- data/lib/datadog/core/environment/git.rb +25 -0
- data/lib/datadog/core/environment/identity.rb +18 -48
- data/lib/datadog/core/environment/platform.rb +7 -1
- data/lib/datadog/core/git/ext.rb +2 -23
- data/lib/datadog/core/remote/client/capabilities.rb +1 -1
- data/lib/datadog/core/remote/negotiation.rb +2 -2
- data/lib/datadog/core/remote/transport/http/config.rb +1 -1
- data/lib/datadog/core/remote/worker.rb +7 -4
- data/lib/datadog/core/telemetry/client.rb +18 -10
- data/lib/datadog/core/telemetry/emitter.rb +9 -13
- data/lib/datadog/core/telemetry/event.rb +247 -57
- data/lib/datadog/core/telemetry/ext.rb +1 -0
- data/lib/datadog/core/telemetry/heartbeat.rb +1 -3
- data/lib/datadog/core/telemetry/http/ext.rb +4 -1
- data/lib/datadog/core/telemetry/http/transport.rb +9 -4
- data/lib/datadog/core/telemetry/request.rb +59 -0
- data/lib/datadog/core/transport/ext.rb +2 -0
- data/lib/datadog/core/utils/url.rb +25 -0
- data/lib/datadog/profiling/collectors/code_provenance.rb +10 -4
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +31 -0
- data/lib/datadog/profiling/collectors/info.rb +101 -0
- data/lib/datadog/profiling/component.rb +34 -28
- data/lib/datadog/profiling/exporter.rb +19 -5
- data/lib/datadog/profiling/ext.rb +2 -0
- data/lib/datadog/profiling/flush.rb +6 -3
- data/lib/datadog/profiling/http_transport.rb +5 -1
- data/lib/datadog/profiling/load_native_extension.rb +19 -6
- data/lib/datadog/profiling/native_extension.rb +1 -1
- data/lib/datadog/profiling/tag_builder.rb +5 -0
- data/lib/datadog/profiling/tasks/exec.rb +3 -3
- data/lib/datadog/profiling/tasks/help.rb +3 -3
- data/lib/datadog/profiling.rb +13 -2
- data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +11 -4
- data/lib/datadog/tracing/contrib/concurrent_ruby/async_patch.rb +20 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +11 -1
- data/lib/datadog/tracing/contrib/configurable.rb +1 -1
- data/lib/datadog/tracing/contrib/extensions.rb +6 -2
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +11 -4
- data/lib/datadog/tracing/sampling/matcher.rb +23 -3
- data/lib/datadog/tracing/sampling/rule.rb +7 -2
- data/lib/datadog/tracing/sampling/rule_sampler.rb +2 -0
- data/lib/datadog/tracing/trace_operation.rb +1 -2
- data/lib/datadog/tracing/transport/http.rb +1 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +31 -0
- data/lib/ddtrace/version.rb +1 -1
- metadata +55 -62
- data/ext/ddtrace_profiling_native_extension/pid_controller.c +0 -57
- data/ext/ddtrace_profiling_native_extension/pid_controller.h +0 -45
- data/lib/datadog/core/telemetry/collector.rb +0 -250
- data/lib/datadog/core/telemetry/v1/app_event.rb +0 -59
- data/lib/datadog/core/telemetry/v1/application.rb +0 -92
- data/lib/datadog/core/telemetry/v1/configuration.rb +0 -25
- data/lib/datadog/core/telemetry/v1/dependency.rb +0 -43
- data/lib/datadog/core/telemetry/v1/host.rb +0 -59
- data/lib/datadog/core/telemetry/v1/install_signature.rb +0 -38
- data/lib/datadog/core/telemetry/v1/integration.rb +0 -64
- data/lib/datadog/core/telemetry/v1/product.rb +0 -36
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +0 -106
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +0 -41
- data/lib/datadog/core/telemetry/v2/request.rb +0 -29
- data/lib/datadog/profiling/diagnostics/environment_logger.rb +0 -39
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/NativeExtensionDesign.md +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id_from_pthread.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id_noop.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_dynamic_sampling_rate.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_dynamic_sampling_rate.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_gc_profiling_helper.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_gc_profiling_helper.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_idle_sampling_helper.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_idle_sampling_helper.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_stack.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_stack.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/collectors_thread_context.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/helpers.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/libdatadog_helpers.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/libdatadog_helpers.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/setup_signal_handler.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/setup_signal_handler.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.h +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.c +0 -0
- /data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.h +0 -0
@@ -1,106 +0,0 @@
|
|
1
|
-
require_relative '../../utils/hash'
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module Core
|
5
|
-
module Telemetry
|
6
|
-
module V1
|
7
|
-
# Describes attributes for telemetry API request
|
8
|
-
class TelemetryRequest
|
9
|
-
using Core::Utils::Hash::Refinement
|
10
|
-
|
11
|
-
ERROR_NIL_API_VERSION_MESSAGE = ':api_version must not be nil'.freeze
|
12
|
-
ERROR_NIL_APPLICATION_MESSAGE = ':application must not be nil'.freeze
|
13
|
-
ERROR_NIL_HOST_MESSAGE = ':host must not be nil'.freeze
|
14
|
-
ERROR_NIL_PAYLOAD_MESSAGE = ':payload must not be nil'.freeze
|
15
|
-
ERROR_NIL_REQUEST_TYPE_MESSAGE = ':request_type must not be nil'.freeze
|
16
|
-
ERROR_NIL_RUNTIME_ID_MESSAGE = ':runtime_id must not be nil'.freeze
|
17
|
-
ERROR_NIL_SEQ_ID_MESSAGE = ':seq_id must not be nil'.freeze
|
18
|
-
ERROR_NIL_TRACER_TIME_MESSAGE = ':tracer_time must not be nil'.freeze
|
19
|
-
|
20
|
-
attr_reader \
|
21
|
-
:api_version,
|
22
|
-
:application,
|
23
|
-
:debug,
|
24
|
-
:host,
|
25
|
-
:payload,
|
26
|
-
:request_type,
|
27
|
-
:runtime_id,
|
28
|
-
:seq_id,
|
29
|
-
:session_id,
|
30
|
-
:tracer_time
|
31
|
-
|
32
|
-
# @param api_version [String] Requested API version, `v1`
|
33
|
-
# @param application [Telemetry::V1::Application] Object that contains information about the environment of the
|
34
|
-
# application
|
35
|
-
# @param host [Telemetry::V1::Host] Object that holds host related information
|
36
|
-
# @param payload [Telemetry::V1::AppEvent] The payload of the request, type impacted by :request_type
|
37
|
-
# @param request_type [String] Requested API function impacting the Payload type, `app-started`
|
38
|
-
# @param runtime_id [String] V4 UUID that represents a tracer session
|
39
|
-
# @param seq_id [Integer] Counter that should be auto incremented every time an API call is being made
|
40
|
-
# @param tracer_time [Integer] Unix timestamp (in seconds) of when the message is being sent
|
41
|
-
# @param debug [Boolean] Flag that enables payload debug mode
|
42
|
-
# @param session_id [String] V4 UUID that represents the session of the top level tracer process, often same\
|
43
|
-
# as runtime_id
|
44
|
-
def initialize(
|
45
|
-
api_version:, application:, host:, payload:, request_type:, runtime_id:, seq_id:, tracer_time:,
|
46
|
-
debug: nil, session_id: nil
|
47
|
-
)
|
48
|
-
validate(
|
49
|
-
api_version: api_version,
|
50
|
-
application: application,
|
51
|
-
host: host,
|
52
|
-
payload: payload,
|
53
|
-
request_type: request_type,
|
54
|
-
runtime_id: runtime_id,
|
55
|
-
seq_id: seq_id,
|
56
|
-
tracer_time: tracer_time
|
57
|
-
)
|
58
|
-
@api_version = api_version
|
59
|
-
@application = application
|
60
|
-
@debug = debug
|
61
|
-
@host = host
|
62
|
-
@payload = payload
|
63
|
-
@request_type = request_type
|
64
|
-
@runtime_id = runtime_id
|
65
|
-
@seq_id = seq_id
|
66
|
-
@session_id = session_id
|
67
|
-
@tracer_time = tracer_time
|
68
|
-
end
|
69
|
-
|
70
|
-
def to_h
|
71
|
-
hash = {
|
72
|
-
api_version: @api_version,
|
73
|
-
application: @application.to_h,
|
74
|
-
debug: @debug,
|
75
|
-
host: @host.to_h,
|
76
|
-
payload: @payload.to_h,
|
77
|
-
request_type: @request_type,
|
78
|
-
runtime_id: @runtime_id,
|
79
|
-
seq_id: @seq_id,
|
80
|
-
session_id: @session_id,
|
81
|
-
tracer_time: @tracer_time
|
82
|
-
}
|
83
|
-
hash.compact!
|
84
|
-
hash
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
# Validates all required arguments passed to the class on initialization are not nil
|
90
|
-
#
|
91
|
-
# @!visibility private
|
92
|
-
def validate(api_version:, application:, host:, payload:, request_type:, runtime_id:, seq_id:, tracer_time:)
|
93
|
-
raise ArgumentError, ERROR_NIL_API_VERSION_MESSAGE if api_version.nil?
|
94
|
-
raise ArgumentError, ERROR_NIL_APPLICATION_MESSAGE if application.nil?
|
95
|
-
raise ArgumentError, ERROR_NIL_HOST_MESSAGE if host.nil?
|
96
|
-
raise ArgumentError, ERROR_NIL_PAYLOAD_MESSAGE if payload.nil?
|
97
|
-
raise ArgumentError, ERROR_NIL_REQUEST_TYPE_MESSAGE if request_type.nil?
|
98
|
-
raise ArgumentError, ERROR_NIL_RUNTIME_ID_MESSAGE if runtime_id.nil?
|
99
|
-
raise ArgumentError, ERROR_NIL_SEQ_ID_MESSAGE if seq_id.nil?
|
100
|
-
raise ArgumentError, ERROR_NIL_TRACER_TIME_MESSAGE if tracer_time.nil?
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
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
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'date'
|
4
|
-
require 'json'
|
5
|
-
require 'rbconfig'
|
6
|
-
require_relative '../../core/diagnostics/environment_logger'
|
7
|
-
|
8
|
-
module Datadog
|
9
|
-
module Profiling
|
10
|
-
module Diagnostics
|
11
|
-
# Collects and logs Profiling diagnostic information
|
12
|
-
module EnvironmentLogger
|
13
|
-
extend Core::Diagnostics::EnvironmentLogging
|
14
|
-
|
15
|
-
def self.collect_and_log!
|
16
|
-
log_once! do
|
17
|
-
data = EnvironmentCollector.collect_config!
|
18
|
-
log_configuration!('PROFILING', data.to_json)
|
19
|
-
end
|
20
|
-
rescue => e
|
21
|
-
logger.warn("Failed to collect profiling environment information: #{e} Location: #{Array(e.backtrace).first}")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Collects environment information for Profiling diagnostic logging
|
26
|
-
module EnvironmentCollector
|
27
|
-
def self.collect_config!(*args)
|
28
|
-
{
|
29
|
-
profiling_enabled: profiling_enabled
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.profiling_enabled
|
34
|
-
!!Datadog.configuration.profiling.enabled
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id.h
RENAMED
File without changes
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/clock_id_noop.c
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/helpers.h
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/stack_recorder.h
RENAMED
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.c
RENAMED
File without changes
|
/data/ext/{ddtrace_profiling_native_extension → datadog_profiling_native_extension}/time_helpers.h
RENAMED
File without changes
|