Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include process pid when reporting profile #1464

Merged
merged 1 commit into from Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ddtrace/ext/profiling.rb
Expand Up @@ -29,6 +29,7 @@ module HTTP
FORM_FIELD_TAG_ENV = 'env'.freeze
FORM_FIELD_TAG_HOST = 'host'.freeze
FORM_FIELD_TAG_LANGUAGE = 'language'.freeze
FORM_FIELD_TAG_PID = 'pid'.freeze
FORM_FIELD_TAG_PROFILER_VERSION = 'profiler_version'.freeze
FORM_FIELD_TAG_RUNTIME = 'runtime'.freeze
FORM_FIELD_TAG_RUNTIME_ENGINE = 'runtime_engine'.freeze
Expand Down
1 change: 1 addition & 0 deletions lib/ddtrace/profiling/transport/http/api/endpoint.rb
Expand Up @@ -48,6 +48,7 @@ def build_form(env)
"#{FORM_FIELD_TAG_RUNTIME_ENGINE}:#{flush.runtime_engine}",
"#{FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{flush.runtime_platform}",
"#{FORM_FIELD_TAG_RUNTIME_VERSION}:#{flush.runtime_version}",
"#{FORM_FIELD_TAG_PID}:#{Process.pid}",
"#{FORM_FIELD_TAG_PROFILER_VERSION}:#{flush.profiler_version}",
# NOTE: Redundant w/ 'runtime'; may want to remove this later.
"#{FORM_FIELD_TAG_LANGUAGE}:#{flush.language}",
Expand Down
Expand Up @@ -12,7 +12,7 @@

RSpec.describe 'Adapters::Net profiling integration tests' do
before do
skip unless ENV['TEST_DATADOG_INTEGRATION']
skip 'TEST_DATADOG_INTEGRATION is not defined' unless ENV['TEST_DATADOG_INTEGRATION']
skip 'Profiling is not supported.' unless Datadog::Profiling.supported?
end

Expand Down Expand Up @@ -50,8 +50,13 @@
end

after do
server.shutdown
@server_thread.join
unless RSpec.current_example.skipped?
# When the test is skipped, server has not been initialized and @server_thread would be nil; thus we only
# want to touch them when the test actually run, otherwise we would cause the server to start (incorrectly)
# and join to be called on a nil @server_thread
server.shutdown
@server_thread.join
end
end
end

Expand Down Expand Up @@ -105,6 +110,7 @@
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_ENGINE}:#{Datadog::Ext::Runtime::LANG_ENGINE}/o,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{Datadog::Ext::Runtime::LANG_PLATFORM}/o,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_VERSION}:#{Datadog::Ext::Runtime::LANG_VERSION}/o,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PID}:#{Process.pid}/o,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PROFILER_VERSION}:#{Datadog::Ext::Runtime::TRACER_VERSION}/o,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_LANGUAGE}:#{Datadog::Ext::Runtime::LANG}/o
)
Expand Down
Expand Up @@ -71,6 +71,7 @@
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_ENGINE}:#{flush.runtime_engine}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{flush.runtime_platform}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_VERSION}:#{flush.runtime_version}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PID}:#{Process.pid}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PROFILER_VERSION}:#{flush.profiler_version}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_LANGUAGE}:#{flush.language}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_HOST}:#{flush.host}"
Expand Down