ddtrace 1.13.1 → 1.15.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 +207 -2
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +3 -5
- data/ext/ddtrace_profiling_native_extension/clock_id.h +0 -3
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +0 -22
- data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +0 -1
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +41 -6
- data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.c +3 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +76 -24
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +1 -1
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +207 -32
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.h +1 -1
- data/ext/ddtrace_profiling_native_extension/extconf.rb +8 -2
- data/ext/ddtrace_profiling_native_extension/http_transport.c +26 -10
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.c +42 -0
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +6 -0
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +1 -1
- data/ext/ddtrace_profiling_native_extension/pid_controller.c +57 -0
- data/ext/ddtrace_profiling_native_extension/pid_controller.h +45 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +17 -12
- data/ext/ddtrace_profiling_native_extension/profiling.c +0 -2
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +74 -37
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +13 -3
- data/lib/datadog/appsec/assets/waf_rules/processors.json +92 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +698 -75
- data/lib/datadog/appsec/assets/waf_rules/scanners.json +114 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +98 -8
- data/lib/datadog/appsec/assets.rb +8 -0
- data/lib/datadog/appsec/component.rb +9 -2
- data/lib/datadog/appsec/configuration/settings.rb +68 -3
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +8 -6
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +2 -7
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +2 -5
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +2 -5
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +3 -2
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +23 -9
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +3 -2
- data/lib/datadog/appsec/contrib/rails/patcher.rb +9 -3
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +2 -5
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +6 -4
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +13 -7
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +2 -5
- data/lib/datadog/appsec/event.rb +106 -50
- data/lib/datadog/appsec/monitor/gateway/watcher.rb +3 -3
- data/lib/datadog/appsec/monitor/reactive/set_user.rb +2 -5
- data/lib/datadog/appsec/processor/actions.rb +49 -0
- data/lib/datadog/appsec/processor/rule_merger.rb +22 -2
- data/lib/datadog/appsec/processor.rb +34 -6
- data/lib/datadog/appsec/remote.rb +4 -1
- data/lib/datadog/appsec/response.rb +82 -4
- data/lib/datadog/appsec/sample_rate.rb +21 -0
- data/lib/datadog/appsec.rb +2 -2
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +29 -24
- data/lib/datadog/core/configuration/base.rb +1 -11
- data/lib/datadog/core/configuration/components.rb +9 -2
- data/lib/datadog/core/configuration/ext.rb +21 -0
- data/lib/datadog/core/configuration/option.rb +2 -4
- data/lib/datadog/core/configuration/option_definition.rb +17 -41
- data/lib/datadog/core/configuration/options.rb +5 -5
- data/lib/datadog/core/configuration/settings.rb +47 -45
- data/lib/datadog/core/diagnostics/environment_logger.rb +130 -234
- data/lib/datadog/core/environment/execution.rb +50 -2
- data/lib/datadog/core/environment/variable_helpers.rb +0 -69
- data/lib/datadog/core/error.rb +1 -0
- data/lib/datadog/core/git/ext.rb +2 -0
- data/lib/datadog/core/remote/client/capabilities.rb +1 -1
- data/lib/datadog/core/remote/component.rb +2 -2
- data/lib/datadog/core/remote/negotiation.rb +2 -2
- data/lib/datadog/core/remote/transport/config.rb +60 -0
- data/lib/datadog/core/remote/transport/http/api/instance.rb +39 -0
- data/lib/datadog/core/remote/transport/http/api/spec.rb +21 -0
- data/lib/datadog/core/remote/transport/http/api.rb +58 -0
- data/lib/datadog/core/remote/transport/http/builder.rb +219 -0
- data/lib/datadog/core/remote/transport/http/client.rb +48 -0
- data/lib/datadog/core/remote/transport/http/config.rb +280 -0
- data/lib/datadog/core/remote/transport/http/negotiation.rb +146 -0
- data/lib/datadog/core/remote/transport/http.rb +179 -0
- data/lib/datadog/core/{transport → remote/transport}/negotiation.rb +25 -23
- data/lib/datadog/core/telemetry/collector.rb +13 -4
- data/lib/datadog/core/telemetry/http/transport.rb +2 -1
- data/lib/datadog/core/transport/ext.rb +47 -0
- data/lib/datadog/core/transport/http/adapters/net.rb +168 -0
- data/lib/datadog/core/transport/http/adapters/registry.rb +29 -0
- data/lib/datadog/core/transport/http/adapters/test.rb +89 -0
- data/lib/datadog/core/transport/http/adapters/unix_socket.rb +83 -0
- data/lib/datadog/core/transport/http/api/endpoint.rb +31 -0
- data/lib/datadog/core/transport/http/api/fallbacks.rb +26 -0
- data/lib/datadog/core/transport/http/api/map.rb +18 -0
- data/lib/datadog/core/transport/http/env.rb +62 -0
- data/lib/datadog/core/transport/http/response.rb +60 -0
- data/lib/datadog/core/transport/parcel.rb +22 -0
- data/lib/datadog/core/transport/request.rb +17 -0
- data/lib/datadog/core/transport/response.rb +64 -0
- data/lib/datadog/core/workers/polling.rb +2 -2
- data/lib/datadog/opentelemetry/api/context.rb +10 -3
- data/lib/datadog/opentelemetry/sdk/propagator.rb +2 -1
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +14 -2
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +68 -0
- data/lib/datadog/opentelemetry/trace.rb +58 -0
- data/lib/datadog/opentelemetry.rb +1 -0
- data/lib/datadog/opentracer.rb +9 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +12 -18
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -1
- data/lib/datadog/profiling/collectors/thread_context.rb +9 -1
- data/lib/datadog/profiling/component.rb +34 -99
- data/lib/datadog/profiling/diagnostics/environment_logger.rb +39 -0
- data/lib/datadog/profiling/exporter.rb +4 -4
- data/lib/datadog/profiling/ext.rb +0 -12
- data/lib/datadog/profiling/flush.rb +2 -7
- data/lib/datadog/profiling/http_transport.rb +6 -3
- data/lib/datadog/profiling/native_extension.rb +0 -21
- data/lib/datadog/profiling/profiler.rb +11 -12
- data/lib/datadog/profiling.rb +9 -81
- data/lib/datadog/tracing/component.rb +12 -5
- data/lib/datadog/tracing/configuration/agent_settings_resolver.rb +13 -0
- data/lib/datadog/tracing/configuration/ext.rb +4 -2
- data/lib/datadog/tracing/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +18 -11
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +4 -0
- data/lib/datadog/tracing/contrib/active_record/utils.rb +1 -1
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +104 -197
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +3 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +7 -0
- data/lib/datadog/tracing/contrib/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +6 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +7 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +9 -2
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +104 -102
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +5 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +8 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +5 -0
- data/lib/datadog/tracing/contrib/ext.rb +3 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +5 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +21 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +11 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +18 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +0 -4
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +3 -3
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +1 -17
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +7 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +13 -3
- data/lib/datadog/tracing/contrib/opensearch/integration.rb +2 -2
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +7 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +1 -1
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/event.rb +5 -0
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +14 -4
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +4 -4
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/tags.rb +5 -0
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +5 -0
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +3 -20
- data/lib/datadog/tracing/contrib/sequel/utils.rb +5 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +11 -11
- data/lib/datadog/tracing/correlation.rb +20 -0
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +159 -0
- data/lib/datadog/tracing/distributed/propagation.rb +13 -33
- data/lib/datadog/tracing/metadata/tagging.rb +3 -3
- data/lib/datadog/tracing/sync_writer.rb +3 -3
- data/lib/datadog/tracing/tracer.rb +2 -0
- data/lib/datadog/{core → tracing}/transport/http/api/instance.rb +1 -1
- data/lib/datadog/{core → tracing}/transport/http/api/spec.rb +1 -1
- data/lib/datadog/tracing/transport/http/api.rb +43 -0
- data/lib/datadog/{core → tracing}/transport/http/builder.rb +13 -68
- data/lib/datadog/tracing/transport/http/client.rb +57 -0
- data/lib/datadog/tracing/transport/http/statistics.rb +47 -0
- data/lib/datadog/tracing/transport/http/traces.rb +152 -0
- data/lib/datadog/tracing/transport/http.rb +124 -0
- data/lib/datadog/tracing/transport/io/client.rb +89 -0
- data/lib/datadog/tracing/transport/io/response.rb +27 -0
- data/lib/datadog/tracing/transport/io/traces.rb +101 -0
- data/lib/datadog/tracing/transport/io.rb +30 -0
- data/lib/datadog/tracing/transport/serializable_trace.rb +126 -0
- data/lib/datadog/tracing/transport/statistics.rb +77 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +209 -0
- data/lib/datadog/tracing/transport/traces.rb +224 -0
- data/lib/datadog/tracing/workers/trace_writer.rb +6 -4
- data/lib/datadog/tracing/workers.rb +3 -2
- data/lib/datadog/tracing/writer.rb +5 -2
- data/lib/ddtrace/transport/ext.rb +17 -15
- data/lib/ddtrace/version.rb +2 -2
- data/lib/ddtrace.rb +1 -1
- metadata +74 -96
- data/lib/datadog/ci/configuration/components.rb +0 -32
- data/lib/datadog/ci/configuration/settings.rb +0 -51
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/cucumber/ext.rb +0 -22
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +0 -94
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +0 -28
- data/lib/datadog/ci/contrib/cucumber/integration.rb +0 -47
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +0 -27
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/minitest/ext.rb +0 -21
- data/lib/datadog/ci/contrib/minitest/integration.rb +0 -49
- data/lib/datadog/ci/contrib/minitest/patcher.rb +0 -27
- data/lib/datadog/ci/contrib/minitest/test_helper.rb +0 -68
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/rspec/example.rb +0 -68
- data/lib/datadog/ci/contrib/rspec/ext.rb +0 -21
- data/lib/datadog/ci/contrib/rspec/integration.rb +0 -48
- data/lib/datadog/ci/contrib/rspec/patcher.rb +0 -27
- data/lib/datadog/ci/ext/app_types.rb +0 -9
- data/lib/datadog/ci/ext/environment.rb +0 -575
- data/lib/datadog/ci/ext/settings.rb +0 -10
- data/lib/datadog/ci/ext/test.rb +0 -35
- data/lib/datadog/ci/extensions.rb +0 -19
- data/lib/datadog/ci/flush.rb +0 -38
- data/lib/datadog/ci/test.rb +0 -81
- data/lib/datadog/ci.rb +0 -21
- data/lib/datadog/core/configuration/dependency_resolver.rb +0 -28
- data/lib/datadog/core/configuration/option_definition_set.rb +0 -22
- data/lib/datadog/core/configuration/option_set.rb +0 -10
- data/lib/datadog/core/transport/config.rb +0 -58
- data/lib/datadog/core/transport/http/api.rb +0 -57
- data/lib/datadog/core/transport/http/client.rb +0 -45
- data/lib/datadog/core/transport/http/config.rb +0 -278
- data/lib/datadog/core/transport/http/negotiation.rb +0 -144
- data/lib/datadog/core/transport/http.rb +0 -169
- data/lib/datadog/core/utils/object_set.rb +0 -43
- data/lib/datadog/core/utils/string_table.rb +0 -47
- data/lib/datadog/profiling/backtrace_location.rb +0 -34
- data/lib/datadog/profiling/buffer.rb +0 -43
- data/lib/datadog/profiling/collectors/old_stack.rb +0 -301
- data/lib/datadog/profiling/encoding/profile.rb +0 -41
- data/lib/datadog/profiling/event.rb +0 -15
- data/lib/datadog/profiling/events/stack.rb +0 -82
- data/lib/datadog/profiling/old_recorder.rb +0 -107
- data/lib/datadog/profiling/pprof/builder.rb +0 -125
- data/lib/datadog/profiling/pprof/converter.rb +0 -102
- data/lib/datadog/profiling/pprof/message_set.rb +0 -16
- data/lib/datadog/profiling/pprof/payload.rb +0 -20
- data/lib/datadog/profiling/pprof/pprof.proto +0 -212
- data/lib/datadog/profiling/pprof/pprof_pb.rb +0 -81
- data/lib/datadog/profiling/pprof/stack_sample.rb +0 -139
- data/lib/datadog/profiling/pprof/string_table.rb +0 -12
- data/lib/datadog/profiling/pprof/template.rb +0 -118
- data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +0 -43
- data/lib/datadog/profiling/trace_identifiers/helper.rb +0 -45
- data/lib/ddtrace/transport/http/adapters/net.rb +0 -168
- data/lib/ddtrace/transport/http/adapters/registry.rb +0 -27
- data/lib/ddtrace/transport/http/adapters/test.rb +0 -85
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +0 -77
- data/lib/ddtrace/transport/http/api/endpoint.rb +0 -29
- data/lib/ddtrace/transport/http/api/fallbacks.rb +0 -24
- data/lib/ddtrace/transport/http/api/instance.rb +0 -35
- data/lib/ddtrace/transport/http/api/map.rb +0 -16
- data/lib/ddtrace/transport/http/api/spec.rb +0 -17
- data/lib/ddtrace/transport/http/api.rb +0 -39
- data/lib/ddtrace/transport/http/builder.rb +0 -176
- data/lib/ddtrace/transport/http/client.rb +0 -52
- data/lib/ddtrace/transport/http/env.rb +0 -58
- data/lib/ddtrace/transport/http/response.rb +0 -58
- data/lib/ddtrace/transport/http/statistics.rb +0 -43
- data/lib/ddtrace/transport/http/traces.rb +0 -144
- data/lib/ddtrace/transport/http.rb +0 -117
- data/lib/ddtrace/transport/io/client.rb +0 -85
- data/lib/ddtrace/transport/io/response.rb +0 -25
- data/lib/ddtrace/transport/io/traces.rb +0 -99
- data/lib/ddtrace/transport/io.rb +0 -28
- data/lib/ddtrace/transport/parcel.rb +0 -20
- data/lib/ddtrace/transport/request.rb +0 -15
- data/lib/ddtrace/transport/response.rb +0 -60
- data/lib/ddtrace/transport/serializable_trace.rb +0 -122
- data/lib/ddtrace/transport/statistics.rb +0 -75
- data/lib/ddtrace/transport/trace_formatter.rb +0 -207
- data/lib/ddtrace/transport/traces.rb +0 -216
@@ -23,14 +23,14 @@ module Datadog
|
|
23
23
|
:time_provider,
|
24
24
|
:last_flush_finish_at,
|
25
25
|
:created_at,
|
26
|
-
:
|
26
|
+
:internal_metadata
|
27
27
|
|
28
28
|
public
|
29
29
|
|
30
30
|
def initialize(
|
31
31
|
pprof_recorder:,
|
32
32
|
code_provenance_collector:,
|
33
|
-
|
33
|
+
internal_metadata:,
|
34
34
|
minimum_duration_seconds: PROFILE_DURATION_THRESHOLD_SECONDS,
|
35
35
|
time_provider: Time
|
36
36
|
)
|
@@ -40,7 +40,7 @@ module Datadog
|
|
40
40
|
@time_provider = time_provider
|
41
41
|
@last_flush_finish_at = nil
|
42
42
|
@created_at = time_provider.now.utc
|
43
|
-
@
|
43
|
+
@internal_metadata = internal_metadata
|
44
44
|
end
|
45
45
|
|
46
46
|
def flush
|
@@ -64,7 +64,7 @@ module Datadog
|
|
64
64
|
code_provenance_file_name: Datadog::Profiling::Ext::Transport::HTTP::CODE_PROVENANCE_FILENAME,
|
65
65
|
code_provenance_data: uncompressed_code_provenance,
|
66
66
|
tags_as_array: Datadog::Profiling::TagBuilder.call(settings: Datadog.configuration).to_a,
|
67
|
-
|
67
|
+
internal_metadata: internal_metadata,
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
@@ -9,18 +9,6 @@ module Datadog
|
|
9
9
|
ENV_AGENTLESS = 'DD_PROFILING_AGENTLESS'
|
10
10
|
ENV_ENDPOINT_COLLECTION_ENABLED = 'DD_PROFILING_ENDPOINT_COLLECTION_ENABLED'
|
11
11
|
|
12
|
-
# TODO: Consider removing this once the Ruby-based pprof encoding is removed and replaced by libdatadog
|
13
|
-
module Pprof
|
14
|
-
LABEL_KEY_LOCAL_ROOT_SPAN_ID = 'local root span id'
|
15
|
-
LABEL_KEY_SPAN_ID = 'span id'
|
16
|
-
LABEL_KEY_THREAD_ID = 'thread id'
|
17
|
-
LABEL_KEY_TRACE_ENDPOINT = 'trace endpoint'
|
18
|
-
SAMPLE_VALUE_NO_VALUE = 0
|
19
|
-
VALUE_TYPE_CPU = 'cpu-time'
|
20
|
-
VALUE_TYPE_WALL = 'wall-time'
|
21
|
-
VALUE_UNIT_NANOSECONDS = 'nanoseconds'
|
22
|
-
end
|
23
|
-
|
24
12
|
module Transport
|
25
13
|
module HTTP
|
26
14
|
FORM_FIELD_TAG_ENV = 'env'
|
@@ -4,9 +4,6 @@ require 'json'
|
|
4
4
|
|
5
5
|
module Datadog
|
6
6
|
module Profiling
|
7
|
-
# Represents a collection of events of a specific type being flushed.
|
8
|
-
EventGroup = Struct.new(:event_class, :events)
|
9
|
-
|
10
7
|
# Entity class used to represent metadata for a given profile
|
11
8
|
class Flush
|
12
9
|
attr_reader \
|
@@ -27,7 +24,7 @@ module Datadog
|
|
27
24
|
code_provenance_file_name:,
|
28
25
|
code_provenance_data:,
|
29
26
|
tags_as_array:,
|
30
|
-
|
27
|
+
internal_metadata:
|
31
28
|
)
|
32
29
|
@start = start
|
33
30
|
@finish = finish
|
@@ -36,9 +33,7 @@ module Datadog
|
|
36
33
|
@code_provenance_file_name = code_provenance_file_name
|
37
34
|
@code_provenance_data = code_provenance_data
|
38
35
|
@tags_as_array = tags_as_array
|
39
|
-
@internal_metadata_json = JSON.fast_generate(
|
40
|
-
no_signals_workaround_enabled: (!!no_signals_workaround_enabled).to_s,
|
41
|
-
)
|
36
|
+
@internal_metadata_json = JSON.fast_generate(internal_metadata.map { |k, v| [k, v.to_s] }.to_h)
|
42
37
|
end
|
43
38
|
end
|
44
39
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative '../core/transport/ext'
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Profiling
|
3
5
|
# Used to report profiling data to Datadog.
|
@@ -70,9 +72,9 @@ module Datadog
|
|
70
72
|
|
71
73
|
def base_url_from(agent_settings)
|
72
74
|
case agent_settings.adapter
|
73
|
-
when Datadog::Transport::Ext::HTTP::ADAPTER
|
75
|
+
when Datadog::Core::Transport::Ext::HTTP::ADAPTER
|
74
76
|
"#{agent_settings.ssl ? 'https' : 'http'}://#{agent_settings.hostname}:#{agent_settings.port}/"
|
75
|
-
when Datadog::Transport::Ext::UnixSocket::ADAPTER
|
77
|
+
when Datadog::Core::Transport::Ext::UnixSocket::ADAPTER
|
76
78
|
"unix://#{agent_settings.uds_path}"
|
77
79
|
else
|
78
80
|
raise ArgumentError, "Unexpected adapter: #{agent_settings.adapter}"
|
@@ -80,7 +82,8 @@ module Datadog
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def validate_agent_settings(agent_settings)
|
83
|
-
supported_adapters = [Datadog::Transport::Ext::HTTP::ADAPTER,
|
85
|
+
supported_adapters = [Datadog::Core::Transport::Ext::HTTP::ADAPTER,
|
86
|
+
Datadog::Core::Transport::Ext::UnixSocket::ADAPTER]
|
84
87
|
unless supported_adapters.include?(agent_settings.adapter)
|
85
88
|
raise ArgumentError,
|
86
89
|
"Unsupported transport configuration for profiling: Adapter #{agent_settings.adapter} " \
|
@@ -15,27 +15,6 @@ module Datadog
|
|
15
15
|
false
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
19
|
-
unless singleton_class.method_defined?(:clock_id_for)
|
20
|
-
def self.clock_id_for(_)
|
21
|
-
nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.cpu_time_ns_for(thread)
|
26
|
-
clock_id =
|
27
|
-
begin
|
28
|
-
clock_id_for(thread)
|
29
|
-
rescue Errno::ESRCH
|
30
|
-
nil
|
31
|
-
end
|
32
|
-
|
33
|
-
begin
|
34
|
-
::Process.clock_gettime(clock_id, :nanosecond) if clock_id
|
35
|
-
rescue Errno::EINVAL
|
36
|
-
nil
|
37
|
-
end
|
38
|
-
end
|
39
18
|
end
|
40
19
|
end
|
41
20
|
end
|
@@ -1,35 +1,34 @@
|
|
1
1
|
module Datadog
|
2
2
|
module Profiling
|
3
|
-
# Profiling entry point, which coordinates
|
3
|
+
# Profiling entry point, which coordinates the worker and scheduler threads
|
4
4
|
class Profiler
|
5
5
|
include Datadog::Core::Utils::Forking
|
6
6
|
|
7
|
-
|
8
|
-
:collectors,
|
9
|
-
:scheduler
|
7
|
+
private
|
10
8
|
|
11
|
-
|
12
|
-
|
9
|
+
attr_reader :worker, :scheduler
|
10
|
+
|
11
|
+
public
|
12
|
+
|
13
|
+
def initialize(worker:, scheduler:)
|
14
|
+
@worker = worker
|
13
15
|
@scheduler = scheduler
|
14
16
|
end
|
15
17
|
|
16
18
|
def start
|
17
19
|
after_fork! do
|
18
|
-
|
20
|
+
worker.reset_after_fork
|
19
21
|
scheduler.reset_after_fork
|
20
22
|
end
|
21
23
|
|
22
|
-
|
24
|
+
worker.start
|
23
25
|
scheduler.start
|
24
26
|
end
|
25
27
|
|
26
28
|
def shutdown!
|
27
29
|
Datadog.logger.debug('Shutting down profiler')
|
28
30
|
|
29
|
-
|
30
|
-
collector.enabled = false
|
31
|
-
collector.stop(true)
|
32
|
-
end
|
31
|
+
worker.stop
|
33
32
|
|
34
33
|
scheduler.enabled = false
|
35
34
|
scheduler.stop(true)
|
data/lib/datadog/profiling.rb
CHANGED
@@ -5,22 +5,15 @@ require_relative 'core/utils/only_once'
|
|
5
5
|
module Datadog
|
6
6
|
# Datadog Continuous Profiler implementation: https://docs.datadoghq.com/profiler/
|
7
7
|
module Profiling
|
8
|
-
GOOGLE_PROTOBUF_MINIMUM_VERSION = Gem::Version.new('3.0')
|
9
|
-
private_constant :GOOGLE_PROTOBUF_MINIMUM_VERSION
|
10
|
-
|
11
8
|
def self.supported?
|
12
9
|
unsupported_reason.nil?
|
13
10
|
end
|
14
11
|
|
15
12
|
def self.unsupported_reason
|
16
13
|
# NOTE: Only the first matching reason is returned, so try to keep a nice order on reasons -- e.g. tell users
|
17
|
-
# first that they can't use this on JRuby before telling them that
|
14
|
+
# first that they can't use this on JRuby before telling them that something else failed
|
18
15
|
|
19
|
-
native_library_compilation_skipped? ||
|
20
|
-
native_library_failed_to_load? ||
|
21
|
-
protobuf_gem_unavailable? ||
|
22
|
-
protobuf_version_unsupported? ||
|
23
|
-
protobuf_failed_to_load?
|
16
|
+
native_library_compilation_skipped? || native_library_failed_to_load?
|
24
17
|
end
|
25
18
|
|
26
19
|
# Starts the profiler, if the profiler is supported by in
|
@@ -53,9 +46,7 @@ module Datadog
|
|
53
46
|
#
|
54
47
|
# Note 2: All fibers in the same thread will share the same counter values.
|
55
48
|
#
|
56
|
-
# Only available when the profiler is running,
|
57
|
-
# features are not disabled via configuration.
|
58
|
-
# For instructions on enabling CPU Profiling 2.0 see the ddtrace release notes.
|
49
|
+
# Only available when the profiler is running, and allocation-related features are not disabled via configuration.
|
59
50
|
#
|
60
51
|
# @return [Integer] number of allocations observed in the current thread.
|
61
52
|
# @return [nil] when not available.
|
@@ -68,11 +59,12 @@ module Datadog
|
|
68
59
|
|
69
60
|
def self.enabled?
|
70
61
|
profiler = Datadog.send(:components).profiler
|
71
|
-
|
62
|
+
# Use .send(...) to avoid exposing the attr_reader as an API to the outside
|
63
|
+
!!(profiler.send(:scheduler).running? if profiler)
|
72
64
|
end
|
73
65
|
|
74
66
|
private_class_method def self.replace_noop_allocation_count
|
75
|
-
def self.allocation_count # rubocop:disable Lint/
|
67
|
+
def self.allocation_count # rubocop:disable Lint/NestedMethodDefinition (On purpose!)
|
76
68
|
Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_allocation_count
|
77
69
|
end
|
78
70
|
end
|
@@ -97,66 +89,6 @@ module Datadog
|
|
97
89
|
end
|
98
90
|
end
|
99
91
|
|
100
|
-
private_class_method def self.protobuf_gem_unavailable?
|
101
|
-
# NOTE: On environments where protobuf is already loaded, we skip the check. This allows us to support environments
|
102
|
-
# where no Gem.loaded_version is NOT available but customers are able to load protobuf; see for instance
|
103
|
-
# https://github.com/teamcapybara/capybara/commit/caf3bcd7664f4f2691d0ca9ef3be9a2a954fecfb
|
104
|
-
if !protobuf_already_loaded? && Gem.loaded_specs['google-protobuf'].nil?
|
105
|
-
"Missing google-protobuf dependency; please add `gem 'google-protobuf', '~> 3.0'` to your Gemfile or gems.rb file"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
private_class_method def self.protobuf_version_unsupported?
|
110
|
-
# See above for why we skip the check when protobuf is already loaded; note that when protobuf was already loaded
|
111
|
-
# we skip the version check to avoid the call to Gem.loaded_specs. Unfortunately, protobuf does not seem to
|
112
|
-
# expose the gem version constant elsewhere, so in that setup we are not able to check the version.
|
113
|
-
if !protobuf_already_loaded? && Gem.loaded_specs['google-protobuf'].version < GOOGLE_PROTOBUF_MINIMUM_VERSION
|
114
|
-
'Your google-protobuf is too old; ensure that you have google-protobuf >= 3.0 by ' \
|
115
|
-
"adding `gem 'google-protobuf', '~> 3.0'` to your Gemfile or gems.rb file"
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
private_class_method def self.protobuf_already_loaded?
|
120
|
-
defined?(::Google::Protobuf) && !defined?(::Protobuf)
|
121
|
-
!!(defined?(::Google::Protobuf) && !defined?(::Protobuf))
|
122
|
-
end
|
123
|
-
|
124
|
-
private_class_method def self.protobuf_failed_to_load?
|
125
|
-
unless protobuf_loaded_successfully?
|
126
|
-
'There was an error loading the google-protobuf library; see previous warning message for details'
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# The `google-protobuf` gem depends on a native component, and its creators helpfully tried to provide precompiled
|
131
|
-
# versions of this extension on rubygems.org.
|
132
|
-
#
|
133
|
-
# Unfortunately, for a long time, the supported Ruby versions metadata on these precompiled versions of the extension
|
134
|
-
# was not correctly set. (This is fixed in newer versions -- but not all Ruby versions we want to support can use
|
135
|
-
# these.)
|
136
|
-
#
|
137
|
-
# Thus, the gem can still be installed, but can be in a broken state. To avoid breaking customer applications, we
|
138
|
-
# use this helper to load it and gracefully handle failures.
|
139
|
-
private_class_method def self.protobuf_loaded_successfully?
|
140
|
-
return @protobuf_loaded if defined?(@protobuf_loaded)
|
141
|
-
|
142
|
-
begin
|
143
|
-
require 'google/protobuf'
|
144
|
-
@protobuf_loaded = true
|
145
|
-
rescue LoadError => e
|
146
|
-
# NOTE: We use Kernel#warn here because this code gets run BEFORE Datadog.logger is actually set up.
|
147
|
-
# In the future it'd be nice to shuffle the logger startup to happen first to avoid this special case.
|
148
|
-
Kernel.warn(
|
149
|
-
'[ddtrace] Error while loading google-protobuf gem. ' \
|
150
|
-
"Cause: '#{e.class.name} #{e.message}' Location: '#{Array(e.backtrace).first}'. " \
|
151
|
-
'This can happen when google-protobuf is missing its native components. ' \
|
152
|
-
'To fix this, try removing and reinstalling the gem, forcing it to recompile the components: ' \
|
153
|
-
'`gem uninstall google-protobuf -a; BUNDLE_FORCE_RUBY_PLATFORM=true bundle install`. ' \
|
154
|
-
'If the error persists, please contact Datadog support at <https://docs.datadoghq.com/help/>.'
|
155
|
-
)
|
156
|
-
@protobuf_loaded = false
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
92
|
private_class_method def self.native_library_failed_to_load?
|
161
93
|
success, exception = try_loading_native_library
|
162
94
|
|
@@ -184,7 +116,7 @@ module Datadog
|
|
184
116
|
end
|
185
117
|
|
186
118
|
# All requires for the profiler should be directly added here; and everything should be loaded eagerly.
|
187
|
-
# (Currently there's a
|
119
|
+
# (Currently there's a leftovers that need to be cleaned up, but we should avoid other exceptions.)
|
188
120
|
#
|
189
121
|
# All of the profiler should be loaded and ready to go when this method returns `true`.
|
190
122
|
private_class_method def self.load_profiling
|
@@ -195,20 +127,16 @@ module Datadog
|
|
195
127
|
require_relative 'profiling/collectors/cpu_and_wall_time_worker'
|
196
128
|
require_relative 'profiling/collectors/dynamic_sampling_rate'
|
197
129
|
require_relative 'profiling/collectors/idle_sampling_helper'
|
198
|
-
require_relative 'profiling/collectors/old_stack'
|
199
130
|
require_relative 'profiling/collectors/stack'
|
200
131
|
require_relative 'profiling/collectors/thread_context'
|
132
|
+
require_relative 'profiling/diagnostics/environment_logger'
|
201
133
|
require_relative 'profiling/stack_recorder'
|
202
|
-
require_relative 'profiling/old_recorder'
|
203
134
|
require_relative 'profiling/exporter'
|
135
|
+
require_relative 'profiling/flush'
|
204
136
|
require_relative 'profiling/scheduler'
|
205
137
|
require_relative 'profiling/tasks/setup'
|
206
138
|
require_relative 'profiling/profiler'
|
207
139
|
require_relative 'profiling/native_extension'
|
208
|
-
require_relative 'profiling/trace_identifiers/helper'
|
209
|
-
# This file is no longer eagerly loaded as a workaround for an issue. It only gets loaded dynamically if the old
|
210
|
-
# profiler is in use. See Profiling::Component#load_pprof_support for more details.
|
211
|
-
# require_relative 'profiling/pprof/pprof_pb'
|
212
140
|
require_relative 'profiling/tag_builder'
|
213
141
|
require_relative 'profiling/http_transport'
|
214
142
|
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'tracer'
|
4
|
+
require_relative 'configuration/agent_settings_resolver'
|
4
5
|
require_relative 'flush'
|
5
6
|
require_relative 'sync_writer'
|
6
7
|
require_relative 'sampling/span/rule_parser'
|
7
8
|
require_relative 'sampling/span/sampler'
|
9
|
+
require_relative 'diagnostics/environment_logger'
|
8
10
|
|
9
11
|
module Datadog
|
10
12
|
module Tracing
|
@@ -21,12 +23,14 @@ module Datadog
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
|
-
def build_tracer(settings,
|
26
|
+
def build_tracer(settings, logger:)
|
25
27
|
# If a custom tracer has been provided, use it instead.
|
26
28
|
# Ignore all other options (they should already be configured.)
|
27
29
|
tracer = settings.tracing.instance
|
28
30
|
return tracer unless tracer.nil?
|
29
31
|
|
32
|
+
agent_settings = Configuration::AgentSettingsResolver.call(settings, logger: logger)
|
33
|
+
|
30
34
|
# Apply test mode settings if test mode is activated
|
31
35
|
if settings.tracing.test_mode.enabled
|
32
36
|
trace_flush = build_test_mode_trace_flush(settings)
|
@@ -130,12 +134,12 @@ module Datadog
|
|
130
134
|
# process, but can take a variety of options (including
|
131
135
|
# a fully custom instance) that makes the Tracer
|
132
136
|
# initialization process complex.
|
133
|
-
def build_writer(settings, agent_settings)
|
137
|
+
def build_writer(settings, agent_settings, options = settings.tracing.writer_options)
|
134
138
|
if (writer = settings.tracing.writer)
|
135
139
|
return writer
|
136
140
|
end
|
137
141
|
|
138
|
-
Tracing::Writer.new(agent_settings: agent_settings, **
|
142
|
+
Tracing::Writer.new(agent_settings: agent_settings, **options)
|
139
143
|
end
|
140
144
|
|
141
145
|
def subscribe_to_writer_events!(writer, sampler_delegator, test_mode)
|
@@ -154,7 +158,7 @@ module Datadog
|
|
154
158
|
end
|
155
159
|
|
156
160
|
WRITER_RECORD_ENVIRONMENT_INFORMATION_CALLBACK = lambda do |_, responses|
|
157
|
-
|
161
|
+
Tracing::Diagnostics::EnvironmentLogger.collect_and_log!(responses: responses)
|
158
162
|
end
|
159
163
|
|
160
164
|
# Create new lambda for writer callback,
|
@@ -219,8 +223,11 @@ module Datadog
|
|
219
223
|
end
|
220
224
|
|
221
225
|
def build_test_mode_writer(settings, agent_settings)
|
222
|
-
# Flush traces synchronously, to guarantee they are written.
|
223
226
|
writer_options = settings.tracing.test_mode.writer_options || {}
|
227
|
+
|
228
|
+
return build_writer(settings, agent_settings, writer_options) if settings.tracing.test_mode.async
|
229
|
+
|
230
|
+
# Flush traces synchronously, to guarantee they are written.
|
224
231
|
Tracing::SyncWriter.new(agent_settings: agent_settings, **writer_options)
|
225
232
|
end
|
226
233
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../core/configuration/agent_settings_resolver'
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Tracing
|
7
|
+
module Configuration
|
8
|
+
# This class encapsulates any tracing specific agent settings
|
9
|
+
class AgentSettingsResolver < Datadog::Core::Configuration::AgentSettingsResolver
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative '../../core/configuration/ext'
|
4
|
+
|
3
5
|
module Datadog
|
4
6
|
module Tracing
|
5
7
|
module Configuration
|
@@ -88,8 +90,8 @@ module Datadog
|
|
88
90
|
|
89
91
|
# @public_api
|
90
92
|
module Transport
|
91
|
-
ENV_DEFAULT_PORT =
|
92
|
-
ENV_DEFAULT_URL =
|
93
|
+
ENV_DEFAULT_PORT = Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_PORT
|
94
|
+
ENV_DEFAULT_URL = Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL
|
93
95
|
end
|
94
96
|
|
95
97
|
# @public_api
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../../tracing/configuration/ext'
|
2
|
+
require_relative '../../core/environment/variable_helpers'
|
2
3
|
require_relative 'http'
|
3
4
|
|
4
5
|
module Datadog
|
@@ -64,7 +65,7 @@ module Datadog
|
|
64
65
|
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER,
|
65
66
|
]
|
66
67
|
)
|
67
|
-
o.
|
68
|
+
o.after_set do |styles|
|
68
69
|
# Modernize B3 options
|
69
70
|
# DEV-2.0: Can be removed with the removal of deprecated B3 constants.
|
70
71
|
styles.map! do |style|
|
@@ -93,7 +94,7 @@ module Datadog
|
|
93
94
|
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT
|
94
95
|
# DEV-2.0: Change default value to `tracecontext, Datadog`.
|
95
96
|
o.default [Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG]
|
96
|
-
o.
|
97
|
+
o.after_set do |styles|
|
97
98
|
# Modernize B3 options
|
98
99
|
# DEV-2.0: Can be removed with the removal of deprecated B3 constants.
|
99
100
|
styles.map! do |style|
|
@@ -121,7 +122,7 @@ module Datadog
|
|
121
122
|
o.type :array
|
122
123
|
o.env Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE
|
123
124
|
o.default []
|
124
|
-
o.
|
125
|
+
o.after_set do |styles|
|
125
126
|
next if styles.empty?
|
126
127
|
|
127
128
|
# Modernize B3 options
|
@@ -371,6 +372,12 @@ module Datadog
|
|
371
372
|
o.env Tracing::Configuration::Ext::Test::ENV_MODE_ENABLED
|
372
373
|
end
|
373
374
|
|
375
|
+
# Use async writer in test mode
|
376
|
+
option :async do |o|
|
377
|
+
o.type :bool
|
378
|
+
o.default false
|
379
|
+
end
|
380
|
+
|
374
381
|
option :trace_flush
|
375
382
|
|
376
383
|
option :writer_options do |o|
|
@@ -382,8 +389,8 @@ module Datadog
|
|
382
389
|
# @see file:docs/GettingStarted.md#configuring-the-transport-layer Configuring the transport layer
|
383
390
|
#
|
384
391
|
# A {Proc} that configures a custom tracer transport.
|
385
|
-
# @yield Receives a {Datadog::Transport::HTTP} that can be modified with custom adapters and settings.
|
386
|
-
# @yieldparam [Datadog::Transport::HTTP] t transport to be configured.
|
392
|
+
# @yield Receives a {Datadog::Tracing::Transport::HTTP} that can be modified with custom adapters and settings.
|
393
|
+
# @yieldparam [Datadog::Tracing::Transport::HTTP] t transport to be configured.
|
387
394
|
# @default `nil`
|
388
395
|
# @return [Proc,nil]
|
389
396
|
option :transport_options do |o|
|
@@ -425,7 +432,7 @@ module Datadog
|
|
425
432
|
option :enabled do |o|
|
426
433
|
o.type :bool
|
427
434
|
o.default do
|
428
|
-
disabled = env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_DISABLED)
|
435
|
+
disabled = Core::Environment::VariableHelpers.env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_DISABLED)
|
429
436
|
|
430
437
|
enabled = if disabled.nil?
|
431
438
|
false
|
@@ -438,7 +445,7 @@ module Datadog
|
|
438
445
|
end
|
439
446
|
|
440
447
|
# ENABLED env var takes precedence over deprecated DISABLED
|
441
|
-
env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_ENABLED, enabled)
|
448
|
+
Core::Environment::VariableHelpers.env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_ENABLED, enabled)
|
442
449
|
end
|
443
450
|
end
|
444
451
|
|
@@ -90,18 +90,25 @@ module Datadog
|
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
93
|
+
#
|
94
|
+
# `::ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver` exists from 4+ til from 6.0.x
|
95
|
+
#
|
96
|
+
# `::ActiveRecord::DatabaseConfigurations` was introduced from 6+,
|
97
|
+
# but from 6.1.x, it was refactored to encapsulates the resolving logic, hence removing the resolver
|
98
|
+
#
|
93
99
|
def connection_resolver
|
94
|
-
@resolver ||=
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
@resolver ||=
|
101
|
+
# From 6.1+
|
102
|
+
if defined?(::ActiveRecord::Base.configurations.resolve)
|
103
|
+
::ActiveRecord::DatabaseConfigurations.new(active_record_configuration)
|
104
|
+
# From 4+ to 6.0.x
|
105
|
+
elsif defined?(::ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver)
|
106
|
+
::ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(active_record_configuration)
|
107
|
+
else
|
108
|
+
Contrib::ActiveRecord::Vendor::ConnectionAdapters::ConnectionSpecification::Resolver.new(
|
109
|
+
active_record_configuration
|
110
|
+
)
|
111
|
+
end
|
105
112
|
end
|
106
113
|
|
107
114
|
def resolve_connection_key(key)
|
@@ -45,6 +45,10 @@ module Datadog
|
|
45
45
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
46
46
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_SQL)
|
47
47
|
|
48
|
+
if service_name != Datadog.configuration.service
|
49
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
50
|
+
end
|
51
|
+
|
48
52
|
# Set analytics sample rate
|
49
53
|
if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
|
50
54
|
Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
|
@@ -113,7 +113,7 @@ module Datadog
|
|
113
113
|
|
114
114
|
# @return [Hash]
|
115
115
|
def self.db_config(connection_pool)
|
116
|
-
if
|
116
|
+
if connection_pool.respond_to? :db_config
|
117
117
|
connection_pool.db_config.configuration_hash
|
118
118
|
else
|
119
119
|
connection_pool.spec.config
|