Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1d8bab2
Add initial attempt at adding process related tags on trace payloads.…
wantsui Nov 7, 2025
58592a3
Add test for multiple calls to the formatter tags
wantsui Nov 10, 2025
7dc9184
Add tests for trace formatter spec to assert that the first span of t…
wantsui Nov 10, 2025
cad26a6
it turns out you cannot just pin things to rails 7 due to newer ruby …
wantsui Nov 10, 2025
f31440a
Update lib/datadog/core/environment/process.rb
wantsui Nov 10, 2025
cfec602
fix string and rename formatted_process_tags_k1_v1 to serialized
wantsui Nov 10, 2025
8dae705
remove unneeded line
wantsui Nov 10, 2025
055586f
remove server type for now until more research is done
wantsui Nov 10, 2025
cacb500
Add new tag normalizer logic following the trace agent.
wantsui Nov 11, 2025
7661a3f
lint fix
wantsui Nov 11, 2025
7825940
add missing files from prototype command
wantsui Nov 11, 2025
5de6efd
Add missing constants to ext rbs file
wantsui Nov 11, 2025
f5ca84a
jruby fix for the process spec
wantsui Nov 11, 2025
9ad5be5
remove the active record during rails creation because it caused a jr…
wantsui Nov 11, 2025
a66e635
Bring tag normalization to 1:1 parity with the Trace Agent
wantsui Nov 13, 2025
ec1e930
Add changes from code review around comments and add test for the new…
wantsui Nov 13, 2025
4073ab5
Merge branch 'master' into add-process-tags-to-tracing
wantsui Nov 13, 2025
22a3680
Remove the rails gem install from process_spec
wantsui Nov 14, 2025
5784833
Remove 1 sec delay.
wantsui Nov 14, 2025
2b705e3
Update sig/datadog/core/environment/ext.rbs
wantsui Nov 14, 2025
e3deb4c
Update lib/datadog/tracing/transport/trace_formatter.rb
wantsui Nov 14, 2025
4747259
Add improvements for long strings.
wantsui Nov 14, 2025
41bc6c0
small improvement to the whitespace removal.
wantsui Nov 14, 2025
c3605c0
Add upper bound to regex to avoid the polynomial regex on uncontrolle…
wantsui Nov 14, 2025
adfa416
Change untyped to string.
wantsui Nov 14, 2025
0dff545
Use possessive quantifiers in regex instead of limiting the upper bou…
wantsui Nov 14, 2025
7d8da40
Fix types for steep check command
wantsui Nov 14, 2025
31d9796
Remove unneeded Core prefix
wantsui Nov 14, 2025
3672a8a
lint fixes
wantsui Nov 14, 2025
23d9769
restructure folder lookup so it works on the macos ci tests
wantsui Nov 14, 2025
7615906
fixes for local mac development.
wantsui Nov 17, 2025
d4c6a91
Add missing trace agent test cases.
wantsui Nov 17, 2025
433b250
Fix lint
wantsui Nov 18, 2025
47efb90
Change methods to private. Also add comments with examples
wantsui Nov 18, 2025
a2643a6
Fix basedir logic and adjust tests (and also fix the private change)
wantsui Nov 18, 2025
ccd4971
Fix steepcheck error
wantsui Nov 18, 2025
be9587d
Add in byte logic to handle emojis with early backoff and allow start…
wantsui Nov 18, 2025
6042830
Move process tags only to the first span and adjust tests
wantsui Nov 18, 2025
4210d74
Add a special character into the test app name to show that it gets n…
wantsui Nov 19, 2025
f9af946
Update lib/datadog/core/normalizer.rb
wantsui Nov 19, 2025
381fbe2
Update lib/datadog/core/normalizer.rb
wantsui Nov 19, 2025
138dff8
Fixes for new constant names
wantsui Nov 19, 2025
2449153
Change to byteslice
wantsui Nov 19, 2025
5252259
fix lint.
wantsui Nov 19, 2025
0eaf302
remove process_spec from main rake task
wantsui Nov 19, 2025
fbfecfe
Update spec/datadog/core/normalizer_spec.rb
wantsui Nov 20, 2025
cc2225f
Update spec/datadog/tracing/transport/trace_formatter_spec.rb
wantsui Nov 20, 2025
62822ab
Merge branch 'master' into add-process-tags-to-tracing
wantsui Nov 20, 2025
a77e63b
Remove the unless check and replace with an assertion that the file e…
wantsui Nov 20, 2025
439e81a
Update spec/datadog/core/environment/process_spec.rb
wantsui Nov 20, 2025
9e45ade
fix lint
wantsui Nov 20, 2025
0ab4fef
Rename Normalizer to TagNormalizer.
wantsui Nov 20, 2025
6577d3f
Update lib/datadog/core/environment/process.rb
wantsui Nov 20, 2025
a336c66
Add api private comment to the tag normalizer and refactor away the e…
wantsui Nov 20, 2025
0d229de
Fix steep errors on the process rbs file
wantsui Nov 20, 2025
e83bc4a
Refactor the utils encode call so it can be used in the tag normalize…
wantsui Nov 21, 2025
ce1759f
Update Rakefile
wantsui Nov 21, 2025
8b978c6
Update lib/datadog/core/tag_normalizer.rb
wantsui Nov 21, 2025
f4c9d49
Add lint fixes and remove unneeded regex at the end.
wantsui Nov 21, 2025
eae4eb9
fix rbs file for deleted variable
wantsui Nov 21, 2025
f3f1480
remove unneeded conditional
wantsui Nov 21, 2025
b48d20d
Add a log if the process tags cannot be obtained
wantsui Nov 21, 2025
3d33291
Fix regex and reuse the same test cases to show that the leading digi…
wantsui Nov 21, 2025
4e3f8f4
Attempt to retrieve as many non empty string process tags as possible…
wantsui Nov 21, 2025
5f6908c
Fix hard to spot missing comma in Rakefile that was breaking tests
wantsui Nov 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/datadog/core/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,16 @@ def initialize(*_)
end
end

