ddtrace 1.12.1 → 1.13.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 +109 -9
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +97 -14
- data/ext/ddtrace_profiling_native_extension/extconf.rb +6 -0
- data/ext/ddtrace_profiling_native_extension/http_transport.c +19 -6
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +1 -1
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +41 -2
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +6 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +6 -10
- data/ext/ddtrace_profiling_native_extension/time_helpers.c +40 -4
- data/ext/ddtrace_profiling_native_extension/time_helpers.h +14 -0
- data/lib/datadog/appsec/component.rb +9 -0
- data/lib/datadog/appsec/configuration/settings.rb +104 -195
- data/lib/datadog/appsec/configuration.rb +0 -79
- data/lib/datadog/appsec/contrib/auto_instrument.rb +2 -4
- data/lib/datadog/appsec/contrib/devise/event.rb +57 -0
- data/lib/datadog/appsec/contrib/devise/ext.rb +13 -0
- data/lib/datadog/appsec/contrib/devise/integration.rb +42 -0
- data/lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb +76 -0
- data/lib/datadog/appsec/contrib/devise/patcher/registration_controller_patch.rb +52 -0
- data/lib/datadog/appsec/contrib/devise/patcher.rb +45 -0
- data/lib/datadog/appsec/contrib/devise/resource.rb +35 -0
- data/lib/datadog/appsec/contrib/devise/tracking.rb +49 -0
- data/lib/datadog/appsec/contrib/rack/ext.rb +2 -1
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +12 -7
- data/lib/datadog/appsec/contrib/rails/ext.rb +3 -2
- data/lib/datadog/appsec/contrib/rails/framework.rb +1 -3
- data/lib/datadog/appsec/contrib/rails/patcher.rb +8 -8
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +1 -1
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +2 -1
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +1 -3
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +1 -1
- data/lib/datadog/appsec/event.rb +1 -1
- data/lib/datadog/appsec/extensions.rb +1 -130
- data/lib/datadog/appsec/monitor/reactive/set_user.rb +1 -1
- data/lib/datadog/appsec/processor.rb +1 -1
- data/lib/datadog/appsec/rate_limiter.rb +1 -1
- data/lib/datadog/appsec/remote.rb +1 -1
- data/lib/datadog/appsec.rb +1 -2
- data/lib/datadog/ci/configuration/settings.rb +6 -8
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +7 -5
- data/lib/datadog/ci/contrib/cucumber/ext.rb +10 -8
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +35 -0
- data/lib/datadog/ci/contrib/minitest/ext.rb +21 -0
- data/lib/datadog/ci/contrib/minitest/integration.rb +49 -0
- data/lib/datadog/ci/contrib/minitest/patcher.rb +27 -0
- data/lib/datadog/ci/contrib/minitest/test_helper.rb +68 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +7 -5
- data/lib/datadog/ci/contrib/rspec/ext.rb +9 -7
- data/lib/datadog/ci.rb +1 -0
- data/lib/datadog/core/backport.rb +51 -0
- data/lib/datadog/core/configuration/base.rb +5 -5
- data/lib/datadog/core/configuration/components.rb +6 -1
- data/lib/datadog/core/configuration/ext.rb +7 -5
- data/lib/datadog/core/configuration/option.rb +269 -19
- data/lib/datadog/core/configuration/option_definition.rb +76 -11
- data/lib/datadog/core/configuration/options.rb +22 -10
- data/lib/datadog/core/configuration/settings.rb +116 -61
- data/lib/datadog/core/environment/ext.rb +13 -11
- data/lib/datadog/core/environment/yjit.rb +58 -0
- data/lib/datadog/core/git/ext.rb +24 -22
- data/lib/datadog/core/logging/ext.rb +3 -1
- data/lib/datadog/core/metrics/ext.rb +7 -5
- data/lib/datadog/core/remote/client/capabilities.rb +5 -0
- data/lib/datadog/core/remote/client.rb +3 -0
- data/lib/datadog/core/remote/component.rb +25 -34
- data/lib/datadog/core/remote/configuration/content.rb +28 -1
- data/lib/datadog/core/remote/configuration/repository.rb +3 -1
- data/lib/datadog/core/remote/ext.rb +1 -1
- data/lib/datadog/core/remote/negotiation.rb +17 -4
- data/lib/datadog/core/runtime/ext.rb +22 -12
- data/lib/datadog/core/runtime/metrics.rb +43 -0
- data/lib/datadog/core/telemetry/client.rb +12 -2
- data/lib/datadog/core/telemetry/emitter.rb +4 -2
- data/lib/datadog/core/telemetry/event.rb +19 -4
- data/lib/datadog/core/telemetry/ext.rb +4 -1
- data/lib/datadog/core/telemetry/heartbeat.rb +2 -4
- data/lib/datadog/core/telemetry/http/ext.rb +10 -8
- data/lib/datadog/core/telemetry/http/transport.rb +1 -0
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +41 -0
- data/lib/datadog/core/telemetry/v2/request.rb +29 -0
- data/lib/datadog/core/transport/http/client.rb +1 -1
- data/lib/datadog/core/transport/http/config.rb +10 -0
- data/lib/datadog/core/utils/duration.rb +52 -0
- data/lib/datadog/core/utils/hash.rb +47 -0
- data/lib/datadog/core/utils/network.rb +1 -1
- data/lib/datadog/core/utils/safe_dup.rb +27 -20
- data/lib/datadog/core/utils.rb +1 -1
- data/lib/datadog/core/workers/async.rb +2 -2
- data/lib/datadog/kit/appsec/events.rb +139 -89
- data/lib/datadog/kit/identity.rb +80 -65
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +3 -0
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -0
- data/lib/datadog/profiling/collectors/thread_context.rb +9 -2
- data/lib/datadog/profiling/component.rb +41 -9
- data/lib/datadog/profiling/exporter.rb +5 -1
- data/lib/datadog/profiling/flush.rb +9 -2
- data/lib/datadog/profiling/http_transport.rb +4 -1
- data/lib/datadog/profiling/load_native_extension.rb +7 -1
- data/lib/datadog/profiling.rb +11 -1
- data/lib/datadog/tracing/component.rb +58 -6
- data/lib/datadog/tracing/configuration/dynamic/option.rb +71 -0
- data/lib/datadog/tracing/configuration/dynamic.rb +64 -0
- data/lib/datadog/tracing/configuration/ext.rb +35 -32
- data/lib/datadog/tracing/configuration/http.rb +74 -0
- data/lib/datadog/tracing/configuration/settings.rb +106 -92
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/action_cable/ext.rb +20 -18
- data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/action_mailer/ext.rb +20 -18
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +8 -6
- data/lib/datadog/tracing/contrib/action_pack/ext.rb +10 -8
- data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/action_view/ext.rb +12 -10
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +13 -7
- data/lib/datadog/tracing/contrib/active_job/ext.rb +25 -23
- data/lib/datadog/tracing/contrib/active_job/log_injection.rb +1 -1
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +12 -10
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +9 -7
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +0 -8
- data/lib/datadog/tracing/contrib/active_record/ext.rb +17 -15
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +0 -5
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +9 -7
- data/lib/datadog/tracing/contrib/active_support/ext.rb +18 -16
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/aws/ext.rb +37 -24
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +4 -2
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/dalli/ext.rb +19 -11
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +8 -6
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +13 -7
- data/lib/datadog/tracing/contrib/delayed_job/ext.rb +16 -14
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +21 -15
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +8 -5
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +16 -9
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +43 -3
- data/lib/datadog/tracing/contrib/ethon/ext.rb +19 -11
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +0 -5
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +19 -10
- data/lib/datadog/tracing/contrib/excon/ext.rb +16 -8
- data/lib/datadog/tracing/contrib/excon/middleware.rb +20 -5
- data/lib/datadog/tracing/contrib/ext.rb +23 -1
- data/lib/datadog/tracing/contrib/extensions.rb +32 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +20 -10
- data/lib/datadog/tracing/contrib/faraday/ext.rb +16 -8
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +16 -5
- data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +8 -6
- data/lib/datadog/tracing/contrib/grape/ext.rb +16 -14
- data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +8 -6
- data/lib/datadog/tracing/contrib/graphql/ext.rb +7 -5
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +19 -9
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +29 -20
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +21 -20
- data/lib/datadog/tracing/contrib/grpc/ext.rb +16 -13
- data/lib/datadog/tracing/contrib/grpc/formatting.rb +127 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/hanami/ext.rb +10 -8
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +4 -7
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +33 -11
- data/lib/datadog/tracing/contrib/http/ext.rb +16 -9
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +17 -5
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +33 -11
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +17 -9
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +17 -5
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +33 -11
- data/lib/datadog/tracing/contrib/httprb/ext.rb +16 -9
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +17 -5
- data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/kafka/ext.rb +42 -39
- data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/lograge/ext.rb +3 -1
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +1 -0
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +20 -16
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +9 -5
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +17 -14
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +15 -10
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +52 -0
- data/lib/datadog/tracing/contrib/opensearch/ext.rb +37 -0
- data/lib/datadog/tracing/contrib/opensearch/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +128 -0
- data/lib/datadog/tracing/contrib/opensearch/quantize.rb +81 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +17 -14
- data/lib/datadog/tracing/contrib/pg/ext.rb +22 -19
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/presto/ext.rb +25 -20
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +12 -10
- data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +12 -8
- data/lib/datadog/tracing/contrib/qless/ext.rb +14 -12
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +21 -12
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +9 -7
- data/lib/datadog/tracing/contrib/racecar/event.rb +0 -5
- data/lib/datadog/tracing/contrib/racecar/ext.rb +20 -18
- data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +16 -12
- data/lib/datadog/tracing/contrib/rack/ext.rb +18 -16
- data/lib/datadog/tracing/contrib/rack/header_collection.rb +3 -0
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +53 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +8 -49
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +15 -11
- data/lib/datadog/tracing/contrib/rails/ext.rb +7 -5
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +4 -10
- data/lib/datadog/tracing/contrib/rails/patcher.rb +10 -41
- data/lib/datadog/tracing/contrib/rails/railtie.rb +3 -3
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +12 -9
- data/lib/datadog/tracing/contrib/rake/ext.rb +14 -12
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +17 -9
- data/lib/datadog/tracing/contrib/redis/ext.rb +22 -15
- data/lib/datadog/tracing/contrib/redis/tags.rb +9 -5
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +13 -7
- data/lib/datadog/tracing/contrib/resque/ext.rb +9 -7
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +16 -9
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +15 -8
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +20 -5
- data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +3 -1
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +1 -0
- data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/sequel/ext.rb +10 -8
- data/lib/datadog/tracing/contrib/sequel/utils.rb +2 -7
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +14 -8
- data/lib/datadog/tracing/contrib/shoryuken/ext.rb +14 -12
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +18 -11
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +32 -30
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +11 -9
- data/lib/datadog/tracing/contrib/sinatra/env.rb +0 -17
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +21 -19
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +3 -14
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +14 -8
- data/lib/datadog/tracing/contrib/sneakers/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/span_attribute_schema.rb +74 -10
- data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +15 -13
- data/lib/datadog/tracing/contrib/utils/database.rb +5 -3
- data/lib/datadog/tracing/correlation.rb +9 -12
- data/lib/datadog/tracing/diagnostics/ext.rb +21 -19
- data/lib/datadog/tracing/distributed/b3_multi.rb +2 -2
- data/lib/datadog/tracing/distributed/b3_single.rb +1 -1
- data/lib/datadog/tracing/distributed/trace_context.rb +52 -17
- data/lib/datadog/tracing/metadata/ext.rb +9 -6
- data/lib/datadog/tracing/remote.rb +78 -0
- data/lib/datadog/tracing/sampling/rule_sampler.rb +29 -0
- data/lib/datadog/tracing/span_operation.rb +3 -15
- data/lib/datadog/tracing/trace_operation.rb +16 -3
- data/lib/datadog/tracing/trace_segment.rb +5 -2
- data/lib/datadog/tracing/tracer.rb +10 -1
- data/lib/ddtrace/transport/ext.rb +15 -9
- data/lib/ddtrace/transport/trace_formatter.rb +9 -0
- data/lib/ddtrace/version.rb +9 -12
- metadata +38 -10
- data/lib/datadog/tracing/contrib/sinatra/headers.rb +0 -35
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Tracing
|
5
|
+
module Configuration
|
6
|
+
module HTTP
|
7
|
+
# Datadog tracing supports capturing HTTP request and response headers as span tags.
|
8
|
+
#
|
9
|
+
# The provided configuration String for this feature has to be pre-processed to
|
10
|
+
# allow for ease of utilization by each HTTP integration.
|
11
|
+
#
|
12
|
+
# This class process configuration, stores the result, and provides methods to
|
13
|
+
# utilize this configuration.
|
14
|
+
class HeaderTags
|
15
|
+
# @param header_tags [Array<String>] The list of strings from DD_TRACE_HEADER_TAGS.
|
16
|
+
def initialize(header_tags)
|
17
|
+
@request_headers = {}
|
18
|
+
@response_headers = {}
|
19
|
+
@header_tags = header_tags
|
20
|
+
|
21
|
+
@header_tags.each do |header_tag|
|
22
|
+
header, tag = header_tag.split(':', 2)
|
23
|
+
|
24
|
+
next unless header # Empty string guard
|
25
|
+
|
26
|
+
if tag && !tag.empty?
|
27
|
+
# When a custom tag name is provided, use that name for both
|
28
|
+
# request and response tags.
|
29
|
+
normalized_tag = Tracing::Metadata::Ext::HTTP::Headers.to_tag(tag, allow_nested: true)
|
30
|
+
request = response = normalized_tag
|
31
|
+
else
|
32
|
+
# Otherwise, use our internal pattern of
|
33
|
+
# "http.{request|response}.headers.{header}" as tag name.
|
34
|
+
request = Tracing::Metadata::Ext::HTTP::RequestHeaders.to_tag(header)
|
35
|
+
response = Tracing::Metadata::Ext::HTTP::ResponseHeaders.to_tag(header)
|
36
|
+
end
|
37
|
+
|
38
|
+
@request_headers[header] = request
|
39
|
+
@response_headers[header] = response
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Receives a case insensitive hash with the request headers and returns
|
44
|
+
# a list of tag names and values that can be set in a span.
|
45
|
+
def request_tags(headers)
|
46
|
+
@request_headers.map do |header_name, span_tag|
|
47
|
+
# Case-insensitive search
|
48
|
+
header_value = headers[header_name]
|
49
|
+
|
50
|
+
[span_tag, header_value] if header_value
|
51
|
+
end.compact
|
52
|
+
end
|
53
|
+
|
54
|
+
# Receives a case insensitive hash with the response headers and returns
|
55
|
+
# a list of tag names and values that can be set in a span.
|
56
|
+
def response_tags(headers)
|
57
|
+
@response_headers.map do |header_name, span_tag|
|
58
|
+
# Case-insensitive search
|
59
|
+
header_value = headers[header_name]
|
60
|
+
|
61
|
+
[span_tag, header_value] if header_value
|
62
|
+
end.compact
|
63
|
+
end
|
64
|
+
|
65
|
+
# For easy configuration inspection,
|
66
|
+
# print the original configuration setting.
|
67
|
+
def to_s
|
68
|
+
@header_tags.join(',').to_s
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../../tracing/configuration/ext'
|
2
|
+
require_relative 'http'
|
2
3
|
|
3
4
|
module Datadog
|
4
5
|
module Tracing
|
@@ -26,8 +27,8 @@ module Datadog
|
|
26
27
|
# @default `DD_TRACE_ANALYTICS_ENABLED` environment variable, otherwise `nil`
|
27
28
|
# @return [Boolean,nil]
|
28
29
|
option :enabled do |o|
|
29
|
-
o.
|
30
|
-
o.
|
30
|
+
o.type :bool, nilable: true
|
31
|
+
o.env Tracing::Configuration::Ext::Analytics::ENV_TRACE_ANALYTICS_ENABLED
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -51,23 +52,18 @@ module Datadog
|
|
51
52
|
# otherwise `['Datadog','b3multi','b3']`.
|
52
53
|
# @return [Array<String>]
|
53
54
|
option :propagation_extract_style do |o|
|
54
|
-
o.
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
],
|
67
|
-
comma_separated_only: true
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
55
|
+
o.type :array
|
56
|
+
o.deprecated_env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT_OLD
|
57
|
+
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT
|
58
|
+
# DEV-2.0: Change default value to `tracecontext, Datadog`.
|
59
|
+
# Look for all headers by default
|
60
|
+
o.default(
|
61
|
+
[
|
62
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
|
63
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER,
|
64
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER,
|
65
|
+
]
|
66
|
+
)
|
71
67
|
o.on_set do |styles|
|
72
68
|
# Modernize B3 options
|
73
69
|
# DEV-2.0: Can be removed with the removal of deprecated B3 constants.
|
@@ -82,8 +78,6 @@ module Datadog
|
|
82
78
|
end
|
83
79
|
end
|
84
80
|
end
|
85
|
-
|
86
|
-
o.lazy
|
87
81
|
end
|
88
82
|
|
89
83
|
# The data propagation styles the tracer will use to inject distributed tracing propagation
|
@@ -94,18 +88,11 @@ module Datadog
|
|
94
88
|
# @default `DD_TRACE_PROPAGATION_STYLE_INJECT` environment variable (comma-separated list), otherwise `['Datadog']`.
|
95
89
|
# @return [Array<String>]
|
96
90
|
option :propagation_inject_style do |o|
|
97
|
-
o.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT_OLD
|
103
|
-
],
|
104
|
-
[Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG],
|
105
|
-
comma_separated_only: true # Only inject Datadog headers by default
|
106
|
-
)
|
107
|
-
end
|
108
|
-
|
91
|
+
o.type :array
|
92
|
+
o.deprecated_env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT_OLD
|
93
|
+
o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT
|
94
|
+
# DEV-2.0: Change default value to `tracecontext, Datadog`.
|
95
|
+
o.default [Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG]
|
109
96
|
o.on_set do |styles|
|
110
97
|
# Modernize B3 options
|
111
98
|
# DEV-2.0: Can be removed with the removal of deprecated B3 constants.
|
@@ -120,8 +107,6 @@ module Datadog
|
|
120
107
|
end
|
121
108
|
end
|
122
109
|
end
|
123
|
-
|
124
|
-
o.lazy
|
125
110
|
end
|
126
111
|
|
127
112
|
# An ordered list of what data propagation styles the tracer will use to extract distributed tracing propagation
|
@@ -133,12 +118,11 @@ module Datadog
|
|
133
118
|
# @default `DD_TRACE_PROPAGATION_STYLE` environment variable (comma-separated list).
|
134
119
|
# @return [Array<String>]
|
135
120
|
option :propagation_style do |o|
|
136
|
-
o.
|
137
|
-
|
138
|
-
|
139
|
-
|
121
|
+
o.type :array
|
122
|
+
o.env Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE
|
123
|
+
o.default []
|
140
124
|
o.on_set do |styles|
|
141
|
-
next
|
125
|
+
next if styles.empty?
|
142
126
|
|
143
127
|
# Modernize B3 options
|
144
128
|
# DEV-2.0: Can be removed with the removal of deprecated B3 constants.
|
@@ -156,8 +140,6 @@ module Datadog
|
|
156
140
|
set_option(:propagation_extract_style, styles)
|
157
141
|
set_option(:propagation_inject_style, styles)
|
158
142
|
end
|
159
|
-
|
160
|
-
o.lazy
|
161
143
|
end
|
162
144
|
end
|
163
145
|
|
@@ -169,8 +151,27 @@ module Datadog
|
|
169
151
|
# @default `DD_TRACE_ENABLED` environment variable, otherwise `true`
|
170
152
|
# @return [Boolean]
|
171
153
|
option :enabled do |o|
|
172
|
-
o.
|
173
|
-
o.
|
154
|
+
o.env Tracing::Configuration::Ext::ENV_ENABLED
|
155
|
+
o.default true
|
156
|
+
o.type :bool
|
157
|
+
end
|
158
|
+
|
159
|
+
# Comma-separated, case-insensitive list of header names that are reported in incoming and outgoing HTTP requests.
|
160
|
+
#
|
161
|
+
# Each header in the list can either be:
|
162
|
+
# * A header name, which is mapped to the respective tags `http.request.headers.<header name>` and `http.response.headers.<header name>`.
|
163
|
+
# * A key value pair, "header name:tag name", which is mapped to the span tag `tag name`.
|
164
|
+
#
|
165
|
+
# You can mix the two types of header declaration in the same list.
|
166
|
+
# Tag names will be normalized based on the [Datadog tag normalization rules](https://docs.datadoghq.com/getting_started/tagging/#defining-tags).
|
167
|
+
#
|
168
|
+
# @default `DD_TRACE_HEADER_TAGS` environment variable, otherwise an empty set of tags
|
169
|
+
# @return [Array<String>]
|
170
|
+
option :header_tags do |o|
|
171
|
+
o.env Configuration::Ext::ENV_HEADER_TAGS
|
172
|
+
o.type :array
|
173
|
+
o.default []
|
174
|
+
o.setter { |header_tags, _| Configuration::HTTP::HeaderTags.new(header_tags) }
|
174
175
|
end
|
175
176
|
|
176
177
|
# Enable 128 bit trace id generation.
|
@@ -178,8 +179,9 @@ module Datadog
|
|
178
179
|
# @default `DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED` environment variable, otherwise `false`
|
179
180
|
# @return [Boolean]
|
180
181
|
option :trace_id_128_bit_generation_enabled do |o|
|
181
|
-
o.
|
182
|
-
o.
|
182
|
+
o.env Tracing::Configuration::Ext::ENV_TRACE_ID_128_BIT_GENERATION_ENABLED
|
183
|
+
o.default false
|
184
|
+
o.type :bool
|
183
185
|
end
|
184
186
|
|
185
187
|
# Enable 128 bit trace id injected for logging.
|
@@ -189,8 +191,9 @@ module Datadog
|
|
189
191
|
#
|
190
192
|
# It is not supported by our backend yet. Do not enable it.
|
191
193
|
option :trace_id_128_bit_logging_enabled do |o|
|
192
|
-
o.
|
193
|
-
o.
|
194
|
+
o.env Tracing::Configuration::Ext::Correlation::ENV_TRACE_ID_128_BIT_LOGGING_ENABLED
|
195
|
+
o.default false
|
196
|
+
o.type :bool
|
194
197
|
end
|
195
198
|
|
196
199
|
# A custom tracer instance.
|
@@ -211,8 +214,9 @@ module Datadog
|
|
211
214
|
# @see https://docs.datadoghq.com/tracing/setup_overview/setup/ruby/#trace-correlation
|
212
215
|
# @return [Boolean]
|
213
216
|
option :log_injection do |o|
|
214
|
-
o.
|
215
|
-
o.
|
217
|
+
o.env Tracing::Configuration::Ext::Correlation::ENV_LOGS_INJECTION_ENABLED
|
218
|
+
o.default true
|
219
|
+
o.type :bool
|
216
220
|
end
|
217
221
|
|
218
222
|
# Configures an alternative trace transport behavior, where
|
@@ -229,7 +233,7 @@ module Datadog
|
|
229
233
|
#
|
230
234
|
# @default `false`
|
231
235
|
# @return [Boolean]
|
232
|
-
option :enabled, default: false
|
236
|
+
option :enabled, default: false, type: :bool
|
233
237
|
|
234
238
|
# Minimum number of finished spans required in a single unfinished trace before
|
235
239
|
# the tracer will consider that trace for partial flushing.
|
@@ -242,7 +246,7 @@ module Datadog
|
|
242
246
|
#
|
243
247
|
# @default 500
|
244
248
|
# @return [Integer]
|
245
|
-
option :min_spans_threshold, default: 500
|
249
|
+
option :min_spans_threshold, default: 500, type: :int
|
246
250
|
end
|
247
251
|
|
248
252
|
# Enables {https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/#datadog-intelligent-retention-filter
|
@@ -252,8 +256,9 @@ module Datadog
|
|
252
256
|
option :priority_sampling
|
253
257
|
|
254
258
|
option :report_hostname do |o|
|
255
|
-
o.
|
256
|
-
o.
|
259
|
+
o.env Tracing::Configuration::Ext::NET::ENV_REPORT_HOSTNAME
|
260
|
+
o.default false
|
261
|
+
o.type :bool
|
257
262
|
end
|
258
263
|
|
259
264
|
# A custom sampler instance.
|
@@ -273,10 +278,10 @@ module Datadog
|
|
273
278
|
# for resources not seen recently).
|
274
279
|
#
|
275
280
|
# @default `DD_TRACE_SAMPLE_RATE` environment variable, otherwise `nil`.
|
276
|
-
# @return [Float,nil]
|
281
|
+
# @return [Float, nil]
|
277
282
|
option :default_rate do |o|
|
278
|
-
o.
|
279
|
-
o.
|
283
|
+
o.type :float, nilable: true
|
284
|
+
o.env Tracing::Configuration::Ext::Sampling::ENV_SAMPLE_RATE
|
280
285
|
end
|
281
286
|
|
282
287
|
# Rate limit for number of spans per second.
|
@@ -287,8 +292,25 @@ module Datadog
|
|
287
292
|
# @default `DD_TRACE_RATE_LIMIT` environment variable, otherwise 100.
|
288
293
|
# @return [Numeric,nil]
|
289
294
|
option :rate_limit do |o|
|
290
|
-
o.
|
291
|
-
o.
|
295
|
+
o.type :int, nilable: true
|
296
|
+
o.env Tracing::Configuration::Ext::Sampling::ENV_RATE_LIMIT
|
297
|
+
o.default 100
|
298
|
+
end
|
299
|
+
|
300
|
+
# Trace sampling rules.
|
301
|
+
# These rules control whether a trace is kept or dropped by the tracer.
|
302
|
+
#
|
303
|
+
# The `rules` format is a String with a JSON array of objects:
|
304
|
+
# Each object must have a `sample_rate`, and the `name` and `service` fields
|
305
|
+
# are optional. The `sample_rate` value must be between 0.0 and 1.0 (inclusive).
|
306
|
+
# `name` and `service` are Strings that allow the `sample_rate` to be applied only
|
307
|
+
# to traces matching the `name` and `service`.
|
308
|
+
#
|
309
|
+
# @default `DD_TRACE_SAMPLING_RULES` environment variable. Otherwise `nil`.
|
310
|
+
# @return [String,nil]
|
311
|
+
# @public_api
|
312
|
+
option :rules do |o|
|
313
|
+
o.default { ENV.fetch(Configuration::Ext::Sampling::ENV_RULES, nil) }
|
292
314
|
end
|
293
315
|
|
294
316
|
# Single span sampling rules.
|
@@ -303,6 +325,7 @@ module Datadog
|
|
303
325
|
# @return [String,nil]
|
304
326
|
# @public_api
|
305
327
|
option :span_rules do |o|
|
328
|
+
o.type :string, nilable: true
|
306
329
|
o.default do
|
307
330
|
rules = ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES]
|
308
331
|
rules_file = ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES_FILE]
|
@@ -330,7 +353,6 @@ module Datadog
|
|
330
353
|
end
|
331
354
|
end
|
332
355
|
end
|
333
|
-
o.lazy
|
334
356
|
end
|
335
357
|
end
|
336
358
|
|
@@ -344,18 +366,16 @@ module Datadog
|
|
344
366
|
# @default `DD_TRACE_TEST_MODE_ENABLED` environment variable, otherwise `false`
|
345
367
|
# @return [Boolean]
|
346
368
|
option :enabled do |o|
|
347
|
-
o.
|
348
|
-
o.
|
369
|
+
o.type :bool
|
370
|
+
o.default false
|
371
|
+
o.env Tracing::Configuration::Ext::Test::ENV_MODE_ENABLED
|
349
372
|
end
|
350
373
|
|
351
|
-
option :trace_flush
|
352
|
-
o.default { nil }
|
353
|
-
o.lazy
|
354
|
-
end
|
374
|
+
option :trace_flush
|
355
375
|
|
356
376
|
option :writer_options do |o|
|
357
|
-
o.
|
358
|
-
o.
|
377
|
+
o.type :hash
|
378
|
+
o.default({})
|
359
379
|
end
|
360
380
|
end
|
361
381
|
|
@@ -366,8 +386,10 @@ module Datadog
|
|
366
386
|
# @yieldparam [Datadog::Transport::HTTP] t transport to be configured.
|
367
387
|
# @default `nil`
|
368
388
|
# @return [Proc,nil]
|
369
|
-
option :transport_options
|
370
|
-
|
389
|
+
option :transport_options do |o|
|
390
|
+
o.type :proc, nilable: true
|
391
|
+
o.default nil
|
392
|
+
end
|
371
393
|
# A custom writer instance.
|
372
394
|
# The object must respect the {Datadog::Tracing::Writer} interface.
|
373
395
|
#
|
@@ -382,8 +404,11 @@ module Datadog
|
|
382
404
|
# This option is recommended for internal use only.
|
383
405
|
#
|
384
406
|
# @default `{}`
|
385
|
-
# @return [Hash
|
386
|
-
option :writer_options
|
407
|
+
# @return [Hash]
|
408
|
+
option :writer_options do |o|
|
409
|
+
o.type :hash
|
410
|
+
o.default({})
|
411
|
+
end
|
387
412
|
|
388
413
|
# Client IP configuration
|
389
414
|
# @public_api
|
@@ -398,13 +423,16 @@ module Datadog
|
|
398
423
|
# @default `DD_TRACE_CLIENT_IP_ENABLED` environment variable, otherwise `false`.
|
399
424
|
# @return [Boolean]
|
400
425
|
option :enabled do |o|
|
426
|
+
o.type :bool
|
401
427
|
o.default do
|
402
428
|
disabled = env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_DISABLED)
|
403
429
|
|
404
430
|
enabled = if disabled.nil?
|
405
431
|
false
|
406
432
|
else
|
407
|
-
Datadog.
|
433
|
+
Datadog::Core.log_deprecation do
|
434
|
+
"#{Tracing::Configuration::Ext::ClientIp::ENV_DISABLED} environment variable is deprecated, use #{Tracing::Configuration::Ext::ClientIp::ENV_ENABLED} instead."
|
435
|
+
end
|
408
436
|
|
409
437
|
!disabled
|
410
438
|
end
|
@@ -412,7 +440,6 @@ module Datadog
|
|
412
440
|
# ENABLED env var takes precedence over deprecated DISABLED
|
413
441
|
env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_ENABLED, enabled)
|
414
442
|
end
|
415
|
-
o.lazy
|
416
443
|
end
|
417
444
|
|
418
445
|
# An optional name of a custom header to resolve the client IP from.
|
@@ -420,8 +447,8 @@ module Datadog
|
|
420
447
|
# @default `DD_TRACE_CLIENT_IP_HEADER` environment variable, otherwise `nil`.
|
421
448
|
# @return [String,nil]
|
422
449
|
option :header_name do |o|
|
423
|
-
o.
|
424
|
-
o.
|
450
|
+
o.type :string, nilable: true
|
451
|
+
o.env Tracing::Configuration::Ext::ClientIp::ENV_HEADER_NAME
|
425
452
|
end
|
426
453
|
end
|
427
454
|
|
@@ -434,22 +461,9 @@ module Datadog
|
|
434
461
|
# @default `DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH` environment variable, otherwise `512`
|
435
462
|
# @return [Integer]
|
436
463
|
option :x_datadog_tags_max_length do |o|
|
437
|
-
o.
|
438
|
-
o.
|
439
|
-
|
440
|
-
|
441
|
-
# Schema version for span attributes that enables various features
|
442
|
-
#
|
443
|
-
# @default `DD_TRACE_SPAN_ATTRIBUTE_SCHEMA` environment variable, otherwise default `v0` currently
|
444
|
-
# @return [String]
|
445
|
-
option :span_attribute_schema do |o|
|
446
|
-
o.default do
|
447
|
-
ENV.fetch(
|
448
|
-
Tracing::Configuration::Ext::SpanAttributeSchema::ENV_SPAN_ATTRIBUTE_SCHEMA,
|
449
|
-
Tracing::Configuration::Ext::SpanAttributeSchema::DEFAULT_VERSION
|
450
|
-
)
|
451
|
-
end
|
452
|
-
o.lazy
|
464
|
+
o.type :int
|
465
|
+
o.env Tracing::Configuration::Ext::Distributed::ENV_X_DATADOG_TAGS_MAX_LENGTH
|
466
|
+
o.default 512
|
453
467
|
end
|
454
468
|
end
|
455
469
|
end
|
@@ -12,18 +12,21 @@ module Datadog
|
|
12
12
|
# @public_api
|
13
13
|
class Settings < Contrib::Configuration::Settings
|
14
14
|
option :enabled do |o|
|
15
|
-
o.
|
16
|
-
o.
|
15
|
+
o.type :bool
|
16
|
+
o.env Ext::ENV_ENABLED
|
17
|
+
o.default true
|
17
18
|
end
|
18
19
|
|
19
20
|
option :analytics_enabled do |o|
|
20
|
-
o.
|
21
|
-
o.
|
21
|
+
o.type :bool
|
22
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
23
|
+
o.default false
|
22
24
|
end
|
23
25
|
|
24
26
|
option :analytics_sample_rate do |o|
|
25
|
-
o.
|
26
|
-
o.
|
27
|
+
o.type :float
|
28
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
29
|
+
o.default 1.0
|
27
30
|
end
|
28
31
|
|
29
32
|
option :service_name
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,24 +7,24 @@ module Datadog
|
|
5
7
|
# ActionCable integration constants
|
6
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
7
9
|
module Ext
|
8
|
-
ENV_ENABLED = 'DD_TRACE_ACTION_CABLE_ENABLED'
|
9
|
-
ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED'
|
10
|
-
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE'
|
11
|
-
SPAN_ACTION = 'action_cable.action'
|
12
|
-
SPAN_BROADCAST = 'action_cable.broadcast'
|
13
|
-
SPAN_ON_OPEN = 'action_cable.on_open'
|
14
|
-
SPAN_TRANSMIT = 'action_cable.transmit'
|
15
|
-
TAG_ACTION = 'action_cable.action'
|
16
|
-
TAG_BROADCAST_CODER = 'action_cable.broadcast.coder'
|
17
|
-
TAG_CHANNEL = 'action_cable.channel'
|
18
|
-
TAG_CHANNEL_CLASS = 'action_cable.channel_class'
|
19
|
-
TAG_COMPONENT = 'action_cable'
|
20
|
-
TAG_CONNECTION = 'action_cable.connection'
|
21
|
-
TAG_OPERATION_ACTION = 'action'
|
22
|
-
TAG_OPERATION_BROADCAST = 'broadcast'
|
23
|
-
TAG_OPERATION_ON_OPEN = 'on_open'
|
24
|
-
TAG_OPERATION_TRANSMIT = 'transmit'
|
25
|
-
TAG_TRANSMIT_VIA = 'action_cable.transmit.via'
|
10
|
+
ENV_ENABLED = 'DD_TRACE_ACTION_CABLE_ENABLED'
|
11
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED'
|
12
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE'
|
13
|
+
SPAN_ACTION = 'action_cable.action'
|
14
|
+
SPAN_BROADCAST = 'action_cable.broadcast'
|
15
|
+
SPAN_ON_OPEN = 'action_cable.on_open'
|
16
|
+
SPAN_TRANSMIT = 'action_cable.transmit'
|
17
|
+
TAG_ACTION = 'action_cable.action'
|
18
|
+
TAG_BROADCAST_CODER = 'action_cable.broadcast.coder'
|
19
|
+
TAG_CHANNEL = 'action_cable.channel'
|
20
|
+
TAG_CHANNEL_CLASS = 'action_cable.channel_class'
|
21
|
+
TAG_COMPONENT = 'action_cable'
|
22
|
+
TAG_CONNECTION = 'action_cable.connection'
|
23
|
+
TAG_OPERATION_ACTION = 'action'
|
24
|
+
TAG_OPERATION_BROADCAST = 'broadcast'
|
25
|
+
TAG_OPERATION_ON_OPEN = 'on_open'
|
26
|
+
TAG_OPERATION_TRANSMIT = 'transmit'
|
27
|
+
TAG_TRANSMIT_VIA = 'action_cable.transmit.via'
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -12,18 +12,21 @@ module Datadog
|
|
12
12
|
# @public_api
|
13
13
|
class Settings < Contrib::Configuration::Settings
|
14
14
|
option :enabled do |o|
|
15
|
-
o.
|
16
|
-
o.
|
15
|
+
o.type :bool
|
16
|
+
o.env Ext::ENV_ENABLED
|
17
|
+
o.default true
|
17
18
|
end
|
18
19
|
|
19
20
|
option :analytics_enabled do |o|
|
20
|
-
o.
|
21
|
-
o.
|
21
|
+
o.type :bool
|
22
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
23
|
+
o.default false
|
22
24
|
end
|
23
25
|
|
24
26
|
option :analytics_sample_rate do |o|
|
25
|
-
o.
|
26
|
-
o.
|
27
|
+
o.type :float
|
28
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
29
|
+
o.default 1.0
|
27
30
|
end
|
28
31
|
|
29
32
|
option :service_name
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,25 +7,25 @@ module Datadog
|
|
5
7
|
# ActionMailer integration constants
|
6
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
7
9
|
module Ext
|
8
|
-
ENV_ENABLED = 'DD_TRACE_ACTION_MAILER_ENABLED'
|
9
|
-
ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_MAILER_ANALYTICS_ENABLED'
|
10
|
-
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_MAILER_ANALYTICS_SAMPLE_RATE'
|
11
|
-
SPAN_PROCESS = 'action_mailer.process'
|
12
|
-
SPAN_DELIVER = 'action_mailer.deliver'
|
13
|
-
TAG_COMPONENT = 'action_mailer'
|
14
|
-
TAG_ACTION = 'action_mailer.action'
|
15
|
-
TAG_MAILER = 'action_mailer.mailer'
|
16
|
-
TAG_MSG_ID = 'action_mailer.message_id'
|
17
|
-
TAG_OPERATION_DELIVER = 'deliver'
|
18
|
-
TAG_OPERATION_PROCESS = 'process'
|
10
|
+
ENV_ENABLED = 'DD_TRACE_ACTION_MAILER_ENABLED'
|
11
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_MAILER_ANALYTICS_ENABLED'
|
12
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_MAILER_ANALYTICS_SAMPLE_RATE'
|
13
|
+
SPAN_PROCESS = 'action_mailer.process'
|
14
|
+
SPAN_DELIVER = 'action_mailer.deliver'
|
15
|
+
TAG_COMPONENT = 'action_mailer'
|
16
|
+
TAG_ACTION = 'action_mailer.action'
|
17
|
+
TAG_MAILER = 'action_mailer.mailer'
|
18
|
+
TAG_MSG_ID = 'action_mailer.message_id'
|
19
|
+
TAG_OPERATION_DELIVER = 'deliver'
|
20
|
+
TAG_OPERATION_PROCESS = 'process'
|
19
21
|
|
20
|
-
TAG_SUBJECT = 'action_mailer.subject'
|
21
|
-
TAG_TO = 'action_mailer.to'
|
22
|
-
TAG_FROM = 'action_mailer.from'
|
23
|
-
TAG_BCC = 'action_mailer.bcc'
|
24
|
-
TAG_CC = 'action_mailer.cc'
|
25
|
-
TAG_DATE = 'action_mailer.date'
|
26
|
-
TAG_PERFORM_DELIVERIES = 'action_mailer.perform_deliveries'
|
22
|
+
TAG_SUBJECT = 'action_mailer.subject'
|
23
|
+
TAG_TO = 'action_mailer.to'
|
24
|
+
TAG_FROM = 'action_mailer.from'
|
25
|
+
TAG_BCC = 'action_mailer.bcc'
|
26
|
+
TAG_CC = 'action_mailer.cc'
|
27
|
+
TAG_DATE = 'action_mailer.date'
|
28
|
+
TAG_PERFORM_DELIVERIES = 'action_mailer.perform_deliveries'
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -12,18 +12,20 @@ module Datadog
|
|
12
12
|
# @public_api
|
13
13
|
class Settings < Contrib::Configuration::Settings
|
14
14
|
option :enabled do |o|
|
15
|
-
o.
|
16
|
-
o.
|
15
|
+
o.type :bool
|
16
|
+
o.env Ext::ENV_ENABLED
|
17
|
+
o.default true
|
17
18
|
end
|
18
19
|
|
19
20
|
option :analytics_enabled do |o|
|
20
|
-
o.
|
21
|
-
o.
|
21
|
+
o.type :bool, nilable: true
|
22
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
22
23
|
end
|
23
24
|
|
24
25
|
option :analytics_sample_rate do |o|
|
25
|
-
o.
|
26
|
-
o.
|
26
|
+
o.type :float
|
27
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
28
|
+
o.default 1.0
|
27
29
|
end
|
28
30
|
|
29
31
|
# DEV-2.0: Breaking changes for removal.
|