Skip to content

Commit

Permalink
Added: runtime_engine and runtime_platform tags to profiling HTTP req…
Browse files Browse the repository at this point in the history
…uest.
  • Loading branch information
delner committed Sep 8, 2020
1 parent d29119d commit 1049424
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/ddtrace/ext/profiling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module HTTP
FORM_FIELD_TAG_LANGUAGE = 'language'.freeze
FORM_FIELD_TAG_PROFILER_VERSION = 'profiler_version'.freeze
FORM_FIELD_TAG_RUNTIME = 'runtime'.freeze
FORM_FIELD_TAG_RUNTIME_ENGINE = 'runtime_engine'.freeze
FORM_FIELD_TAG_RUNTIME_PLATFORM = 'runtime_platform'.freeze
FORM_FIELD_TAG_RUNTIME_VERSION = 'runtime_version'.freeze
FORM_FIELD_TAG_SERVICE = 'service'.freeze
FORM_FIELD_TAG_VERSION = 'version'.freeze
Expand Down
7 changes: 5 additions & 2 deletions lib/ddtrace/profiling/transport/http/api/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ def build_form(env)
FORM_FIELD_RECORDING_START => flush.start.utc.iso8601,
FORM_FIELD_RECORDING_END => flush.finish.utc.iso8601,
FORM_FIELD_TAGS => [
"#{FORM_FIELD_TAG_RUNTIME}:#{flush.runtime}",
"#{FORM_FIELD_TAG_RUNTIME}:#{flush.language}",
"#{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_PROFILER_VERSION}:#{flush.profiler_version}",
# NOTE: Redundant w/ 'runtime'; may want to remove this later.
"#{FORM_FIELD_TAG_LANGUAGE}:#{flush.language}",
"#{FORM_FIELD_TAG_HOST}:#{flush.host}"
],
FORM_FIELD_DATA => pprof_file,
FORM_FIELD_RUNTIME => flush.runtime,
FORM_FIELD_RUNTIME => flush.language,
FORM_FIELD_FORMAT => FORM_FIELD_FORMAT_PPROF
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@
'recording-end' => kind_of(String),
'data[0]' => kind_of(String),
'types[0]' => /auto/,
'runtime' => Datadog::Ext::Runtime::LANG_INTERPRETER,
'runtime' => Datadog::Ext::Runtime::LANG,
'format' => Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_FORMAT_PPROF
)

# rubocop:disable Metrics/LineLength
tags = body["#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAGS}[]"].list
expect(tags).to be_a_kind_of(Array)
expect(tags).to include(
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{Datadog::Ext::Runtime::LANG_INTERPRETER}/,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{Datadog::Ext::Runtime::LANG}/,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_ENGINE}:#{Datadog::Ext::Runtime::LANG_ENGINE}/,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{Datadog::Ext::Runtime::LANG_PLATFORM}/,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME_VERSION}:#{Datadog::Ext::Runtime::LANG_VERSION}/,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_PROFILER_VERSION}:#{Datadog::Ext::Runtime::TRACER_VERSION}/,
/#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_LANGUAGE}:#{Datadog::Ext::Runtime::LANG}/
Expand Down
6 changes: 4 additions & 2 deletions spec/ddtrace/profiling/transport/http/api/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_FORMAT => Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_FORMAT_PPROF,
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RECORDING_START => flush.start.utc.iso8601,
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RECORDING_END => flush.finish.utc.iso8601,
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RUNTIME => flush.runtime,
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RUNTIME => flush.language,
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_RUNTIME_ID => flush.runtime_id,
Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAGS => array_including(
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{flush.runtime}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_RUNTIME}:#{flush.language}",
"#{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_PROFILER_VERSION}:#{flush.profiler_version}",
"#{Datadog::Ext::Profiling::Transport::HTTP::FORM_FIELD_TAG_LANGUAGE}:#{flush.language}",
Expand Down

0 comments on commit 1049424

Please sign in to comment.