ddtrace 1.14.0 → 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 +178 -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 +61 -2
- 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 +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/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 +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 +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 +11 -12
- 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 +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 +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/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/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/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 +72 -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
@@ -36,7 +36,7 @@ module Datadog
|
|
36
36
|
option :distributed_tracing, default: true, type: :bool
|
37
37
|
option :error_handler do |o|
|
38
38
|
o.type :proc
|
39
|
-
o.
|
39
|
+
o.default_proc(&DEFAULT_ERROR_HANDLER)
|
40
40
|
end
|
41
41
|
option :split_by_domain, default: false, type: :bool
|
42
42
|
|
@@ -47,6 +47,11 @@ module Datadog
|
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
50
|
+
# Tag original global service name if not used
|
51
|
+
if span.service != Datadog.configuration.service
|
52
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
53
|
+
end
|
54
|
+
|
50
55
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
51
56
|
|
52
57
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
@@ -48,7 +48,27 @@ module Datadog
|
|
48
48
|
|
49
49
|
option :error_handler do |o|
|
50
50
|
o.type :proc
|
51
|
-
o.
|
51
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
52
|
+
o.after_set do |value|
|
53
|
+
if value != Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
|
54
|
+
Datadog.logger.warn(
|
55
|
+
'The gRPC `error_handler` setting has been deprecated for removal. Please replace ' \
|
56
|
+
'it with `server_error_handler` which is explicit about only handling errors from ' \
|
57
|
+
'server interceptors. Alternatively, to handle errors from client interceptors use ' \
|
58
|
+
'the `client_error_handler` setting instead.'
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
option :server_error_handler do |o|
|
65
|
+
o.type :proc
|
66
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
67
|
+
end
|
68
|
+
|
69
|
+
option :client_error_handler do |o|
|
70
|
+
o.type :proc
|
71
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
52
72
|
end
|
53
73
|
end
|
54
74
|
end
|
@@ -22,7 +22,8 @@ module Datadog
|
|
22
22
|
options = {
|
23
23
|
span_type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
|
24
24
|
service: service_name, # Maintain client-side service name configuration
|
25
|
-
resource: formatter.resource_name
|
25
|
+
resource: formatter.resource_name,
|
26
|
+
on_error: error_handler
|
26
27
|
}
|
27
28
|
|
28
29
|
Tracing.trace(Ext::SPAN_CLIENT, **options) do |span, trace|
|
@@ -56,6 +57,11 @@ module Datadog
|
|
56
57
|
)
|
57
58
|
end
|
58
59
|
|
60
|
+
# Tag original global service name if not used
|
61
|
+
if span.service != Datadog.configuration.service
|
62
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
63
|
+
end
|
64
|
+
|
59
65
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
60
66
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
61
67
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_CLIENT)
|
@@ -101,6 +107,10 @@ module Datadog
|
|
101
107
|
Datadog.logger.debug { "Could not parse host:port from #{call}: #{e}" }
|
102
108
|
nil
|
103
109
|
end
|
110
|
+
|
111
|
+
def error_handler
|
112
|
+
Datadog.configuration_for(self, :error_handler) || datadog_configuration[:client_error_handler]
|
113
|
+
end
|
104
114
|
end
|
105
115
|
end
|
106
116
|
end
|
@@ -64,6 +64,11 @@ module Datadog
|
|
64
64
|
span.set_tag(header, value)
|
65
65
|
end
|
66
66
|
|
67
|
+
# Tag original global service name if not used
|
68
|
+
if span.service != Datadog.configuration.service
|
69
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
70
|
+
end
|
71
|
+
|
67
72
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_SERVER)
|
68
73
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
69
74
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_SERVICE)
|
@@ -81,6 +86,19 @@ module Datadog
|
|
81
86
|
rescue StandardError => e
|
82
87
|
Datadog.logger.debug("GRPC server trace failed: #{e}")
|
83
88
|
end
|
89
|
+
|
90
|
+
def error_handler
|
91
|
+
self_handler = Datadog.configuration_for(self, :error_handler)
|
92
|
+
return self_handler if self_handler
|
93
|
+
|
94
|
+
unless datadog_configuration.using_default?(:server_error_handler)
|
95
|
+
return datadog_configuration[:server_error_handler]
|
96
|
+
end
|
97
|
+
|
98
|
+
# As a last resort, fallback to the deprecated error_handler
|
99
|
+
# configuration option.
|
100
|
+
datadog_configuration[:error_handler]
|
101
|
+
end
|
84
102
|
end
|
85
103
|
end
|
86
104
|
end
|
@@ -58,10 +58,6 @@ module Datadog
|
|
58
58
|
datadog_configuration[:analytics_sample_rate]
|
59
59
|
end
|
60
60
|
|
61
|
-
def error_handler
|
62
|
-
datadog_configuration[:error_handler]
|
63
|
-
end
|
64
|
-
|
65
61
|
# Allows interceptors to define settings using methods instead of `[]`
|
66
62
|
class PinAdapter
|
67
63
|
OPTIONS = Configuration::Settings.instance_methods(false).freeze
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative '../../../core/transport/ext'
|
4
4
|
|
5
5
|
module Datadog
|
6
6
|
module Tracing
|
@@ -24,8 +24,8 @@ module Datadog
|
|
24
24
|
# TODO: We don't want this kind of soft-check on HTTP requests.
|
25
25
|
# Remove this when transport implements its own "skip tracing" mechanism.
|
26
26
|
def internal_request?(request)
|
27
|
-
!!(request[Datadog::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION] ||
|
28
|
-
request[Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST])
|
27
|
+
!!(request[Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION] ||
|
28
|
+
request[Datadog::Core::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST])
|
29
29
|
end
|
30
30
|
|
31
31
|
def should_skip_distributed_tracing?(client_config)
|
@@ -76,6 +76,11 @@ module Datadog
|
|
76
76
|
)
|
77
77
|
end
|
78
78
|
|
79
|
+
# Tag original global service name if not used
|
80
|
+
if span.service != Datadog.configuration.service
|
81
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
82
|
+
end
|
83
|
+
|
79
84
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
80
85
|
|
81
86
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
@@ -58,6 +58,11 @@ module Datadog
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
+
# Tag original global service name if not used
|
62
|
+
if span.service != Datadog.configuration.service
|
63
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
64
|
+
end
|
65
|
+
|
61
66
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
62
67
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)
|
63
68
|
|
@@ -58,6 +58,11 @@ module Datadog
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
+
# Tag original global service name if not used
|
62
|
+
if span.service != Datadog.configuration.service
|
63
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
64
|
+
end
|
65
|
+
|
61
66
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
62
67
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)
|
63
68
|
|
@@ -11,6 +11,7 @@ module Datadog
|
|
11
11
|
# `MongoCommandSubscriber` listens to all events from the `Monitoring`
|
12
12
|
# system available in the Mongo driver.
|
13
13
|
class MongoCommandSubscriber
|
14
|
+
# rubocop:disable Metrics/AbcSize
|
14
15
|
def started(event)
|
15
16
|
return unless Tracing.enabled?
|
16
17
|
|
@@ -36,6 +37,11 @@ module Datadog
|
|
36
37
|
)
|
37
38
|
end
|
38
39
|
|
40
|
+
# Tag original global service name if not used
|
41
|
+
if span.service != Datadog.configuration.service
|
42
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
43
|
+
end
|
44
|
+
|
39
45
|
span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM)
|
40
46
|
|
41
47
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
@@ -63,6 +69,7 @@ module Datadog
|
|
63
69
|
# set the resource with the quantized query
|
64
70
|
span.resource = serialized_query
|
65
71
|
end
|
72
|
+
# rubocop:enable Metrics/AbcSize
|
66
73
|
|
67
74
|
def failed(event)
|
68
75
|
span = get_span(event)
|
@@ -33,6 +33,11 @@ module Datadog
|
|
33
33
|
)
|
34
34
|
end
|
35
35
|
|
36
|
+
# Tag original global service name if not used
|
37
|
+
if span.service != Datadog.configuration.service
|
38
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
39
|
+
end
|
40
|
+
|
36
41
|
span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM)
|
37
42
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
38
43
|
|
@@ -48,12 +53,17 @@ module Datadog
|
|
48
53
|
span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_HOST, query_options[:host])
|
49
54
|
span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_PORT, query_options[:port])
|
50
55
|
|
56
|
+
Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
|
57
|
+
|
51
58
|
propagation_mode = Contrib::Propagation::SqlComment::Mode.new(comment_propagation)
|
52
59
|
|
53
60
|
Contrib::Propagation::SqlComment.annotate!(span, propagation_mode)
|
54
|
-
sql = Contrib::Propagation::SqlComment.prepend_comment(
|
55
|
-
|
56
|
-
|
61
|
+
sql = Contrib::Propagation::SqlComment.prepend_comment(
|
62
|
+
sql,
|
63
|
+
span,
|
64
|
+
trace_op,
|
65
|
+
propagation_mode
|
66
|
+
)
|
57
67
|
|
58
68
|
super(sql, options)
|
59
69
|
end
|
@@ -18,8 +18,8 @@ module Datadog
|
|
18
18
|
register_as :opensearch, auto_patch: true
|
19
19
|
|
20
20
|
def self.version
|
21
|
-
Gem.loaded_specs['opensearch-
|
22
|
-
&& Gem.loaded_specs['opensearch-
|
21
|
+
Gem.loaded_specs['opensearch-ruby'] \
|
22
|
+
&& Gem.loaded_specs['opensearch-ruby'].version
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.loaded?
|
@@ -28,6 +28,7 @@ module Datadog
|
|
28
28
|
# Patches OpenSearch::Transport::Client module
|
29
29
|
module Client
|
30
30
|
# rubocop:disable Metrics/MethodLength
|
31
|
+
# rubocop:disable Metrics/AbcSize
|
31
32
|
def perform_request(method, path, params = {}, body = nil, headers = nil)
|
32
33
|
response = nil
|
33
34
|
# rubocop:disable Metrics/BlockLength
|
@@ -61,6 +62,11 @@ module Datadog
|
|
61
62
|
)
|
62
63
|
end
|
63
64
|
|
65
|
+
# Tag original global service name if not used
|
66
|
+
if span.service != Datadog.configuration.service
|
67
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
68
|
+
end
|
69
|
+
|
64
70
|
# Set url tags
|
65
71
|
span.set_tag(OpenSearch::Ext::TAG_URL, url)
|
66
72
|
span.set_tag(OpenSearch::Ext::TAG_HOST, host)
|
@@ -94,6 +100,7 @@ module Datadog
|
|
94
100
|
end
|
95
101
|
end
|
96
102
|
# rubocop:enable Metrics/BlockLength
|
103
|
+
# rubocop:enable Metrics/AbcSize
|
97
104
|
response
|
98
105
|
end
|
99
106
|
|
@@ -129,6 +129,11 @@ module Datadog
|
|
129
129
|
)
|
130
130
|
end
|
131
131
|
|
132
|
+
# Tag original global service name if not used
|
133
|
+
if span.service != Datadog.configuration.service
|
134
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
135
|
+
end
|
136
|
+
|
132
137
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
133
138
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_QUERY)
|
134
139
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
@@ -90,6 +90,11 @@ module Datadog
|
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
93
|
+
# Tag original global service name if not used
|
94
|
+
if span.service != Datadog.configuration.service
|
95
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
96
|
+
end
|
97
|
+
|
93
98
|
if (host_port = @options[:server])
|
94
99
|
host, port = Core::Utils.extract_host_port(host_port)
|
95
100
|
if host && port
|
@@ -21,7 +21,7 @@ module Datadog
|
|
21
21
|
return sql unless mode.enabled?
|
22
22
|
|
23
23
|
tags = {
|
24
|
-
Ext::KEY_DATABASE_SERVICE => span_op.service,
|
24
|
+
Ext::KEY_DATABASE_SERVICE => span_op.get_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE) || span_op.service,
|
25
25
|
Ext::KEY_ENVIRONMENT => datadog_configuration.env,
|
26
26
|
Ext::KEY_PARENT_SERVICE => datadog_configuration.service,
|
27
27
|
Ext::KEY_VERSION => datadog_configuration.version
|
@@ -48,6 +48,11 @@ module Datadog
|
|
48
48
|
# Measure service stats
|
49
49
|
Contrib::Analytics.set_measured(span)
|
50
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
|
+
|
51
56
|
span.set_tag(Ext::TAG_TOPIC, payload[:topic])
|
52
57
|
span.set_tag(Ext::TAG_CONSUMER, payload[:consumer_class])
|
53
58
|
span.set_tag(Ext::TAG_PARTITION, payload[:partition])
|
@@ -37,10 +37,20 @@ module Datadog
|
|
37
37
|
whitelist = configuration[:headers][:response] || []
|
38
38
|
whitelist.each_with_object({}) do |header, result|
|
39
39
|
header_value = headers[header]
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
|
41
|
+
next if header_value.nil?
|
42
|
+
|
43
|
+
header_tag = Tracing::Metadata::Ext::HTTP::ResponseHeaders.to_tag(header)
|
44
|
+
|
45
|
+
# Maintain the value format between Rack 2 and 3
|
46
|
+
#
|
47
|
+
# Rack 2.x => { 'foo' => 'bar,baz' }
|
48
|
+
# Rack 3.x => { 'foo' => ['bar', 'baz'] }
|
49
|
+
result[header_tag] = if header_value.is_a? Array
|
50
|
+
header_value.join(',')
|
51
|
+
else
|
52
|
+
header_value
|
53
|
+
end
|
44
54
|
end
|
45
55
|
end
|
46
56
|
|
@@ -32,7 +32,7 @@ module Datadog
|
|
32
32
|
option :analytics_enabled do |o|
|
33
33
|
o.type :bool, nilable: true
|
34
34
|
o.env Ext::ENV_ANALYTICS_ENABLED
|
35
|
-
o.
|
35
|
+
o.after_set do |value|
|
36
36
|
# Update ActionPack analytics too
|
37
37
|
Datadog.configuration.tracing[:action_pack][:analytics_enabled] = value
|
38
38
|
end
|
@@ -42,7 +42,7 @@ module Datadog
|
|
42
42
|
o.type :float
|
43
43
|
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
44
44
|
o.default 1.0
|
45
|
-
o.
|
45
|
+
o.after_set do |value|
|
46
46
|
# Update ActionPack analytics too
|
47
47
|
Datadog.configuration.tracing[:action_pack][:analytics_sample_rate] = value
|
48
48
|
end
|
@@ -55,7 +55,7 @@ module Datadog
|
|
55
55
|
end
|
56
56
|
# DEV-2.0: Breaking changes for removal.
|
57
57
|
option :exception_controller do |o|
|
58
|
-
o.
|
58
|
+
o.after_set do |value|
|
59
59
|
if value
|
60
60
|
Datadog::Core.log_deprecation do
|
61
61
|
'The error controller is now automatically detected. '\
|
@@ -70,7 +70,7 @@ module Datadog
|
|
70
70
|
option :template_base_path do |o|
|
71
71
|
o.type :string
|
72
72
|
o.default 'views/'
|
73
|
-
o.
|
73
|
+
o.after_set do |value|
|
74
74
|
# Update ActionView template base path too
|
75
75
|
Datadog.configuration.tracing[:action_view][:template_base_path] = value
|
76
76
|
end
|
@@ -41,7 +41,7 @@ module Datadog
|
|
41
41
|
option :tasks do |o|
|
42
42
|
o.type :array
|
43
43
|
o.default []
|
44
|
-
o.
|
44
|
+
o.after_set do |value|
|
45
45
|
# DEV: It should be possible to modify the value after it's set. E.g. for normalization.
|
46
46
|
options[:tasks].instance_variable_set(:@value, value.map(&:to_s).to_set)
|
47
47
|
end
|
@@ -20,6 +20,11 @@ module Datadog
|
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
23
|
+
# Tag original global service name if not used
|
24
|
+
if span.service != Datadog.configuration.service
|
25
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
26
|
+
end
|
27
|
+
|
23
28
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
24
29
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_COMMAND)
|
25
30
|
|
@@ -41,6 +41,11 @@ module Datadog
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
+
# Tag original global service name if not used
|
45
|
+
if span.service != Datadog.configuration.service
|
46
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
47
|
+
end
|
48
|
+
|
44
49
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
45
50
|
|
46
51
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
@@ -49,6 +49,11 @@ module Datadog
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def set_common_tags(span, db)
|
52
|
+
# Tag original global service name if not used
|
53
|
+
if span.service != Datadog.configuration.service
|
54
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service)
|
55
|
+
end
|
56
|
+
|
52
57
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
53
58
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_QUERY)
|
54
59
|
|
@@ -33,7 +33,7 @@ module Datadog
|
|
33
33
|
option :service_name
|
34
34
|
option :error_handler do |o|
|
35
35
|
o.type :proc
|
36
|
-
o.
|
36
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
37
37
|
end
|
38
38
|
option :tag_body, default: false, type: :bool
|
39
39
|
end
|
@@ -40,7 +40,7 @@ module Datadog
|
|
40
40
|
option :client_service_name
|
41
41
|
option :error_handler do |o|
|
42
42
|
o.type :proc
|
43
|
-
o.
|
43
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
44
44
|
end
|
45
45
|
option :quantize, default: {}, type: :hash
|
46
46
|
option :distributed_tracing, default: false, type: :bool
|
@@ -31,7 +31,7 @@ module Datadog
|
|
31
31
|
option :service_name
|
32
32
|
option :error_handler do |o|
|
33
33
|
o.type :proc
|
34
|
-
o.
|
34
|
+
o.default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
35
35
|
end
|
36
36
|
option :tag_body, default: false, type: :bool
|
37
37
|
end
|
@@ -160,11 +160,11 @@ module Datadog
|
|
160
160
|
(?:"|%22) # closing '"' at end of value
|
161
161
|
)
|
162
162
|
|(?: # other common secret values
|
163
|
-
bearer(?:\s|%20)+[a-z0-9._
|
163
|
+
bearer(?:\s|%20)+[a-z0-9._-]+
|
164
164
|
|token(?::|%3A)[a-z0-9]{13}
|
165
165
|
|gh[opsu]_[0-9a-zA-Z]{36}
|
166
166
|
|ey[I-L](?:[\w=-]|%3D)+\.ey[I-L](?:[\w=-]|%3D)+(?:\.(?:[\w.+/=-]|%3D|%2F|%2B)+)?
|
167
|
-
|-{5}BEGIN(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY-{5}[
|
167
|
+
|-{5}BEGIN(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY-{5}[^-]+-{5}END(?:[a-z\s]|%20)+PRIVATE(?:\s|%20)KEY(?:-{5})?(?:\n|%0A)?
|
168
168
|
|(?:ssh-(?:rsa|dss)|ecdsa-[a-z0-9]+-[a-z0-9]+)(?:\s|%20)*(?:[a-z0-9/.+]|%2F|%5C|%2B){100,}(?:=|%3D)*(?:(?:\s+)[a-z0-9._-]+)?
|
169
169
|
)
|
170
170
|
}ix.freeze
|
@@ -18,6 +18,12 @@ module Datadog
|
|
18
18
|
# @param propagation_styles [Hash<String,Object>]
|
19
19
|
def initialize(propagation_styles:)
|
20
20
|
@propagation_styles = propagation_styles
|
21
|
+
# We need to make sure propagation_style option is evaluated.
|
22
|
+
# Our options are lazy evaluated and it happens that propagation_style has the after_set callback
|
23
|
+
# that affect Datadog.configuration.tracing.distributed_tracing.propagation_inject_style and
|
24
|
+
# Datadog.configuration.tracing.distributed_tracing.propagation_extract_style
|
25
|
+
# By calling it here, we make sure if the customers has set any value either via code or ENV variable is applied.
|
26
|
+
::Datadog.configuration.tracing.distributed_tracing.propagation_style
|
21
27
|
end
|
22
28
|
|
23
29
|
# inject! populates the env with span ID, trace ID and sampling priority
|
@@ -72,8 +78,10 @@ module Datadog
|
|
72
78
|
#
|
73
79
|
# @param data [Hash]
|
74
80
|
def extract(data)
|
75
|
-
|
76
|
-
|
81
|
+
return unless data
|
82
|
+
return if data.empty?
|
83
|
+
|
84
|
+
extracted_trace_digest = nil
|
77
85
|
|
78
86
|
::Datadog.configuration.tracing.distributed_tracing.propagation_extract_style.each do |style|
|
79
87
|
propagator = @propagation_styles[style]
|
@@ -83,42 +91,14 @@ module Datadog
|
|
83
91
|
extracted_trace_digest = propagator.extract(data)
|
84
92
|
rescue => e
|
85
93
|
::Datadog.logger.error(
|
86
|
-
|
87
|
-
"Cause: #{e} Location: #{Array(e.backtrace).first}"
|
94
|
+
"Error extracting distributed trace data. Cause: #{e} Location: #{Array(e.backtrace).first}"
|
88
95
|
)
|
89
96
|
end
|
90
97
|
|
91
|
-
|
92
|
-
next if extracted_trace_digest.nil?
|
93
|
-
|
94
|
-
# Keep track of the Datadog extracted digest, we want to return it if we have it.
|
95
|
-
if extracted_trace_digest && style == Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG
|
96
|
-
dd_trace_digest = extracted_trace_digest
|
97
|
-
end
|
98
|
-
|
99
|
-
# No previously extracted trace data, use the one we just extracted
|
100
|
-
if trace_digest.nil?
|
101
|
-
trace_digest = extracted_trace_digest
|
102
|
-
else
|
103
|
-
unless trace_digest.trace_id == extracted_trace_digest.trace_id \
|
104
|
-
&& trace_digest.span_id == extracted_trace_digest.span_id
|
105
|
-
# We have two mismatched propagation contexts
|
106
|
-
::Datadog.logger.debug do
|
107
|
-
'Cannot extract distributed trace data: extracted styles differ, ' \
|
108
|
-
"#{trace_digest.trace_id} != #{extracted_trace_digest.trace_id} && " \
|
109
|
-
"#{trace_digest.span_id} != #{extracted_trace_digest.span_id}"
|
110
|
-
end
|
111
|
-
|
112
|
-
# It's safer to create a new context than to attach ourselves to the wrong context
|
113
|
-
return TraceDigest.new # Early return from the whole method
|
114
|
-
end
|
115
|
-
end
|
98
|
+
break if extracted_trace_digest
|
116
99
|
end
|
117
100
|
|
118
|
-
|
119
|
-
# Always return the Datadog trace digest if one exists since it has more
|
120
|
-
# information than the B3 digest, e.g. origin, priority sampling values.
|
121
|
-
dd_trace_digest || trace_digest || nil
|
101
|
+
extracted_trace_digest
|
122
102
|
end
|
123
103
|
end
|
124
104
|
end
|
@@ -59,8 +59,8 @@ module Datadog
|
|
59
59
|
# A valid example is:
|
60
60
|
#
|
61
61
|
# span.set_tags({ "http.method" => "GET", "user.id" => "234" })
|
62
|
-
def set_tags(
|
63
|
-
|
62
|
+
def set_tags(hash)
|
63
|
+
hash.each { |k, v| set_tag(k, v) }
|
64
64
|
end
|
65
65
|
|
66
66
|
# Returns true if the provided `tag` was set to a non-nil value.
|
@@ -111,7 +111,7 @@ module Datadog
|
|
111
111
|
# Returns a copy of all metadata.
|
112
112
|
# Keys for `@meta` and `@metrics` don't collide, by construction.
|
113
113
|
def tags
|
114
|
-
|
114
|
+
meta.merge(metrics)
|
115
115
|
end
|
116
116
|
|
117
117
|
protected
|
@@ -4,7 +4,7 @@ require_relative 'pipeline'
|
|
4
4
|
require_relative 'runtime/metrics'
|
5
5
|
require_relative 'writer'
|
6
6
|
|
7
|
-
require_relative '
|
7
|
+
require_relative 'transport/http'
|
8
8
|
|
9
9
|
module Datadog
|
10
10
|
module Tracing
|
@@ -20,10 +20,10 @@ module Datadog
|
|
20
20
|
:events,
|
21
21
|
:transport
|
22
22
|
|
23
|
-
# @param [Datadog::Transport::Traces::Transport] transport a custom transport instance.
|
23
|
+
# @param [Datadog::Tracing::Transport::Traces::Transport] transport a custom transport instance.
|
24
24
|
# If provided, overrides `transport_options` and `agent_settings`.
|
25
25
|
# @param [Hash<Symbol,Object>] transport_options options for the default transport instance.
|
26
|
-
# @param [Datadog::
|
26
|
+
# @param [Datadog::Tracing::Configuration::AgentSettingsResolver::AgentSettings] agent_settings agent options for
|
27
27
|
# the default transport instance.
|
28
28
|
def initialize(transport: nil, transport_options: {}, agent_settings: nil)
|
29
29
|
@transport = transport || begin
|
@@ -353,6 +353,8 @@ module Datadog
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
+
# Creates a new TraceOperation, with events bounds to this Tracer instance.
|
357
|
+
# @return [TraceOperation]
|
356
358
|
def start_trace(continue_from: nil)
|
357
359
|
# Build a new trace using digest if provided.
|
358
360
|
trace = build_trace(continue_from)
|