# Enable experimental process tags propagation.
#
# @default `DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED` environment variable, otherwise `false`
# @return [Boolean]
option :experimental_propagate_process_tags_enabled do |o|
o.env 'DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED'
o.default false
o.type :bool
end

# Tracer specific configuration starting with APM (e.g. DD_APM_TRACING_ENABLED).
# @public_api
settings :apm do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module Configuration
"DD_ENV" => {version: ["A"]},
"DD_ERROR_TRACKING_HANDLED_ERRORS" => {version: ["A"]},
"DD_ERROR_TRACKING_HANDLED_ERRORS_INCLUDE" => {version: ["A"]},
"DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED" => {version: ["A"]},
"DD_GIT_COMMIT_SHA" => {version: ["A"]},
"DD_GIT_REPOSITORY_URL" => {version: ["A"]},
"DD_HEALTH_METRICS_ENABLED" => {version: ["A"]},
Expand Down
6 changes: 6 additions & 0 deletions lib/datadog/core/environment/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ module Ext
LANG_INTERPRETER = "#{RUBY_ENGINE}-#{RUBY_PLATFORM}"
LANG_PLATFORM = RUBY_PLATFORM
LANG_VERSION = RUBY_VERSION
PROCESS_TYPE = 'script'
RUBY_ENGINE = ::RUBY_ENGINE # e.g. 'ruby', 'jruby', 'truffleruby'
TAG_ENV = 'env'
TAG_ENTRYPOINT_BASEDIR = "entrypoint.basedir"
TAG_ENTRYPOINT_NAME = "entrypoint.name"
TAG_ENTRYPOINT_WORKDIR = "entrypoint.workdir"
TAG_ENTRYPOINT_TYPE = "entrypoint.type"
TAG_PROCESS_TAGS = "_dd.tags.process"
TAG_SERVICE = 'service'
TAG_VERSION = 'version'

Expand Down
50 changes: 50 additions & 0 deletions lib/datadog/core/environment/process.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true
require_relative 'ext'
require_relative '../normalizer'

module Datadog
module Core
module Environment
# Retrieves process level information
module Process
module_function

def entrypoint_workdir
File.basename(Dir.pwd)
end

def entrypoint_type
Core::Environment::Ext::PROCESS_TYPE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove Core:: from this constant access (see comment in def serialized).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this note! see 31d9796!

end

def entrypoint_name
File.basename($0)
end

