ddtrace 1.5.2 → 1.6.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 +44 -1
- data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +9 -2
- data/ext/ddtrace_profiling_loader/extconf.rb +17 -0
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +38 -2
- data/ext/ddtrace_profiling_native_extension/clock_id.h +1 -0
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +1 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c +517 -42
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.h +3 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +208 -30
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +156 -46
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +11 -2
- data/ext/ddtrace_profiling_native_extension/extconf.rb +11 -1
- data/ext/ddtrace_profiling_native_extension/http_transport.c +83 -64
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +4 -4
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +3 -2
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +59 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +3 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +10 -0
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.c +0 -1
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +4 -2
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +45 -29
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +7 -7
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +4 -0
- data/lib/datadog/appsec/event.rb +6 -0
- data/lib/datadog/core/configuration/components.rb +20 -14
- data/lib/datadog/core/configuration/settings.rb +42 -4
- data/lib/datadog/core/diagnostics/environment_logger.rb +5 -1
- data/lib/datadog/core/utils/compression.rb +5 -1
- data/lib/datadog/core.rb +0 -54
- data/lib/datadog/profiling/collectors/cpu_and_wall_time.rb +12 -2
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +5 -3
- data/lib/datadog/profiling/exporter.rb +2 -4
- data/lib/datadog/profiling/http_transport.rb +1 -1
- data/lib/datadog/tracing/configuration/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +4 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +3 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +2 -0
- data/lib/datadog/tracing/contrib/ext.rb +6 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +2 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +5 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +7 -1
- data/lib/datadog/tracing/contrib/grpc/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +47 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +22 -0
- data/lib/datadog/tracing/contrib/hanami/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/hanami/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/hanami/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/hanami/plugin.rb +23 -0
- data/lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb +41 -0
- data/lib/datadog/tracing/contrib/hanami/router_tracing.rb +44 -0
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +7 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +4 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +12 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +16 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +12 -0
- data/lib/datadog/tracing/contrib/pg/ext.rb +2 -1
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +34 -18
- data/lib/datadog/tracing/contrib/propagation/sql_comment/comment.rb +43 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb +28 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +49 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +11 -5
- data/lib/datadog/tracing/contrib/redis/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +4 -2
- data/lib/datadog/tracing/contrib/redis/patcher.rb +41 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +5 -0
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/sinatra/env.rb +12 -23
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +7 -3
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +2 -2
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +8 -80
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +14 -9
- data/lib/datadog/tracing/contrib.rb +1 -0
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +84 -0
- data/lib/datadog/tracing/distributed/headers/datadog.rb +122 -30
- data/lib/datadog/tracing/distributed/headers/ext.rb +2 -0
- data/lib/datadog/tracing/flush.rb +1 -1
- data/lib/datadog/tracing/metadata/ext.rb +8 -0
- data/lib/datadog/tracing/propagation/http.rb +9 -1
- data/lib/datadog/tracing/sampling/ext.rb +31 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +46 -4
- data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +8 -9
- data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +29 -5
- data/lib/datadog/tracing/sampling/rate_sampler.rb +10 -3
- data/lib/datadog/tracing/sampling/rule_sampler.rb +4 -3
- data/lib/datadog/tracing/sampling/span/ext.rb +0 -4
- data/lib/datadog/tracing/sampling/span/rule.rb +1 -1
- data/lib/datadog/tracing/sampling/span/sampler.rb +14 -3
- data/lib/datadog/tracing/trace_digest.rb +3 -0
- data/lib/datadog/tracing/trace_operation.rb +10 -0
- data/lib/datadog/tracing/trace_segment.rb +6 -0
- data/lib/datadog/tracing/tracer.rb +3 -1
- data/lib/datadog/tracing/writer.rb +7 -0
- data/lib/ddtrace/transport/trace_formatter.rb +7 -0
- data/lib/ddtrace/transport/traces.rb +1 -1
- data/lib/ddtrace/version.rb +2 -2
- metadata +18 -14
- data/lib/datadog/profiling/old_ext.rb +0 -42
- data/lib/datadog/profiling/transport/http/api/endpoint.rb +0 -85
- data/lib/datadog/profiling/transport/http/api/instance.rb +0 -38
- data/lib/datadog/profiling/transport/http/api/spec.rb +0 -42
- data/lib/datadog/profiling/transport/http/api.rb +0 -45
- data/lib/datadog/profiling/transport/http/builder.rb +0 -30
- data/lib/datadog/profiling/transport/http/client.rb +0 -37
- data/lib/datadog/profiling/transport/http/response.rb +0 -21
- data/lib/datadog/profiling/transport/http.rb +0 -118
@@ -1,21 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
|
3
|
-
require_relative '../../../../ddtrace/transport/http/response'
|
4
|
-
|
5
|
-
module Datadog
|
6
|
-
module Profiling
|
7
|
-
module Transport
|
8
|
-
# HTTP transport behavior for profiling
|
9
|
-
module HTTP
|
10
|
-
# Response from HTTP transport for profiling
|
11
|
-
class Response
|
12
|
-
include Datadog::Transport::HTTP::Response
|
13
|
-
|
14
|
-
def initialize(http_response, options = {})
|
15
|
-
super(http_response)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,118 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
|
3
|
-
require_relative '../../core/environment/ext'
|
4
|
-
require_relative '../../../ddtrace/transport/ext'
|
5
|
-
|
6
|
-
require_relative '../../core/environment/container'
|
7
|
-
require_relative '../../core/environment/variable_helpers'
|
8
|
-
|
9
|
-
require_relative 'http/builder'
|
10
|
-
require_relative 'http/api'
|
11
|
-
|
12
|
-
require_relative '../../../ddtrace/transport/http/adapters/net'
|
13
|
-
require_relative '../../../ddtrace/transport/http/adapters/test'
|
14
|
-
require_relative '../../../ddtrace/transport/http/adapters/unix_socket'
|
15
|
-
|
16
|
-
module Datadog
|
17
|
-
module Profiling
|
18
|
-
module Transport
|
19
|
-
# Namespace for HTTP transport components
|
20
|
-
module HTTP
|
21
|
-
# Builds a new Transport::HTTP::Client
|
22
|
-
def self.new(&block)
|
23
|
-
Builder.new(&block).to_transport
|
24
|
-
end
|
25
|
-
|
26
|
-
# Builds a new Transport::HTTP::Client with default settings
|
27
|
-
def self.default(
|
28
|
-
profiling_upload_timeout_seconds:,
|
29
|
-
agent_settings:,
|
30
|
-
site: nil,
|
31
|
-
api_key: nil,
|
32
|
-
agentless_allowed: agentless_allowed?
|
33
|
-
)
|
34
|
-
new do |transport|
|
35
|
-
transport.headers default_headers
|
36
|
-
|
37
|
-
# Configure adapter & API
|
38
|
-
if site && api_key && agentless_allowed
|
39
|
-
configure_for_agentless(
|
40
|
-
transport,
|
41
|
-
profiling_upload_timeout_seconds: profiling_upload_timeout_seconds,
|
42
|
-
site: site,
|
43
|
-
api_key: api_key
|
44
|
-
)
|
45
|
-
else
|
46
|
-
configure_for_agent(
|
47
|
-
transport,
|
48
|
-
profiling_upload_timeout_seconds: profiling_upload_timeout_seconds,
|
49
|
-
agent_settings: agent_settings
|
50
|
-
)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.default_headers
|
56
|
-
{
|
57
|
-
Datadog::Transport::Ext::HTTP::HEADER_META_LANG => Core::Environment::Ext::LANG,
|
58
|
-
Datadog::Transport::Ext::HTTP::HEADER_META_LANG_VERSION => Core::Environment::Ext::LANG_VERSION,
|
59
|
-
Datadog::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER => Core::Environment::Ext::LANG_INTERPRETER,
|
60
|
-
Datadog::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION => Core::Environment::Ext::TRACER_VERSION
|
61
|
-
}.tap do |headers|
|
62
|
-
# Add container ID, if present.
|
63
|
-
container_id = Core::Environment::Container.container_id
|
64
|
-
headers[Datadog::Transport::Ext::HTTP::HEADER_CONTAINER_ID] = container_id unless container_id.nil?
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
private_class_method def self.configure_for_agent(transport, profiling_upload_timeout_seconds:, agent_settings:)
|
69
|
-
apis = API.agent_defaults
|
70
|
-
|
71
|
-
transport.adapter(agent_settings.merge(timeout_seconds: profiling_upload_timeout_seconds))
|
72
|
-
transport.api(API::V1, apis[API::V1], default: true)
|
73
|
-
|
74
|
-
# NOTE: This proc, when it exists, usually overrides the transport specified above
|
75
|
-
if agent_settings.deprecated_for_removal_transport_configuration_proc
|
76
|
-
agent_settings.deprecated_for_removal_transport_configuration_proc.call(transport)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
private_class_method def self.configure_for_agentless(transport, profiling_upload_timeout_seconds:, site:, api_key:)
|
81
|
-
apis = API.api_defaults
|
82
|
-
|
83
|
-
site_uri = URI(format(Profiling::OldExt::Transport::HTTP::URI_TEMPLATE_DD_API, site))
|
84
|
-
hostname = site_uri.host
|
85
|
-
port = site_uri.port
|
86
|
-
|
87
|
-
transport.adapter(
|
88
|
-
Datadog::Transport::Ext::HTTP::ADAPTER,
|
89
|
-
hostname,
|
90
|
-
port,
|
91
|
-
timeout: profiling_upload_timeout_seconds,
|
92
|
-
ssl: site_uri.scheme == 'https'
|
93
|
-
)
|
94
|
-
transport.api(API::V1, apis[API::V1], default: true)
|
95
|
-
transport.headers(Datadog::Transport::Ext::HTTP::HEADER_DD_API_KEY => api_key)
|
96
|
-
end
|
97
|
-
|
98
|
-
private_class_method def self.agentless_allowed?
|
99
|
-
Core::Environment::VariableHelpers.env_to_bool(Profiling::Ext::ENV_AGENTLESS, false)
|
100
|
-
end
|
101
|
-
|
102
|
-
# Add adapters to registry
|
103
|
-
Datadog::Transport::HTTP::Builder::REGISTRY.set(
|
104
|
-
Datadog::Transport::HTTP::Adapters::Net,
|
105
|
-
Datadog::Transport::Ext::HTTP::ADAPTER
|
106
|
-
)
|
107
|
-
Datadog::Transport::HTTP::Builder::REGISTRY.set(
|
108
|
-
Datadog::Transport::HTTP::Adapters::Test,
|
109
|
-
Datadog::Transport::Ext::Test::ADAPTER
|
110
|
-
)
|
111
|
-
Datadog::Transport::HTTP::Builder::REGISTRY.set(
|
112
|
-
Datadog::Transport::HTTP::Adapters::UnixSocket,
|
113
|
-
Datadog::Transport::Ext::UnixSocket::ADAPTER
|
114
|
-
)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|