ddtrace 1.14.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +146 -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 -16
- 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 +67 -2
- data/lib/datadog/appsec/contrib/rack/gateway/request.rb +6 -2
- data/lib/datadog/appsec/contrib/rack/gateway/response.rb +46 -0
- 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 +7 -5
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +3 -2
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +34 -10
- 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 +7 -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/environment/execution.rb +47 -9
- 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/remote/worker.rb +3 -1
- data/lib/datadog/core/telemetry/collector.rb +3 -2
- 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 +14 -19
- 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 +24 -99
- data/lib/datadog/profiling/ext.rb +0 -12
- data/lib/datadog/profiling/flush.rb +0 -3
- data/lib/datadog/profiling/http_transport.rb +6 -3
- data/lib/datadog/profiling/native_extension.rb +0 -21
- data/lib/datadog/profiling/profiler.rb +36 -13
- data/lib/datadog/profiling/scheduler.rb +16 -9
- data/lib/datadog/profiling.rb +8 -81
- data/lib/datadog/tracing/component.rb +10 -4
- 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/events/sql.rb +4 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +106 -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/concurrent_ruby/context_composite_executor_service.rb +14 -14
- data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +3 -10
- data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +2 -1
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +8 -1
- data/lib/datadog/tracing/contrib/concurrent_ruby/promises_future_patch.rb +22 -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 +5 -0
- 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/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/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +3 -38
- data/lib/datadog/tracing/contrib/redis/tags.rb +7 -2
- data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +46 -33
- 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/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 +2 -2
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +6 -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 +5 -3
- 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 +1 -1
- data/lib/ddtrace.rb +1 -1
- metadata +73 -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
|
@@ -10,266 +10,175 @@ module Datadog
|
|
|
10
10
|
module ActiveSupport
|
|
11
11
|
module Cache
|
|
12
12
|
# Defines instrumentation for ActiveSupport caching
|
|
13
|
-
# rubocop:disable Lint/RescueException
|
|
14
13
|
module Instrumentation
|
|
15
14
|
module_function
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# interesting details.
|
|
23
|
-
# NOTE: the ``finish_trace_cache()`` is fired but it already has a safe-guard
|
|
24
|
-
# to avoid any kind of issue.
|
|
25
|
-
current_span = Tracing.active_span
|
|
26
|
-
return if current_span.try(:name) == Ext::SPAN_CACHE &&
|
|
27
|
-
(
|
|
28
|
-
payload[:action] == Ext::RESOURCE_CACHE_GET &&
|
|
29
|
-
current_span.try(:resource) == Ext::RESOURCE_CACHE_GET ||
|
|
30
|
-
payload[:action] == Ext::RESOURCE_CACHE_MGET &&
|
|
31
|
-
current_span.try(:resource) == Ext::RESOURCE_CACHE_MGET
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
tracing_context = payload.fetch(:tracing_context)
|
|
16
|
+
# @param action [String] type of cache operation. Will be set as the span resource.
|
|
17
|
+
# @param key [Object] redis cache key. Used for actions with a single key locator.
|
|
18
|
+
# @param multi_key [Array<Object>] list of redis cache keys. Used for actions with a multiple key locators.
|
|
19
|
+
def trace(action, store, key: nil, multi_key: nil)
|
|
20
|
+
return yield unless enabled?
|
|
35
21
|
|
|
36
22
|
# create a new ``Span`` and add it to the tracing context
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
span
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def finish_trace_cache(payload)
|
|
51
|
-
return unless enabled?
|
|
52
|
-
|
|
53
|
-
# retrieve the tracing context and continue the trace
|
|
54
|
-
tracing_context = payload.fetch(:tracing_context)
|
|
55
|
-
span = tracing_context[:dd_cache_span]
|
|
56
|
-
return unless span && !span.finished?
|
|
57
|
-
|
|
58
|
-
begin
|
|
59
|
-
# discard parameters from the cache_store configuration
|
|
60
|
-
if defined?(::Rails)
|
|
61
|
-
store, = *Array.wrap(::Rails.configuration.cache_store).flatten
|
|
62
|
-
span.set_tag(Ext::TAG_CACHE_BACKEND, store)
|
|
23
|
+
Tracing.trace(
|
|
24
|
+
Ext::SPAN_CACHE,
|
|
25
|
+
span_type: Ext::SPAN_TYPE_CACHE,
|
|
26
|
+
service: Datadog.configuration.tracing[:active_support][:cache_service],
|
|
27
|
+
resource: action
|
|
28
|
+
) do |span|
|
|
29
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
|
30
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_CACHE)
|
|
31
|
+
|
|
32
|
+
if span.service != Datadog.configuration.service
|
|
33
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
|
63
34
|
end
|
|
64
35
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
span.set_tag(Ext::TAG_CACHE_KEY, cache_key)
|
|
36
|
+
span.set_tag(Ext::TAG_CACHE_BACKEND, store) if store
|
|
37
|
+
set_cache_key(span, key, multi_key)
|
|
68
38
|
|
|
69
|
-
|
|
70
|
-
ensure
|
|
71
|
-
span.finish
|
|
39
|
+
yield
|
|
72
40
|
end
|
|
73
|
-
rescue StandardError => e
|
|
74
|
-
Datadog.logger.debug(e.message)
|
|
75
41
|
end
|
|
76
42
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
43
|
+
# In most of the cases, `#fetch()` and `#read()` calls are nested.
|
|
44
|
+
# Instrument both does not add any value.
|
|
45
|
+
# This method checks if these two operations are nested.
|
|
46
|
+
def nested_read?
|
|
47
|
+
current_span = Tracing.active_span
|
|
48
|
+
current_span && current_span.name == Ext::SPAN_CACHE && current_span.resource == Ext::RESOURCE_CACHE_GET
|
|
49
|
+
end
|
|
84
50
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
end
|
|
91
|
-
normalized_keys = payload.fetch(:keys, []).map do |key|
|
|
92
|
-
::ActiveSupport::Cache.expand_cache_key(key)
|
|
93
|
-
end
|
|
94
|
-
cache_keys = Core::Utils.truncate(normalized_keys, Ext::QUANTIZE_CACHE_MAX_KEY_SIZE)
|
|
95
|
-
span.set_tag(Ext::TAG_CACHE_KEY_MULTI, cache_keys)
|
|
51
|
+
# (see #nested_read?)
|
|
52
|
+
def nested_multiread?
|
|
53
|
+
current_span = Tracing.active_span
|
|
54
|
+
current_span && current_span.name == Ext::SPAN_CACHE && current_span.resource == Ext::RESOURCE_CACHE_MGET
|
|
55
|
+
end
|
|
96
56
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
57
|
+
def set_cache_key(span, single_key, multi_key)
|
|
58
|
+
if multi_key
|
|
59
|
+
resolved_key = multi_key.map { |key| ::ActiveSupport::Cache.expand_cache_key(key) }
|
|
60
|
+
cache_key = Core::Utils.truncate(resolved_key, Ext::QUANTIZE_CACHE_MAX_KEY_SIZE)
|
|
61
|
+
span.set_tag(Ext::TAG_CACHE_KEY_MULTI, cache_key)
|
|
62
|
+
else
|
|
63
|
+
resolved_key = ::ActiveSupport::Cache.expand_cache_key(single_key)
|
|
64
|
+
cache_key = Core::Utils.truncate(resolved_key, Ext::QUANTIZE_CACHE_MAX_KEY_SIZE)
|
|
65
|
+
span.set_tag(Ext::TAG_CACHE_KEY, cache_key)
|
|
100
66
|
end
|
|
101
|
-
rescue StandardError => e
|
|
102
|
-
Datadog.logger.debug(e.message)
|
|
103
67
|
end
|
|
104
68
|
|
|
105
69
|
def enabled?
|
|
106
70
|
Tracing.enabled? && Datadog.configuration.tracing[:active_support][:enabled]
|
|
107
71
|
end
|
|
108
72
|
|
|
73
|
+
# Instance methods injected into the cache client
|
|
74
|
+
module InstanceMethods
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
# The name of the store is never saved.
|
|
78
|
+
# ActiveSupport looks up stores by converting a symbol into a 'require' path,
|
|
79
|
+
# then "camelizing" it for a `const_get` call:
|
|
80
|
+
# ```
|
|
81
|
+
# require "active_support/cache/#{store}"
|
|
82
|
+
# ActiveSupport::Cache.const_get(store.to_s.camelize)
|
|
83
|
+
# ```
|
|
84
|
+
# @see https://github.com/rails/rails/blob/261975dbef77731d2c76f907f1076c5132ebc0e4/activesupport/lib/active_support/cache.rb#L139-L149
|
|
85
|
+
#
|
|
86
|
+
# As `self` is the store object, we can reverse engineer
|
|
87
|
+
# the original symbol by converting the class name to snake case:
|
|
88
|
+
# e.g. ActiveSupport::Cache::RedisStore -> active_support/cache/redis_store
|
|
89
|
+
# In this case, `redis_store` is the store name.
|
|
90
|
+
#
|
|
91
|
+
# Because there's no API retrieve only the class name
|
|
92
|
+
# (only `RedisStore`, and not `ActiveSupport::Cache::RedisStore`)
|
|
93
|
+
# the easiest way to retrieve the store symbol is to convert the fully qualified
|
|
94
|
+
# name using the Rails-provided method `#underscore`, which is the reverse of `#camelize`,
|
|
95
|
+
# then extracting the last part of it.
|
|
96
|
+
#
|
|
97
|
+
# Also, this method caches the store name, given this value will be retrieve
|
|
98
|
+
# multiple times and involves string manipulation.
|
|
99
|
+
def dd_store_name
|
|
100
|
+
return @store_name if defined?(@store_name)
|
|
101
|
+
|
|
102
|
+
# DEV: String#underscore is available through ActiveSupport, and is
|
|
103
|
+
# DEV: the exact reverse operation to `#camelize`.
|
|
104
|
+
# DEV: String#demodulize is available through ActiveSupport, and is
|
|
105
|
+
# DEV: used to remove the module ('*::') part of a constant name.
|
|
106
|
+
@store_name = self.class.name.demodulize.underscore
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
109
110
|
# Defines instrumentation for ActiveSupport cache reading
|
|
110
111
|
module Read
|
|
112
|
+
include InstanceMethods
|
|
113
|
+
|
|
111
114
|
def read(*args, &block)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
tracing_context: {}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
begin
|
|
119
|
-
# process and catch cache exceptions
|
|
120
|
-
Instrumentation.start_trace_cache(payload)
|
|
121
|
-
super
|
|
122
|
-
rescue Exception => e
|
|
123
|
-
payload[:exception] = [e.class.name, e.message]
|
|
124
|
-
payload[:exception_object] = e
|
|
125
|
-
raise e
|
|
126
|
-
end
|
|
127
|
-
ensure
|
|
128
|
-
Instrumentation.finish_trace_cache(payload)
|
|
115
|
+
return super if Instrumentation.nested_read?
|
|
116
|
+
|
|
117
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_GET, dd_store_name, key: args[0]) { super }
|
|
129
118
|
end
|
|
130
119
|
end
|
|
131
120
|
|
|
132
121
|
# Defines instrumentation for ActiveSupport cache reading of multiple keys
|
|
133
122
|
module ReadMulti
|
|
123
|
+
include InstanceMethods
|
|
124
|
+
|
|
134
125
|
def read_multi(*keys, &block)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
tracing_context: {}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
begin
|
|
142
|
-
# process and catch cache exceptions
|
|
143
|
-
Instrumentation.start_trace_cache(payload)
|
|
144
|
-
super
|
|
145
|
-
rescue Exception => e
|
|
146
|
-
payload[:exception] = [e.class.name, e.message]
|
|
147
|
-
payload[:exception_object] = e
|
|
148
|
-
raise e
|
|
149
|
-
end
|
|
150
|
-
ensure
|
|
151
|
-
Instrumentation.finish_trace_cache_multi(payload)
|
|
126
|
+
return super if Instrumentation.nested_multiread?
|
|
127
|
+
|
|
128
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_MGET, dd_store_name, multi_key: keys) { super }
|
|
152
129
|
end
|
|
153
130
|
end
|
|
154
131
|
|
|
155
132
|
# Defines instrumentation for ActiveSupport cache fetching
|
|
156
133
|
module Fetch
|
|
134
|
+
include InstanceMethods
|
|
135
|
+
|
|
157
136
|
def fetch(*args, &block)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
tracing_context: {}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
begin
|
|
165
|
-
# process and catch cache exceptions
|
|
166
|
-
Instrumentation.start_trace_cache(payload)
|
|
167
|
-
super
|
|
168
|
-
rescue Exception => e
|
|
169
|
-
payload[:exception] = [e.class.name, e.message]
|
|
170
|
-
payload[:exception_object] = e
|
|
171
|
-
raise e
|
|
172
|
-
end
|
|
173
|
-
ensure
|
|
174
|
-
Instrumentation.finish_trace_cache(payload)
|
|
137
|
+
return super if Instrumentation.nested_read?
|
|
138
|
+
|
|
139
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_GET, dd_store_name, key: args[0]) { super }
|
|
175
140
|
end
|
|
176
141
|
end
|
|
177
142
|
|
|
178
143
|
# Defines instrumentation for ActiveSupport cache fetching of multiple keys
|
|
179
144
|
module FetchMulti
|
|
145
|
+
include InstanceMethods
|
|
146
|
+
|
|
180
147
|
def fetch_multi(*args, &block)
|
|
181
|
-
|
|
148
|
+
return super if Instrumentation.nested_multiread?
|
|
149
|
+
|
|
182
150
|
keys = args[-1].instance_of?(Hash) ? args[0..-2] : args
|
|
183
|
-
|
|
184
|
-
action: Ext::RESOURCE_CACHE_MGET,
|
|
185
|
-
keys: keys,
|
|
186
|
-
tracing_context: {}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
begin
|
|
190
|
-
# process and catch cache exceptions
|
|
191
|
-
Instrumentation.start_trace_cache(payload)
|
|
192
|
-
super
|
|
193
|
-
rescue Exception => e
|
|
194
|
-
payload[:exception] = [e.class.name, e.message]
|
|
195
|
-
payload[:exception_object] = e
|
|
196
|
-
raise e
|
|
197
|
-
end
|
|
198
|
-
ensure
|
|
199
|
-
Instrumentation.finish_trace_cache_multi(payload)
|
|
151
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_MGET, dd_store_name, multi_key: keys) { super }
|
|
200
152
|
end
|
|
201
153
|
end
|
|
202
154
|
|
|
203
155
|
# Defines instrumentation for ActiveSupport cache writing
|
|
204
156
|
module Write
|
|
157
|
+
include InstanceMethods
|
|
158
|
+
|
|
205
159
|
def write(*args, &block)
|
|
206
|
-
|
|
207
|
-
action: Ext::RESOURCE_CACHE_SET,
|
|
208
|
-
key: args[0],
|
|
209
|
-
tracing_context: {}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
begin
|
|
213
|
-
# process and catch cache exceptions
|
|
214
|
-
Instrumentation.start_trace_cache(payload)
|
|
215
|
-
super
|
|
216
|
-
rescue Exception => e
|
|
217
|
-
payload[:exception] = [e.class.name, e.message]
|
|
218
|
-
payload[:exception_object] = e
|
|
219
|
-
raise e
|
|
220
|
-
end
|
|
221
|
-
ensure
|
|
222
|
-
Instrumentation.finish_trace_cache(payload)
|
|
160
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_SET, dd_store_name, key: args[0]) { super }
|
|
223
161
|
end
|
|
224
162
|
end
|
|
225
163
|
|
|
226
164
|
# Defines instrumentation for ActiveSupport cache writing of multiple keys
|
|
227
165
|
module WriteMulti
|
|
166
|
+
include InstanceMethods
|
|
167
|
+
|
|
228
168
|
def write_multi(hash, options = nil)
|
|
229
|
-
|
|
230
|
-
action: Ext::RESOURCE_CACHE_MSET,
|
|
231
|
-
keys: hash.keys,
|
|
232
|
-
tracing_context: {}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
begin
|
|
236
|
-
# process and catch cache exceptions
|
|
237
|
-
Instrumentation.start_trace_cache(payload)
|
|
238
|
-
super
|
|
239
|
-
rescue Exception => e
|
|
240
|
-
payload[:exception] = [e.class.name, e.message]
|
|
241
|
-
payload[:exception_object] = e
|
|
242
|
-
raise e
|
|
243
|
-
end
|
|
244
|
-
ensure
|
|
245
|
-
Instrumentation.finish_trace_cache_multi(payload)
|
|
169
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_MSET, dd_store_name, multi_key: hash.keys) { super }
|
|
246
170
|
end
|
|
247
171
|
end
|
|
248
172
|
|
|
249
173
|
# Defines instrumentation for ActiveSupport cache deleting
|
|
250
174
|
module Delete
|
|
175
|
+
include InstanceMethods
|
|
176
|
+
|
|
251
177
|
def delete(*args, &block)
|
|
252
|
-
|
|
253
|
-
action: Ext::RESOURCE_CACHE_DELETE,
|
|
254
|
-
key: args[0],
|
|
255
|
-
tracing_context: {}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
begin
|
|
259
|
-
# process and catch cache exceptions
|
|
260
|
-
Instrumentation.start_trace_cache(payload)
|
|
261
|
-
super
|
|
262
|
-
rescue Exception => e
|
|
263
|
-
payload[:exception] = [e.class.name, e.message]
|
|
264
|
-
payload[:exception_object] = e
|
|
265
|
-
raise e
|
|
266
|
-
end
|
|
267
|
-
ensure
|
|
268
|
-
Instrumentation.finish_trace_cache(payload)
|
|
178
|
+
Instrumentation.trace(Ext::RESOURCE_CACHE_DELETE, dd_store_name, key: args[0]) { super }
|
|
269
179
|
end
|
|
270
180
|
end
|
|
271
181
|
end
|
|
272
|
-
# rubocop:enable Lint/RescueException
|
|
273
182
|
end
|
|
274
183
|
end
|
|
275
184
|
end
|
|
@@ -28,6 +28,7 @@ module Datadog
|
|
|
28
28
|
|
|
29
29
|
private
|
|
30
30
|
|
|
31
|
+
# rubocop:disable Metrics/AbcSize
|
|
31
32
|
def annotate!(span, context)
|
|
32
33
|
span.service = configuration[:service_name]
|
|
33
34
|
span.span_type = Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND
|
|
@@ -47,6 +48,11 @@ module Datadog
|
|
|
47
48
|
)
|
|
48
49
|
end
|
|
49
50
|
|
|
51
|
+
# Tag original global service name if not used
|
|
52
|
+
if span.service != Datadog.configuration.service
|
|
53
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
|
54
|
+
end
|
|
55
|
+
|
|
50
56
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
|
51
57
|
|
|
52
58
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
|
@@ -71,6 +77,7 @@ module Datadog
|
|
|
71
77
|
|
|
72
78
|
Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
|
|
73
79
|
end
|
|
80
|
+
# rubocop:enable Metrics/AbcSize
|
|
74
81
|
|
|
75
82
|
def configuration
|
|
76
83
|
Datadog.configuration.tracing[:aws]
|
|
@@ -6,7 +6,7 @@ module Datadog
|
|
|
6
6
|
module Tracing
|
|
7
7
|
module Contrib
|
|
8
8
|
module ConcurrentRuby
|
|
9
|
-
#
|
|
9
|
+
# Wraps existing executor to carry over trace context
|
|
10
10
|
class ContextCompositeExecutorService
|
|
11
11
|
include Concurrent::ExecutorService
|
|
12
12
|
|
|
@@ -16,20 +16,20 @@ module Datadog
|
|
|
16
16
|
@composited_executor = composited_executor
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
# post method runs the task within composited executor - in a different thread
|
|
19
|
+
# post method runs the task within composited executor - in a different thread. The original arguments are
|
|
20
|
+
# captured to be propagated to the composited executor post method
|
|
20
21
|
def post(*args, &task)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
22
|
+
digest = Tracing.active_trace.to_digest
|
|
23
|
+
executor = @composited_executor.is_a?(Symbol) ? Concurrent.executor(@composited_executor) : @composited_executor
|
|
24
|
+
|
|
25
|
+
# Pass the original arguments to the composited executor, which
|
|
26
|
+
# pushes them (possibly transformed) as block args
|
|
27
|
+
executor.post(*args) do |*block_args|
|
|
28
|
+
Tracing.continue_trace!(digest)
|
|
29
|
+
|
|
30
|
+
# Pass the executor-provided block args as they should have been
|
|
31
|
+
# originally passed without composition, see ChainPromise#on_resolvable
|
|
32
|
+
yield(*block_args)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -8,17 +8,10 @@ module Datadog
|
|
|
8
8
|
module ConcurrentRuby
|
|
9
9
|
# This patches the Future - to wrap executor service using ContextCompositeExecutorService
|
|
10
10
|
module FuturePatch
|
|
11
|
-
def
|
|
12
|
-
|
|
13
|
-
alias_method :ns_initialize_without_datadog, :ns_initialize
|
|
14
|
-
remove_method(:ns_initialize)
|
|
11
|
+
def ns_initialize(value, opts)
|
|
12
|
+
super(value, opts)
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
ns_initialize_without_datadog(value, opts)
|
|
18
|
-
|
|
19
|
-
@executor = ContextCompositeExecutorService.new(@executor)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
14
|
+
@executor = ContextCompositeExecutorService.new(@executor)
|
|
22
15
|
end
|
|
23
16
|
end
|
|
24
17
|
end
|
|
@@ -20,7 +20,8 @@ module Datadog
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def self.loaded?
|
|
23
|
-
|
|
23
|
+
# Concurrent::Future is deprecated in favour of Concurrent::Promises::Future
|
|
24
|
+
!defined?(::Concurrent::Promises::Future).nil? || !defined?(::Concurrent::Future).nil?
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
def self.compatible?
|
|
@@ -19,11 +19,18 @@ module Datadog
|
|
|
19
19
|
def patch
|
|
20
20
|
require_relative 'future_patch'
|
|
21
21
|
patch_future
|
|
22
|
+
require_relative 'promises_future_patch'
|
|
23
|
+
patch_promises_future
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
# Propagate tracing context in Concurrent::Future
|
|
25
27
|
def patch_future
|
|
26
|
-
::Concurrent::Future.
|
|
28
|
+
::Concurrent::Future.prepend(FuturePatch) if defined?(::Concurrent::Future)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Propagate tracing context in Concurrent::Promises::Future
|
|
32
|
+
def patch_promises_future
|
|
33
|
+
::Concurrent::Promises.singleton_class.prepend(PromisesFuturePatch) if defined?(::Concurrent::Promises::Future)
|
|
27
34
|
end
|
|
28
35
|
end
|
|
29
36
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'context_composite_executor_service'
|
|
4
|
+
|
|
5
|
+
module Datadog
|
|
6
|
+
module Tracing
|
|
7
|
+
module Contrib
|
|
8
|
+
module ConcurrentRuby
|
|
9
|
+
# This patches the Future - to wrap executor service using ContextCompositeExecutorService
|
|
10
|
+
module PromisesFuturePatch
|
|
11
|
+
def future_on(default_executor, *args, &task)
|
|
12
|
+
unless default_executor.is_a?(ContextCompositeExecutorService)
|
|
13
|
+
default_executor = ContextCompositeExecutorService.new(default_executor)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
super(default_executor, *args, &task)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -7,9 +7,16 @@ module Datadog
|
|
|
7
7
|
# Dalli integration constants
|
|
8
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
|
9
9
|
module Ext
|
|
10
|
+
# DEV: Even though this is the dalli integration, all spans are named `memcached.*`.
|
|
11
|
+
# DEV: This happens because such spans have special treatment in backend, with memcached-specific handling.
|
|
12
|
+
# DEV: If add support for the `memcached` gem (not popular as of 2023), we'll have issues with span naming
|
|
13
|
+
# DEV: conflicts.
|
|
10
14
|
ENV_ENABLED = 'DD_TRACE_DALLI_ENABLED'
|
|
11
15
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_DALLI_ANALYTICS_ENABLED'
|
|
12
16
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_DALLI_ANALYTICS_SAMPLE_RATE'
|
|
17
|
+
# DEV: This is named `*_MEMCACHED_*` because the spans it refer to are `memcached.*` and this variable
|
|
18
|
+
# DEV: is a global flag that affects all memcached spans generated by any Datadog product.
|
|
19
|
+
ENV_COMMAND_ENABLED = 'DD_TRACE_MEMCACHED_COMMAND_ENABLED'
|
|
13
20
|
ENV_SERVICE_NAME = 'DD_TRACE_DALLI_SERVICE_NAME'
|
|
14
21
|
ENV_PEER_SERVICE = 'DD_TRACE_DALLI_PEER_SERVICE'
|
|
15
22
|
|
|
@@ -29,6 +29,11 @@ module Datadog
|
|
|
29
29
|
)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Tag original global service name if not used
|
|
33
|
+
if span.service != Datadog.configuration.service
|
|
34
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
|
33
38
|
|
|
34
39
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
|
@@ -45,8 +50,10 @@ module Datadog
|
|
|
45
50
|
|
|
46
51
|
span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM)
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
if datadog_configuration[:command_enabled]
|
|
54
|
+
cmd = Quantize.format_command(op, args)
|
|
55
|
+
span.set_tag(Ext::TAG_COMMAND, cmd)
|
|
56
|
+
end
|
|
50
57
|
|
|
51
58
|
Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
|
|
52
59
|
super
|
|
@@ -34,7 +34,7 @@ module Datadog
|
|
|
34
34
|
option :client_service_name
|
|
35
35
|
option :error_handler do |o|
|
|
36
36
|
o.type :proc
|
|
37
|
-
o.
|
|
37
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -77,6 +77,11 @@ module Datadog
|
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
+
# Tag original global service name if not used
|
|
81
|
+
if span.service != Datadog.configuration.service
|
|
82
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
|
83
|
+
end
|
|
84
|
+
|
|
80
85
|
span.span_type = Datadog::Tracing::Contrib::Elasticsearch::Ext::SPAN_TYPE_QUERY
|
|
81
86
|
|
|
82
87
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
|
@@ -136,6 +136,11 @@ module Datadog
|
|
|
136
136
|
)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
+
# Tag original global service name if not used
|
|
140
|
+
if span.service != Datadog.configuration.service
|
|
141
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
|
142
|
+
end
|
|
143
|
+
|
|
139
144
|
# Set analytics sample rate
|
|
140
145
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
|
141
146
|
|
|
@@ -69,6 +69,14 @@ module Datadog
|
|
|
69
69
|
|
|
70
70
|
@datadog_multi_span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
|
71
71
|
|
|
72
|
+
# Tag original global service name if not used
|
|
73
|
+
if @datadog_multi_span.service != Datadog.configuration.service
|
|
74
|
+
@datadog_multi_span.set_tag(
|
|
75
|
+
Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE,
|
|
76
|
+
Datadog.configuration.service
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
72
80
|
# Set analytics sample rate
|
|
73
81
|
Contrib::Analytics.set_sample_rate(@datadog_multi_span, analytics_sample_rate) if analytics_enabled?
|
|
74
82
|
|