datadog 2.20.0 → 2.21.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 +26 -1
- data/README.md +0 -1
- data/ext/libdatadog_api/process_discovery.c +5 -5
- data/lib/datadog/appsec/api_security/route_extractor.rb +6 -2
- data/lib/datadog/appsec/autoload.rb +1 -1
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +4 -4
- data/lib/datadog/core/configuration/components.rb +8 -2
- data/lib/datadog/core/configuration/config_helper.rb +100 -0
- data/lib/datadog/core/configuration/deprecations.rb +36 -0
- data/lib/datadog/core/configuration/ext.rb +0 -1
- data/lib/datadog/core/configuration/option.rb +38 -43
- data/lib/datadog/core/configuration/option_definition.rb +0 -9
- data/lib/datadog/core/configuration/options.rb +1 -5
- data/lib/datadog/core/configuration/settings.rb +10 -6
- data/lib/datadog/core/configuration/supported_configurations.rb +335 -0
- data/lib/datadog/core/configuration.rb +1 -1
- data/lib/datadog/core/deprecations.rb +2 -2
- data/lib/datadog/core/environment/ext.rb +0 -2
- data/lib/datadog/core/environment/git.rb +2 -2
- data/lib/datadog/core/environment/variable_helpers.rb +3 -3
- data/lib/datadog/core/metrics/client.rb +2 -2
- data/lib/datadog/core/process_discovery/tracer_memfd.rb +2 -4
- data/lib/datadog/core/process_discovery.rb +46 -23
- data/lib/datadog/core/runtime/ext.rb +0 -1
- data/lib/datadog/core/telemetry/event/app_started.rb +2 -2
- data/lib/datadog/core.rb +2 -0
- data/lib/datadog/di/boot.rb +4 -3
- data/lib/datadog/di/probe_file_loader.rb +1 -1
- data/lib/datadog/di/probe_notification_builder.rb +1 -1
- data/lib/datadog/opentelemetry/sdk/configurator.rb +1 -1
- data/lib/datadog/profiling/collectors/info.rb +1 -1
- data/lib/datadog/profiling/ext.rb +2 -1
- data/lib/datadog/profiling/http_transport.rb +1 -1
- data/lib/datadog/profiling/tasks/exec.rb +2 -2
- data/lib/datadog/tracing/configuration/ext.rb +0 -3
- data/lib/datadog/tracing/configuration/settings.rb +12 -7
- data/lib/datadog/tracing/contrib/graphql/unified_trace.rb +12 -1
- data/lib/datadog/tracing/contrib/rack/request_queue.rb +1 -0
- data/lib/datadog/tracing/contrib/rack/trace_proxy_middleware.rb +7 -1
- data/lib/datadog/tracing/contrib/rails/ext.rb +2 -1
- data/lib/datadog/tracing/contrib/rails/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/span_attribute_schema.rb +1 -1
- data/lib/datadog/version.rb +1 -1
- metadata +9 -6
@@ -6,9 +6,10 @@ module Datadog
|
|
6
6
|
ENV_ENABLED = "DD_PROFILING_ENABLED"
|
7
7
|
ENV_UPLOAD_TIMEOUT = "DD_PROFILING_UPLOAD_TIMEOUT"
|
8
8
|
ENV_MAX_FRAMES = "DD_PROFILING_MAX_FRAMES"
|
9
|
-
ENV_AGENTLESS = "DD_PROFILING_AGENTLESS"
|
10
9
|
ENV_ENDPOINT_COLLECTION_ENABLED = "DD_PROFILING_ENDPOINT_COLLECTION_ENABLED"
|
11
10
|
|
11
|
+
# WARNING: This should not be used, only for internal testing
|
12
|
+
ENV_AGENTLESS = "DD_PROFILING_AGENTLESS" # rubocop:disable CustomCops/EnvStringValidationCop
|
12
13
|
module Transport
|
13
14
|
module HTTP
|
14
15
|
FORM_FIELD_TAG_PROFILER_VERSION = "profiler_version"
|
@@ -56,7 +56,7 @@ module Datadog
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def agentless?(site, api_key)
|
59
|
-
site && api_key &&
|
59
|
+
site && api_key && %w[1 true].include?(ENV[Profiling::Ext::ENV_AGENTLESS] || '') # rubocop:disable CustomCops/EnvUsageCop
|
60
60
|
end
|
61
61
|
|
62
62
|
def config_without_api_key
|
@@ -25,9 +25,9 @@ module Datadog
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def set_rubyopt!
|
28
|
-
existing_rubyopt = ENV["RUBYOPT"]
|
28
|
+
existing_rubyopt = ENV["RUBYOPT"] # rubocop:disable CustomCops/EnvUsageCop
|
29
29
|
|
30
|
-
ENV["RUBYOPT"] = existing_rubyopt ? "#{existing_rubyopt} #{rubyopts.join(" ")}" : rubyopts.join(" ")
|
30
|
+
ENV["RUBYOPT"] = existing_rubyopt ? "#{existing_rubyopt} #{rubyopts.join(" ")}" : rubyopts.join(" ") # rubocop:disable CustomCops/EnvUsageCop
|
31
31
|
end
|
32
32
|
|
33
33
|
# If there's an error here, rather than throwing a cryptic stack trace, let's instead have clearer messages, and
|
@@ -9,7 +9,6 @@ module Datadog
|
|
9
9
|
# e.g. Env vars, default values, enums, etc...
|
10
10
|
module Ext
|
11
11
|
ENV_ENABLED = 'DD_TRACE_ENABLED'
|
12
|
-
ENV_OTEL_TRACES_EXPORTER = 'OTEL_TRACES_EXPORTER'
|
13
12
|
ENV_HEADER_TAGS = 'DD_TRACE_HEADER_TAGS'
|
14
13
|
ENV_BAGGAGE_TAG_KEYS = 'DD_TRACE_BAGGAGE_TAG_KEYS'
|
15
14
|
ENV_TRACE_ID_128_BIT_GENERATION_ENABLED = 'DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED'
|
@@ -55,7 +54,6 @@ module Datadog
|
|
55
54
|
# Has lower precedence than `DD_TRACE_PROPAGATION_STYLE_INJECT` or
|
56
55
|
# `DD_TRACE_PROPAGATION_STYLE_EXTRACT`.
|
57
56
|
ENV_PROPAGATION_STYLE = 'DD_TRACE_PROPAGATION_STYLE'
|
58
|
-
ENV_OTEL_PROPAGATION_STYLE = 'OTEL_PROPAGATORS'
|
59
57
|
|
60
58
|
ENV_PROPAGATION_STYLE_INJECT = 'DD_TRACE_PROPAGATION_STYLE_INJECT'
|
61
59
|
|
@@ -81,7 +79,6 @@ module Datadog
|
|
81
79
|
ENV_SAMPLE_RATE = 'DD_TRACE_SAMPLE_RATE'
|
82
80
|
ENV_RATE_LIMIT = 'DD_TRACE_RATE_LIMIT'
|
83
81
|
ENV_RULES = 'DD_TRACE_SAMPLING_RULES'
|
84
|
-
ENV_OTEL_TRACES_SAMPLER = 'OTEL_TRACES_SAMPLER'
|
85
82
|
OTEL_TRACES_SAMPLER_ARG = 'OTEL_TRACES_SAMPLER_ARG'
|
86
83
|
|
87
84
|
# @public_api
|
@@ -93,7 +93,8 @@ module Datadog
|
|
93
93
|
# @return [Array<String>]
|
94
94
|
option :propagation_style do |o|
|
95
95
|
o.type :array
|
96
|
-
|
96
|
+
# Note: Alias (DD_TRACE_PROPAGATION_STYLE) defined in supported-configurations.json
|
97
|
+
o.env Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE
|
97
98
|
o.default []
|
98
99
|
o.after_set do |styles|
|
99
100
|
next if styles.empty?
|
@@ -133,13 +134,16 @@ module Datadog
|
|
133
134
|
# @default `DD_TRACE_ENABLED` environment variable, otherwise `true`
|
134
135
|
# @return [Boolean]
|
135
136
|
option :enabled do |o|
|
136
|
-
|
137
|
+
# Note: Alias (OTEL_TRACES_EXPORTER) defined in supported-configurations.json
|
138
|
+
o.env Tracing::Configuration::Ext::ENV_ENABLED
|
137
139
|
o.default true
|
138
140
|
o.type :bool
|
139
141
|
o.env_parser do |value|
|
140
142
|
value = value&.downcase
|
141
143
|
# Tracing is disabled when OTEL_TRACES_EXPORTER is none or
|
142
144
|
# DD_TRACE_ENABLED is 0 or false.
|
145
|
+
# DEV: The current implementation accepts all of the mentioned values
|
146
|
+
# for both environment variables, which is incorrect.
|
143
147
|
if ['none', 'false', '0'].include?(value)
|
144
148
|
false
|
145
149
|
# Tracing is enabled when DD_TRACE_ENABLED is true or 1
|
@@ -302,7 +306,8 @@ module Datadog
|
|
302
306
|
# @return [Float, nil]
|
303
307
|
option :default_rate do |o|
|
304
308
|
o.type :float, nilable: true
|
305
|
-
|
309
|
+
# Note: Alias (OTEL_TRACES_SAMPLER) defined in supported-configurations.json
|
310
|
+
o.env Tracing::Configuration::Ext::Sampling::ENV_SAMPLE_RATE
|
306
311
|
o.env_parser do |value|
|
307
312
|
# Parse the value as a float
|
308
313
|
next if value.nil?
|
@@ -321,7 +326,7 @@ module Datadog
|
|
321
326
|
when 'parentbased_always_off'
|
322
327
|
0.0
|
323
328
|
when 'parentbased_traceidratio'
|
324
|
-
|
329
|
+
DATADOG_ENV.fetch(Configuration::Ext::Sampling::OTEL_TRACES_SAMPLER_ARG, 1.0).to_f
|
325
330
|
else
|
326
331
|
value.to_f
|
327
332
|
end
|
@@ -355,7 +360,7 @@ module Datadog
|
|
355
360
|
# @public_api
|
356
361
|
option :rules do |o|
|
357
362
|
o.type :string, nilable: true
|
358
|
-
o.default {
|
363
|
+
o.default { DATADOG_ENV.fetch(Configuration::Ext::Sampling::ENV_RULES, nil) }
|
359
364
|
end
|
360
365
|
|
361
366
|
# Single span sampling rules.
|
@@ -372,8 +377,8 @@ module Datadog
|
|
372
377
|
option :span_rules do |o|
|
373
378
|
o.type :string, nilable: true
|
374
379
|
o.default do
|
375
|
-
rules =
|
376
|
-
rules_file =
|
380
|
+
rules = DATADOG_ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES]
|
381
|
+
rules_file = DATADOG_ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES_FILE]
|
377
382
|
|
378
383
|
if rules
|
379
384
|
if rules_file
|
@@ -50,8 +50,11 @@ module Datadog
|
|
50
50
|
trace(
|
51
51
|
proc { super },
|
52
52
|
'execute',
|
53
|
-
query.
|
53
|
+
operation_resource(query.selected_operation),
|
54
54
|
lambda { |span|
|
55
|
+
# Ensure this span can be aggregated by in the Datadog App, and generates RED metrics.
|
56
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_SERVER)
|
57
|
+
|
55
58
|
span.set_tag('graphql.source', query.query_string)
|
56
59
|
span.set_tag('graphql.operation.type', query.selected_operation.operation_type)
|
57
60
|
if query.selected_operation_name
|
@@ -194,6 +197,14 @@ module Datadog
|
|
194
197
|
end
|
195
198
|
end
|
196
199
|
|
200
|
+
def operation_resource(operation)
|
201
|
+
if operation.name
|
202
|
+
"#{operation.operation_type} #{operation.name}"
|
203
|
+
else
|
204
|
+
"anonymous"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
197
208
|
# Create a Span Event for each error that occurs at query level.
|
198
209
|
#
|
199
210
|
# These are represented in the Datadog App as special GraphQL errors,
|
@@ -24,6 +24,7 @@ module Datadog
|
|
24
24
|
# nginx header is seconds in the format "t=1512379167.574"
|
25
25
|
# apache header is microseconds in the format "t=1570633834463123"
|
26
26
|
# heroku header is milliseconds in the format "1570634024294"
|
27
|
+
# @see https://github.com/heroku/vegur/blob/65d168f757e0ddb448f41cfb9e4b0281c747378d/README.md?plain=1#L383-L384
|
27
28
|
time_string = header.to_s.delete('^0-9')
|
28
29
|
return if time_string.nil?
|
29
30
|
|
@@ -43,7 +43,13 @@ module Datadog
|
|
43
43
|
# excluding the time spent processing the request itself
|
44
44
|
queue_span.finish
|
45
45
|
|
46
|
-
yield
|
46
|
+
yield
|
47
|
+
ensure
|
48
|
+
# Ensure that the spans are finished even if an exception is raised.
|
49
|
+
# **This is very important** to prevent the trace from leaking between requests,
|
50
|
+
# especially because `queue_span` is normally a root span.
|
51
|
+
queue_span&.finish
|
52
|
+
request_span&.finish
|
47
53
|
end
|
48
54
|
end
|
49
55
|
end
|
@@ -12,7 +12,8 @@ module Datadog
|
|
12
12
|
# @!visibility private
|
13
13
|
ENV_ANALYTICS_ENABLED = 'DD_TRACE_RAILS_ANALYTICS_ENABLED'
|
14
14
|
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RAILS_ANALYTICS_SAMPLE_RATE'
|
15
|
-
|
15
|
+
# Note: Alias (previous name DISABLE_DATADOG_RAILS) defined in supported-configurations.json
|
16
|
+
ENV_DISABLE = 'DD_DISABLE_DATADOG_RAILS'
|
16
17
|
|
17
18
|
SPAN_RUNNER_FILE = 'rails.runner.file'
|
18
19
|
SPAN_RUNNER_INLINE = 'rails.runner.inline'
|
@@ -11,7 +11,7 @@ module Datadog
|
|
11
11
|
NO_SOURCE = [].freeze
|
12
12
|
|
13
13
|
def self.fetch_service_name(env, default)
|
14
|
-
|
14
|
+
DATADOG_ENV.fetch(env) do
|
15
15
|
if Datadog.configuration.tracing.contrib.global_default_service_name.enabled
|
16
16
|
return Datadog.configuration.service
|
17
17
|
end
|
data/lib/datadog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datadog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.24.1.1
|
53
|
+
version: 1.24.1.2.1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 1.24.1.1
|
60
|
+
version: 1.24.1.2.1
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: libdatadog
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -286,12 +286,15 @@ files:
|
|
286
286
|
- lib/datadog/core/configuration/base.rb
|
287
287
|
- lib/datadog/core/configuration/components.rb
|
288
288
|
- lib/datadog/core/configuration/components_state.rb
|
289
|
+
- lib/datadog/core/configuration/config_helper.rb
|
290
|
+
- lib/datadog/core/configuration/deprecations.rb
|
289
291
|
- lib/datadog/core/configuration/ext.rb
|
290
292
|
- lib/datadog/core/configuration/option.rb
|
291
293
|
- lib/datadog/core/configuration/option_definition.rb
|
292
294
|
- lib/datadog/core/configuration/options.rb
|
293
295
|
- lib/datadog/core/configuration/settings.rb
|
294
296
|
- lib/datadog/core/configuration/stable_config.rb
|
297
|
+
- lib/datadog/core/configuration/supported_configurations.rb
|
295
298
|
- lib/datadog/core/contrib/rails/utils.rb
|
296
299
|
- lib/datadog/core/crashtracking/component.rb
|
297
300
|
- lib/datadog/core/crashtracking/tag_builder.rb
|
@@ -1004,8 +1007,8 @@ licenses:
|
|
1004
1007
|
- Apache-2.0
|
1005
1008
|
metadata:
|
1006
1009
|
allowed_push_host: https://rubygems.org
|
1007
|
-
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.
|
1008
|
-
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.
|
1010
|
+
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.21.0/CHANGELOG.md
|
1011
|
+
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.21.0
|
1009
1012
|
post_install_message:
|
1010
1013
|
rdoc_options: []
|
1011
1014
|
require_paths:
|