def entrypoint_basedir
current_basedir = File.expand_path(File.dirname($0))
normalized_basedir = current_basedir.tr(File::SEPARATOR, '/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we do this normalization in the python implementation. We should align on the same approach (either normalize in the SDK or do it one central place like the Agent).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I made an adjustment in a2643a6 so it's the same as the python tracer behavior now.

normalized_basedir.delete_prefix!('/')
end

# Normalize tag key and value using the Datadog Agent's tag normalization logic
def serialized_kv_helper(key, value)
key = Core::Normalizer.normalize(key)
value = Core::Normalizer.normalize(value)
"#{key}:#{value}"
end

# This method returns a key/value part of serialized tags in the format of k1:v1,k2:v2,k3:v3
def serialized
return @serialized if defined?(@serialized)
tags = []
tags << serialized_kv_helper(Core::Environment::Ext::TAG_ENTRYPOINT_WORKDIR, entrypoint_workdir) if entrypoint_workdir
tags << serialized_kv_helper(Core::Environment::Ext::TAG_ENTRYPOINT_NAME, entrypoint_name) if entrypoint_name
tags << serialized_kv_helper(Core::Environment::Ext::TAG_ENTRYPOINT_BASEDIR, entrypoint_basedir) if entrypoint_basedir
tags << serialized_kv_helper(Core::Environment::Ext::TAG_ENTRYPOINT_TYPE, entrypoint_type) if entrypoint_type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need to specify namespacing in Ruby up until the common point between: the current class or module we are in; and the object we want to reference.
In this case, we are in Datadog::Core::Environment::Process and want to reference Datadog::Core::Environment::Ext::TAG_ENTRYPOINT_WORKDIR.

We can remove the prefix namespace that is identical. For example Ext::TAG_ENTRYPOINT_WORKDIR will work here.

BUT, Ruby namespace resolution is very lenient, and we will try to match Ext (from Ext::TAG_ENTRYPOINT_WORKDIR), in order, to: Datadog::Core::Environment::Process::Ext, Datadog::Core::Environment::Ext, Datadog::Core::Ext, Datadog::Ext, and ::Ext.
This is important because the namespace matching doesn't try to match the complete Ext::TAG_ENTRYPOINT_WORKDIR path; it only tries to match the first token you provided: the Ext in Ext::TAG_ENTRYPOINT_WORKDIR.
And because more than one of these locations in the possible search logic are realistic matches, we should be a bit more specific than Ext::TAG_ENTRYPOINT_WORKDIR.

A good practice is to stop at the closet common namespace location. In this case, it would be the Environment. So I suggest using Environment::Ext::TAG_ENTRYPOINT_WORKDIR (and the equivalent for the other constants) here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! I'll keep this in mind going forward!
Addressed in: 31d9796

@serialized = tags.join(',').freeze
end
end
end
end
end
31 changes: 31 additions & 0 deletions lib/datadog/core/normalizer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module Datadog
module Core
module Normalizer
module_function
INVALID_TAG_CHARACTERS = %r{[^a-z0-9_\-:./]}.freeze

# Based on https://docs.datadoghq.com/getting_started/tagging/#defining-tags
# Currently a reimplementation of the logic in the
# Datadog::Tracing::Metadata::Ext::HTTP::Headers.to_tag method with some additional items
# TODO: Swap out the logic in the Datadog Tracing Metadata headers logic
def self.normalize(original_value)
Copy link
Member

@marcotc marcotc Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how many operations happen inside this method, I recommend adding a "fast-case", where we do some checks and return immediately if the provided original_value is already valid.
This suggestion is equivalent to the early return by the agent here.

I suggest trying to use a regular expression, instead of implementing the agent's isNormalizedASCIITag in Ruby, since Ruby code is slower than Go code, but Ruby regex is pretty fast.

Something like:

return original_value if original_value.size <= MAX_CHARACTER_LENGTH && original_value.matches?(VALID_ASCII_TAG)

The hypothetical VALID_ASCII_TAG doesn't have to catch all valid cases: it's a trade-off between matching most valid tags vs making the regex complicated and slow. As long as it never matches invalid tags, it's all good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in be9587d ! Let me know if this is better now!

return "" if original_value.nil? || original_value.to_s.strip.empty?

# Removes whitespaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this comment, and the one for downcase, since they only capture what the code already does (and the code is not ambiguous).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up moving all the code comments up in a66e635, to clarify the order of operations based on the Trace Agent logic.

normalized_value = original_value.to_s.strip
# Lower case characters
normalized_value.downcase!
# Invalid characters are replaced with an underscore
normalized_value.gsub!(INVALID_TAG_CHARACTERS, '_')
# Merge consecutive underscores with a single underscore
normalized_value.gsub!(/_+/, '_')
# Remove leading non-letter characters
normalized_value.sub!(/\A[^a-z]+/, "")
# Maximum length is 200 characters
normalized_value = normalized_value[0...200] if normalized_value.length > 200

normalized_value
end
end
end
end
1 change: 1 addition & 0 deletions lib/datadog/tracing/configuration/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Ext
ENV_NATIVE_SPAN_EVENTS = 'DD_TRACE_NATIVE_SPAN_EVENTS'
ENV_RESOURCE_RENAMING_ENABLED = 'DD_TRACE_RESOURCE_RENAMING_ENABLED'
ENV_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT = 'DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT'
ENV_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED = 'DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED'

# @public_api
module SpanAttributeSchema
Expand Down
8 changes: 8 additions & 0 deletions lib/datadog/tracing/transport/trace_formatter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative '../../core/environment/identity'
require_relative '../../core/environment/process'
require_relative '../../core/environment/socket'
require_relative '../../core/environment/git'
require_relative '../../core/git/ext'
Expand Down Expand Up @@ -60,6 +61,7 @@ def format!
tag_sampling_priority!
tag_profiling_enabled!
tag_apm_tracing_disabled!
tag_process_tags!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to move this check into:

if first_span

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! (and add a test to assert that we do check for first_span).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6042830!


if first_span
tag_git_repository_url!
Expand Down Expand Up @@ -215,6 +217,12 @@ def tag_git_commit_sha!
first_span.set_tag(Core::Git::Ext::TAG_COMMIT_SHA, git_commit_sha)
end

def tag_process_tags!
return unless Datadog.configuration.experimental_propagate_process_tags_enabled
process_tags = Core::Environment::Process.serialized
first_span.set_tag(Core::Environment::Ext::TAG_PROCESS_TAGS, process_tags)
end

private

def partial?
Expand Down
88 changes: 88 additions & 0 deletions spec/datadog/core/environment/process_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
require 'spec_helper'
require 'datadog/core/environment/process'
require 'open3'

RSpec.describe Datadog::Core::Environment::Process do
describe '::entrypoint_workdir' do
subject(:entrypoint_workdir) { described_class.entrypoint_workdir }

it { is_expected.to be_a_kind_of(String) }
end

describe '::entrypoint_type' do
subject(:entrypoint_type) { described_class.entrypoint_type }

it { is_expected.to be_a_kind_of(String) }
it { is_expected.to eq(Datadog::Core::Environment::Ext::PROCESS_TYPE) }
end

describe '::entrypoint_name' do
subject(:entrypoint_name) { described_class.entrypoint_name }

it { is_expected.to be_a_kind_of(String) }
end

describe '::entrypoint_basedir' do
subject(:entrypoint_basedir) { described_class.entrypoint_basedir }

it { is_expected.to be_a_kind_of(String) }
end

describe '::serialized' do
subject(:serialized) { described_class.serialized }

it { is_expected.to be_a_kind_of(String) }

it 'returns the same object when called multiple times' do
# Processes are fixed so no need to recompute this on each call
first_call = described_class.serialized
second_call = described_class.serialized
expect(first_call).to equal(second_call)
end
end

describe 'Scenario: Real applications' do
context 'when running a real Rails application' do
it 'detects Rails process information correctly' do
Dir.mktmpdir do |tmp_dir|
Dir.chdir(tmp_dir) do
Bundler.with_unbundled_env do
skip('rails gem could not be installed') unless system('gem install rails')
unless system('rails new test_app --minimal --skip-test --skip-keeps --skip-git --skip-docker')
skip('rails new command failed')
end
end
end
File.open("#{tmp_dir}/test_app/Gemfile", 'a') do |file|
file.puts "gem 'datadog', path: '#{Dir.pwd}', require: false"
end
File.write("#{tmp_dir}/test_app/config/initializers/process_initializer.rb", <<-RUBY)
Rails.application.config.after_initialize do
require 'datadog/core/environment/process'
STDERR.puts "entrypoint_workdir:\#{Datadog::Core::Environment::Process.entrypoint_workdir}"
STDERR.puts "entrypoint_type:\#{Datadog::Core::Environment::Process.entrypoint_type}"
STDERR.puts "entrypoint_name:\#{Datadog::Core::Environment::Process.entrypoint_name}"
STDERR.puts "entrypoint_basedir:\#{Datadog::Core::Environment::Process.entrypoint_basedir}"
STDERR.puts "_dd.tags.process:\#{Datadog::Core::Environment::Process.serialized}"
STDERR.flush
Thread.new { sleep 1; Process.kill('TERM', Process.pid)}#{' '}
end
RUBY
Bundler.with_unbundled_env do
Dir.chdir("#{tmp_dir}/test_app") do
_, _, _ = Open3.capture3('bundle install')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rails new, called during this test setup already calls bundle install inside the new application directory.

I suggest either removing this and letting rails new do it; or pass a --skip-bundle (or --skip-bundler, I forget, sorry) to rails new and keep this bundle install here.

_, err, _ = Open3.capture3('bundle exec rails s')
expect(err).to include('entrypoint_workdir:test_app')
expect(err).to include('entrypoint_type:script')
expect(err).to include('entrypoint_name:rails')
basedir_test = tmp_dir.sub(%r{^/}, '')
expect(err).to include("entrypoint_basedir:#{basedir_test}/test_app/bin")
expected_tags = "entrypoint.workdir:test_app,entrypoint.name:rails,entrypoint.basedir:#{basedir_test}/test_app/bin,entrypoint.type:script"
expect(err).to include("_dd.tags.process:#{expected_tags}")
end
end
end
end
end
end
end
50 changes: 50 additions & 0 deletions spec/datadog/core/normalizer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require 'spec_helper'
require 'datadog/core/normalizer'

RSpec.describe Datadog::Core::Normalizer do
describe '.normalize' do
subject(:normalize) { described_class.normalize(input) }

context 'keeps normal strings the same' do
let(:input) {'regulartag'}
let(:expected_output) {'regulartag'}
it { is_expected.to eq(expected_output) }
end

context 'truncates long strings' do
let(:input) {'a' * 201}
let(:expected_output) {'a' * 200}
it { is_expected.to eq(expected_output) }
end

context 'transforms special characters to underscores' do
let(:input) {'a&**!'}
let(:expected_output) {'a_'}
it { is_expected.to eq(expected_output) }
end

context 'capital letters are lower cased' do
let(:input) {'A'*10}
let(:expected_output) {'a'*10}
it { is_expected.to eq(expected_output) }
end

context 'removes whitespaces' do
let(:input) {' hi '}
let(:expected_output) {'hi'}
it { is_expected.to eq(expected_output) }
end

context 'characters must start with a letter' do
let(:input) {'1hi'}
let(:expected_output) {'hi'}
it { is_expected.to eq(expected_output) }
end

context 'if none of the characters are valid to start the value, the string is empty' do
let(:input) {'111111111'}
let(:expected_output) {''}
it { is_expected.to eq(expected_output) }
end
end
end
53 changes: 53 additions & 0 deletions spec/datadog/tracing/transport/trace_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,23 @@
end
end

shared_examples 'first span with process tags' do
it do
format!
expect(first_span.meta).to include('_dd.tags.process')
expect(first_span.meta['_dd.tags.process']).to eq(Datadog::Core::Environment::Process.serialized)
# TODO figure out if we need an assertion for the value, ie
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcotc - do you think there's value in asserting for the values of the tag? Or is the test in process_spec enough?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you are doing with expect(first_span.meta['_dd.tags.process']).to eq(Datadog::Core::Environment::Process.serialized) seems good to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't test realistic values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thing to test here is that it's respecting the configuring option, which you did.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thing to test here is that it's respecting the configuring option.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! In that case it doesn't seem like I need to make any changes to the assertions then?

# `"entrypoint.workdir:app,entrypoint.name:rspec,entrypoint.basedir:usr/local/bundle/bin,entrypoint.type:script,server.type:placeholder"`
end
end

shared_examples 'first span without process tags' do
it do
format!
expect(first_span.meta).to_not include('_dd.tags.process')
end
end

context 'with no root span' do
include_context 'no root span'

Expand Down Expand Up @@ -284,6 +301,18 @@
include_context 'no git metadata'
it_behaves_like 'first span with no git metadata'
end

context 'with process tags enabled' do
before do
allow(Datadog.configuration).to receive(:experimental_propagate_process_tags_enabled).and_return(true)
end
it_behaves_like 'first span with process tags'
end

context 'without process tags enabled' do
# default is false
it_behaves_like 'first span without process tags'
end
end

context 'with missing root span' do
Expand Down Expand Up @@ -333,6 +362,18 @@
include_context 'no git metadata'
it_behaves_like 'first span with no git metadata'
end

context 'with process tags enabled' do
before do
allow(Datadog.configuration).to receive(:experimental_propagate_process_tags_enabled).and_return(true)
end
it_behaves_like 'first span with process tags'
end

context 'without process tags enabled' do
# default is false
it_behaves_like 'first span without process tags'
end
end

context 'with a root span' do
Expand Down Expand Up @@ -384,6 +425,18 @@
include_context 'no git metadata'
it_behaves_like 'first span with no git metadata'
end

context 'with process tags enabled' do
before do
allow(Datadog.configuration).to receive(:experimental_propagate_process_tags_enabled).and_return(true)
end
it_behaves_like 'first span with process tags'
end

context 'without process tags enabled' do
# default is false
it_behaves_like 'first span without process tags'
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions supported-configurations.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
"DD_ERROR_TRACKING_HANDLED_ERRORS_INCLUDE": {
"version": ["A"]
},
"DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED": {
"version": ["A"]
},
"DD_GIT_COMMIT_SHA": {
"version": ["A"]
},
Expand Down
Loading