ddtrace 1.18.0 → 1.20.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 +82 -1
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +96 -66
- data/ext/ddtrace_profiling_native_extension/collectors_discrete_dynamic_sampler.c +349 -0
- data/ext/ddtrace_profiling_native_extension/collectors_discrete_dynamic_sampler.h +89 -0
- data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.c +22 -14
- data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.h +4 -0
- data/ext/ddtrace_profiling_native_extension/collectors_gc_profiling_helper.c +156 -0
- data/ext/ddtrace_profiling_native_extension/collectors_gc_profiling_helper.h +5 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +43 -102
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +10 -3
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +159 -124
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.h +2 -1
- data/ext/ddtrace_profiling_native_extension/extconf.rb +19 -0
- data/ext/ddtrace_profiling_native_extension/heap_recorder.c +970 -0
- data/ext/ddtrace_profiling_native_extension/heap_recorder.h +155 -0
- data/ext/ddtrace_profiling_native_extension/helpers.h +6 -0
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.c +20 -0
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +11 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +5 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +17 -0
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.c +147 -0
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +28 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +329 -10
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +3 -0
- data/ext/ddtrace_profiling_native_extension/time_helpers.h +2 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +2 -1
- data/lib/datadog/core/configuration/settings.rb +153 -21
- data/lib/datadog/core/environment/class_count.rb +6 -6
- data/lib/datadog/core/remote/component.rb +25 -12
- data/lib/datadog/core/remote/ext.rb +1 -0
- data/lib/datadog/core/remote/tie/tracing.rb +39 -0
- data/lib/datadog/core/remote/tie.rb +27 -0
- data/lib/datadog/core/telemetry/collector.rb +10 -0
- data/lib/datadog/core/telemetry/event.rb +2 -1
- data/lib/datadog/core/telemetry/ext.rb +3 -0
- data/lib/datadog/core/telemetry/v1/app_event.rb +8 -1
- data/lib/datadog/core/telemetry/v1/install_signature.rb +38 -0
- data/lib/datadog/opentelemetry/sdk/propagator.rb +3 -2
- data/lib/datadog/opentelemetry.rb +3 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +5 -12
- data/lib/datadog/profiling/component.rb +183 -13
- data/lib/datadog/profiling/scheduler.rb +4 -6
- data/lib/datadog/profiling/stack_recorder.rb +13 -2
- data/lib/datadog/tracing/configuration/ext.rb +0 -1
- data/lib/datadog/tracing/configuration/settings.rb +2 -1
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/action_cable/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/action_mailer/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/action_pack/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/action_view/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/active_job/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/active_record/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/active_support/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/analytics.rb +0 -1
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/aws/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/delayed_job/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/ethon/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/excon/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +7 -0
- data/lib/datadog/tracing/contrib/faraday/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +1 -1
- data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/grape/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/graphql/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/grpc/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +2 -2
- data/lib/datadog/tracing/contrib/http/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/httprb/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/kafka/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +5 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +2 -1
- data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/opensearch/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/pg/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/presto/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/qless/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/que/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/racecar/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/rack/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +9 -2
- data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +0 -2
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/rails/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/rake/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/redis/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +2 -2
- data/lib/datadog/tracing/contrib/redis/patcher.rb +34 -21
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/resque/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/roda/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/sequel/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/shoryuken/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/sneakers/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/stripe/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb +58 -0
- data/lib/datadog/tracing/contrib/trilogy/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +94 -0
- data/lib/datadog/tracing/contrib/trilogy/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/trilogy/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib.rb +1 -0
- data/lib/datadog/tracing.rb +8 -2
- data/lib/ddtrace/version.rb +1 -1
- metadata +20 -6
@@ -24,7 +24,7 @@ module Datadog
|
|
24
24
|
# Do this once to reduce expensive regex calls.
|
25
25
|
request_options = build_request_options!(env)
|
26
26
|
|
27
|
-
Tracing.trace(Ext::SPAN_REQUEST) do |span, trace|
|
27
|
+
Tracing.trace(Ext::SPAN_REQUEST, on_error: request_options[:on_error]) do |span, trace|
|
28
28
|
annotate!(span, env, request_options)
|
29
29
|
propagate!(trace, span, env) if request_options[:distributed_tracing] && Tracing.enabled?
|
30
30
|
app.call(env).on_complete { |resp| handle_response(span, resp, request_options) }
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_GRAPE_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_GRAPE_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_GRAPE_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SPAN_ENDPOINT_RENDER = 'grape.endpoint_render'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_GRAPHQL_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_GRAPHQL_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_GRAPHQL_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SERVICE_NAME = 'graphql'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_GRPC_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_GRPC_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_GRPC_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_GRPC_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_GRPC_ANALYTICS_SAMPLE_RATE'
|
15
16
|
DEFAULT_PEER_SERVICE_NAME = 'grpc'
|
@@ -13,8 +13,8 @@ module Datadog
|
|
13
13
|
#
|
14
14
|
# In case both variants are present, the verbatim match will be used.
|
15
15
|
class Fetcher < Tracing::Distributed::Fetcher
|
16
|
-
#
|
17
|
-
#
|
16
|
+
# @param [String] name the header name
|
17
|
+
# @return [String, nil] the header value or nil if not found
|
18
18
|
def [](name)
|
19
19
|
# Try to fetch with the plain key
|
20
20
|
value = super(name)
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_HTTP_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_NET_HTTP_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_NET_HTTP_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_HTTP_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_HTTP_ANALYTICS_SAMPLE_RATE'
|
15
16
|
ENV_ERROR_STATUS_CODES = 'DD_TRACE_HTTP_ERROR_STATUS_CODES'
|
@@ -11,6 +11,7 @@ module Datadog
|
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_HTTPCLIENT_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_HTTPCLIENT_PEER_SERVICE'
|
13
13
|
|
14
|
+
# @!visibility private
|
14
15
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_HTTPCLIENT_ANALYTICS_ENABLED'
|
15
16
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_HTTPCLIENT_ANALYTICS_SAMPLE_RATE'
|
16
17
|
ENV_ERROR_STATUS_CODES = 'DD_TRACE_HTTPCLIENT_ERROR_STATUS_CODES'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_HTTPRB_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_HTTPRB_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_HTTPRB_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_HTTPRB_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_EHTTPRB_ANALYTICS_SAMPLE_RATE'
|
15
16
|
ENV_ERROR_STATUS_CODES = 'DD_TRACE_HTTPCLIENT_ERROR_STATUS_CODES'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_KAFKA_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_KAFKA_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_KAFKA_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SPAN_CONNECTION_REQUEST = 'kafka.connection.request'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_MONGO_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_MONGO_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_MONGO_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_MONGO_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_MONGO_ANALYTICS_SAMPLE_RATE'
|
15
16
|
DEFAULT_PEER_SERVICE_NAME = 'mongodb'
|
@@ -19,6 +19,7 @@ module Datadog
|
|
19
19
|
o.default true
|
20
20
|
end
|
21
21
|
|
22
|
+
# @!visibility private
|
22
23
|
option :analytics_enabled do |o|
|
23
24
|
o.type :bool
|
24
25
|
o.env Ext::ENV_ANALYTICS_ENABLED
|
@@ -50,6 +51,10 @@ module Datadog
|
|
50
51
|
o.type :string, nilable: true
|
51
52
|
o.env Ext::ENV_PEER_SERVICE
|
52
53
|
end
|
54
|
+
|
55
|
+
option :on_error do |o|
|
56
|
+
o.type :proc, nilable: true
|
57
|
+
end
|
53
58
|
end
|
54
59
|
end
|
55
60
|
end
|
@@ -11,6 +11,7 @@ module Datadog
|
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_MYSQL2_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_MYSQL2_PEER_SERVICE'
|
13
13
|
|
14
|
+
# @!visibility private
|
14
15
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_MYSQL2_ANALYTICS_ENABLED'
|
15
16
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_MYSQL2_ANALYTICS_SAMPLE_RATE'
|
16
17
|
DEFAULT_PEER_SERVICE_NAME = 'mysql2'
|
@@ -21,8 +21,9 @@ module Datadog
|
|
21
21
|
module InstanceMethods
|
22
22
|
def query(sql, options = {})
|
23
23
|
service = Datadog.configuration_for(self, :service_name) || datadog_configuration[:service_name]
|
24
|
+
on_error = Datadog.configuration_for(self, :on_error) || datadog_configuration[:on_error]
|
24
25
|
|
25
|
-
Tracing.trace(Ext::SPAN_QUERY, service: service) do |span, trace_op|
|
26
|
+
Tracing.trace(Ext::SPAN_QUERY, service: service, on_error: on_error) do |span, trace_op|
|
26
27
|
span.resource = sql
|
27
28
|
span.span_type = Tracing::Metadata::Ext::SQL::TYPE
|
28
29
|
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_OPENSEARCH_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_OPENSEARCH_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_OPENSEARCH_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_OPENSEARCH_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_OPENSEARCH_ANALYTICS_SAMPLE_RATE'
|
15
16
|
DEFAULT_PEER_SERVICE_NAME = 'opensearch'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_PG_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_PG_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_PG_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_PG_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_PG_ANALYTICS_SAMPLE_RATE'
|
15
16
|
DEFAULT_PEER_SERVICE_NAME = 'pg'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_PRESTO_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_PRESTO_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_PRESTO_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_PRESTO_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_PRESTO_ANALYTICS_SAMPLE_RATE'
|
15
16
|
DEFAULT_PEER_SERVICE_NAME = 'presto'
|
@@ -7,6 +7,7 @@ module Datadog
|
|
7
7
|
# Qless integration constants
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
|
+
# @!visibility private
|
10
11
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_QLESS_ANALYTICS_ENABLED'
|
11
12
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_QLESS_ANALYTICS_SAMPLE_RATE'
|
12
13
|
ENV_TAG_JOB_DATA = 'DD_QLESS_TAG_JOB_DATA'
|
@@ -7,6 +7,7 @@ module Datadog
|
|
7
7
|
# Que integration constants
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
|
+
# @!visibility private
|
10
11
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_QUE_ANALYTICS_ENABLED'
|
11
12
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_QUE_ANALYTICS_SAMPLE_RATE'
|
12
13
|
ENV_ENABLED = 'DD_TRACE_QUE_ENABLED'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_RACECAR_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_RACECAR_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RACECAR_ANALYTICS_SAMPLE_RATE'
|
13
14
|
DEFAULT_PEER_SERVICE_NAME = 'racecar'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_RACK_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_RACK_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RACK_ANALYTICS_SAMPLE_RATE'
|
13
14
|
RACK_ENV_REQUEST_SPAN = 'datadog.rack_request_span'
|
@@ -2,6 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
require_relative '../../../core/environment/variable_helpers'
|
4
4
|
require_relative '../../../core/backport'
|
5
|
+
require_relative '../../../core/remote/tie/tracing'
|
5
6
|
require_relative '../../client_ip'
|
6
7
|
require_relative '../../metadata/ext'
|
7
8
|
require_relative '../../propagation/http'
|
@@ -71,7 +72,7 @@ module Datadog
|
|
71
72
|
|
72
73
|
return @app.call(env) if previous_request_span
|
73
74
|
|
74
|
-
|
75
|
+
boot = Datadog::Core::Remote::Tie.boot
|
75
76
|
|
76
77
|
# Extract distributed tracing context before creating any spans,
|
77
78
|
# so that all spans will be added to the distributed trace.
|
@@ -91,9 +92,15 @@ module Datadog
|
|
91
92
|
# we must ensure that the span `resource` is set later
|
92
93
|
request_span = Tracing.trace(Ext::SPAN_REQUEST, **trace_options)
|
93
94
|
request_span.resource = nil
|
94
|
-
|
95
|
+
|
96
|
+
# When tracing and distributed tracing are both disabled, `.active_trace` will be `nil`,
|
97
|
+
# Return a null object to continue operation
|
98
|
+
request_trace = Tracing.active_trace || TraceOperation.new
|
99
|
+
|
95
100
|
env[Ext::RACK_ENV_REQUEST_SPAN] = request_span
|
96
101
|
|
102
|
+
Datadog::Core::Remote::Tie::Tracing.tag(boot, request_span)
|
103
|
+
|
97
104
|
# Copy the original env, before the rest of the stack executes.
|
98
105
|
# Values may change; we want values before that happens.
|
99
106
|
original_env = env.dup
|
@@ -9,6 +9,7 @@ module Datadog
|
|
9
9
|
module Ext
|
10
10
|
APP = 'rails'
|
11
11
|
ENV_ENABLED = 'DD_TRACE_RAILS_ENABLED'
|
12
|
+
# @!visibility private
|
12
13
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_RAILS_ANALYTICS_ENABLED'
|
13
14
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RAILS_ANALYTICS_SAMPLE_RATE'
|
14
15
|
ENV_DISABLE = 'DISABLE_DATADOG_RAILS'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_RAKE_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_RAKE_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RAKE_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SERVICE_NAME = 'rake'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_REDIS_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_REDIS_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_REDIS_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_REDIS_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_REDIS_ANALYTICS_SAMPLE_RATE'
|
15
16
|
ENV_COMMAND_ARGS = 'DD_REDIS_COMMAND_ARGS'
|
@@ -28,7 +28,7 @@ module Datadog
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def command_args?
|
31
|
-
pinned = Datadog.configuration_for(
|
31
|
+
pinned = Datadog.configuration_for(self, :command_args)
|
32
32
|
|
33
33
|
return pinned unless pinned.nil?
|
34
34
|
|
@@ -36,7 +36,7 @@ module Datadog
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def service_name
|
39
|
-
Datadog.configuration_for(
|
39
|
+
Datadog.configuration_for(self, :service_name) ||
|
40
40
|
datadog_configuration[:service_name]
|
41
41
|
end
|
42
42
|
|
@@ -10,38 +10,48 @@ module Datadog
|
|
10
10
|
module Patcher
|
11
11
|
include Contrib::Patcher
|
12
12
|
|
13
|
-
# Patch for redis instance
|
14
|
-
module
|
13
|
+
# Patch for redis instance (with redis < 5)
|
14
|
+
module DatadogPinPatch
|
15
15
|
def self.included(base)
|
16
16
|
base.prepend(InstanceMethods)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Instance method patch for redis instance
|
20
20
|
module InstanceMethods
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def datadog_pin=(pin)
|
22
|
+
pin.onto(datadog_target)
|
23
|
+
end
|
24
|
+
|
25
|
+
def datadog_target
|
26
|
+
# For `redis-rb` 4.x
|
27
|
+
return _client if respond_to?(:_client)
|
28
|
+
# For `redis-rb` 3.x
|
29
|
+
return client if respond_to?(:client)
|
30
|
+
|
31
|
+
Datadog.logger.warn 'Fail to apply configuration on redis client instance with ' \
|
32
|
+
'`Datadog.configure_onto(redis)`.'
|
33
|
+
|
34
|
+
# Null object instead of raising error
|
35
|
+
self
|
24
36
|
end
|
25
37
|
end
|
26
38
|
end
|
27
39
|
|
28
|
-
# Patch for redis
|
29
|
-
module
|
40
|
+
# Patch for redis instance (with redis >= 5)
|
41
|
+
module NotSupportedNoticePatch
|
30
42
|
def self.included(base)
|
31
43
|
base.prepend(InstanceMethods)
|
32
44
|
end
|
33
45
|
|
34
|
-
# Instance method patch for redis
|
46
|
+
# Instance method patch for redis instance
|
35
47
|
module InstanceMethods
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
48
|
+
def datadog_pin=(_pin)
|
49
|
+
Datadog.logger.warn \
|
50
|
+
'`Datadog.configure_onto(redis)` is not supported on Redis 5+. To instrument '\
|
51
|
+
"a redis instance with custom configuration, please initialize it with:\n"\
|
52
|
+
" `Redis.new(..., custom: { datadog: { service_name: 'my-service' } })`.\n\n" \
|
53
|
+
'See: https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#redis'
|
40
54
|
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
attr_reader :redis_instance
|
45
55
|
end
|
46
56
|
end
|
47
57
|
|
@@ -62,12 +72,15 @@ module Datadog
|
|
62
72
|
::RedisClient.register(TraceMiddleware)
|
63
73
|
end
|
64
74
|
|
65
|
-
if Integration.redis_compatible?
|
66
|
-
|
75
|
+
if Integration.redis_compatible?
|
76
|
+
if Integration.redis_version < Gem::Version.new('5.0.0')
|
77
|
+
require_relative 'instrumentation'
|
67
78
|
|
68
|
-
|
69
|
-
|
70
|
-
|
79
|
+
::Redis.include(DatadogPinPatch)
|
80
|
+
::Redis::Client.include(Instrumentation)
|
81
|
+
else # warn about non-supported configure_onto usage
|
82
|
+
::Redis.include(NotSupportedNoticePatch)
|
83
|
+
end
|
71
84
|
end
|
72
85
|
end
|
73
86
|
end
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_RESQUE_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_RESQUE_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RESQUE_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SERVICE_NAME = 'resque'
|
@@ -10,6 +10,7 @@ module Datadog
|
|
10
10
|
ENV_ENABLED = 'DD_TRACE_REST_CLIENT_ENABLED'
|
11
11
|
ENV_SERVICE_NAME = 'DD_TRACE_REST_CLIENT_SERVICE_NAME'
|
12
12
|
ENV_PEER_SERVICE = 'DD_TRACE_REST_CLIENT_PEER_SERVICE'
|
13
|
+
# @!visibility private
|
13
14
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_REST_CLIENT_ANALYTICS_ENABLED'
|
14
15
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_REST_CLIENT_ANALYTICS_SAMPLE_RATE'
|
15
16
|
DEFAULT_PEER_SERVICE_NAME = 'rest_client'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_SEQUEL_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SEQUEL_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SEQUEL_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SPAN_QUERY = 'sequel.query'
|
@@ -8,6 +8,7 @@ module Datadog
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
9
9
|
module Ext
|
10
10
|
ENV_ENABLED = 'DD_TRACE_SHORYUKEN_ENABLED'
|
11
|
+
# @!visibility private
|
11
12
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SHORYUKEN_ANALYTICS_ENABLED'
|
12
13
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SHORYUKEN_ANALYTICS_SAMPLE_RATE'
|
13
14
|
SERVICE_NAME = 'shoryuken'
|